Making ResumableJobMixin a abstract class and its methods abstractmet…#69607
Open
amoghrajesh wants to merge 1 commit into
Open
Making ResumableJobMixin a abstract class and its methods abstractmet…#69607amoghrajesh wants to merge 1 commit into
amoghrajesh wants to merge 1 commit into
Conversation
vincbeck
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…hods
Was generative AI tooling used to co-author this PR?
What
ResumableJobMixin's six subclass-facing methods (submit_job,get_job_status,is_job_active,is_job_succeeded,poll_until_complete,get_job_result) are the entire contract a subclass must fulfill to get crash-safe execution. Today, if an implementer forgets to override one, the class still constructs fine and the mistake only surfaces as aNotImplementedErrorthe first time that specific method is actually called, which can be much later than when the operator was defined.Current behaviour
A subclass missing, say,
get_job_resultinstantiates without complaint. The gap is invisible until a task actually reaches that code path, which for methods likepoll_until_complete's reconnect branch might only happen after a real worker crash in production, long after the operator shipped.Proposed change
ResumableJobMixinnow inherits fromABCand decorates all six methods with@abstractmethod.BaseOperatorMeta(the metaclass everyBaseOperatorsubclass already uses) already inherits fromABCMeta, so this composes with(ResumableJobMixin, BaseOperator)with zero metaclass conflict.Why all six must be overridden
The mixin has no reasonable default for any of them and each one is where the subclass's specific external system (Databricks, Snowflake, etc.) actually gets talked to, and
execute_resumable()'s control flow calls all six depending on which branch it takes (fresh submit, reconnect, already-succeeded, terminal failure).A subclass that's missing even one of them isn't "mostly correct", it has a hole in the exact contract this mixin exists to provide, and today that hole is silent until runtime. Marking them abstract moves the failure from "the first time this specific code path executes, maybe in production during an actual crash" to "the moment the class is defined," which is a strictly better place to catch it, a missing override bug should fail at parse/import time, not lie dormant until an operator's least-tested branch (e.g. reconnect-on-crash) finally runs for real.
User implications / backcompat
DatabricksSubmitRunOperator,DatabricksRunNowOperator, andSparkSubmitOperator(all currently shipped) already override every one of the six methods, so nothing changes for them; overriding an abstract method works identically to overriding a regular one.{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.