Skip to content

Add a standard toggle for resumability to ResumableJobMixin#68623

Merged
amoghrajesh merged 10 commits into
apache:mainfrom
astronomer:resumable-mixin-reconnect-flag
Jun 23, 2026
Merged

Add a standard toggle for resumability to ResumableJobMixin#68623
amoghrajesh merged 10 commits into
apache:mainfrom
astronomer:resumable-mixin-reconnect-flag

Conversation

@amoghrajesh

@amoghrajesh amoghrajesh commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Was generative AI tooling used to co-author this PR?
  • Yes: claude sonnet 4.6

Why

ResumableJobMixin had no standard on/off switch for crash recovery. When SparkSubmitOperator was
ported to resumability, I added a reconnect_on_retry parameter, but any future resumable operator
would need to invent their own name — making the flag inconsistent across operators and impossible to
measure uniformly.

What changed

  • ResumableJobMixin now owns durable: bool = True in its own __init__, decorated with
    @BaseOperatorMeta._apply_defaults. Operators that inherit (ResumableJobMixin, BaseOperator) get
    the flag for free — no redeclaration needed, default_args injection and .partial() work
    automatically.
  • When False, execute_resumable() skips all task_state_store interaction and runs a plain
    submit/poll/result cycle.
  • SparkSubmitOperator.reconnect_on_retry is renamed to durable. The per-mode if/else branching in
    execute() is removed and all three tracking paths (standalone, K8s, YARN) now call
    execute_resumable(context) directly.
  • reconnect_on_retry is kept as a deprecated alias for backcompat with 6.1.0 — passing it raises an
    AirflowProviderDeprecationWarning and maps to durable.

Impact on operators using resumability

No behavior change. durable defaults to True, so crash recovery is on by default exactly as before.

How to opt out

Set durable=False on the task:

SparkSubmitOperator(
    task_id="my_spark_job",
    application="my_app.jar",
    durable=False,
)

Or via default_args to disable for all tasks in a DAG:

with DAG("my_dag", default_args={"durable": False}):

Implementation note

ResumableJobMixin.__init__ is decorated directly with @BaseOperatorMeta._apply_defaults. When
super().__init__(**kwargs) reaches the mixin, apply_defaults fires, sees durable in the
signature, and injects it from default_args if not explicitly set. Operators just need
(ResumableJobMixin, BaseOperator) ordering and super().__init__(**kwargs).


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

@amoghrajesh

Copy link
Copy Markdown
Contributor Author

Converting to draft as I am unsure if this is the best solution.

@amoghrajesh amoghrajesh marked this pull request as ready for review June 17, 2026 10:00

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth mentioning :param durable: etc in the doc string of SparkSubmitOperator explicitly?

LGTM I think, but lets get @vikramkoka and @kaxil's view on this.

Comment thread providers/apache/spark/docs/operators.rst Outdated
@amoghrajesh

amoghrajesh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

It's probably worth mentioning :param durable: etc in the doc string of SparkSubmitOperator explicitly?

Yes it is, mentioned it in handling comments from ash

(cherry picked from commit 546469d70ec3efc373bfa1d73c2f8d8d79b5cd03)
@amoghrajesh amoghrajesh merged commit 44ac115 into apache:main Jun 23, 2026
145 checks passed
@amoghrajesh amoghrajesh deleted the resumable-mixin-reconnect-flag branch June 23, 2026 08:55
@github-project-automation github-project-automation Bot moved this from In progress to Done in AIP-103: Task State Management Jun 23, 2026
cetingokhan pushed a commit to cetingokhan/airflow that referenced this pull request Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full tests needed We need to run full set of tests for this PR to merge

Projects

Development

Successfully merging this pull request may close these issues.

3 participants