Add guidance on when to use ResumableJobMixin vs deferrable and async operators#67794
Add guidance on when to use ResumableJobMixin vs deferrable and async operators#67794jangByeongHui wants to merge 7 commits into
Conversation
…n from the deferring guide
…om the Task SDK home page
1a9d264 to
20494dd
Compare
|
Hi @amoghrajesh — I know you're busy, but would you mind taking a look at this PR when you get a chance? It adds documentation comparing the three patterns for handling long-running tasks in Airflow 3.x (deferrable operators, async @task, and ResumableJobMixin), and any feedback from you would be really appreciated. |
|
ResumableJobMixin only exists in main, and will be released with 3.3.0 |
|
|
||
| .. _deferring/resumable: | ||
|
|
||
| Resumable Operators (ResumableJobMixin) |
There was a problem hiding this comment.
Resumable Operators are usable without using this mixin -- for instance if you are processing a list of files in S3 and want to carry on where you left off, using that job mixin would not be appropriate, but using resuable could be.
| execution. Use it when: | ||
|
|
||
| - A Triggerer is not available, or the operator is already synchronous. | ||
| - The external system supports reconnecting to a running job via a stable identifier. |
There was a problem hiding this comment.
This is specific to the mixin, not an intrinsic requirement of when to use State/ Resumable operators.
This is not incorrect, but it's not complete.
There was a problem hiding this comment.
Remove this. Not relevant to call out like that.
| Resumable Operators | ||
| ------------------- | ||
|
|
||
| A *resumable operator* uses :class:`~airflow.sdk.ResumableJobMixin` to make a |
There was a problem hiding this comment.
Again, this isn't true. A resumable operator is one that reads from the task state store and makes decisions based on the data included in there.
|
Closing this, @amoghrajesh you'd be the best person to work on this doc. Others won't have that context. Thanks for the PR @jangByeongHui but this needs more context from the AIP implementer ! |
Summary
Airflow 3.x now ships three mechanisms for handling long-running or blocking
work inside a task — deferrable operators, async Python tasks, and
ResumableJobMixin— but no documentation explains the trade-offs or when toreach for each one.
This PR closes that gap by extending the existing Deferred vs Async Operators
page in the Task SDK docs with a full three-way comparison, and adding a short
cross-reference in the core deferring guide.
closes: #67706
Changes
task-sdk/docs/deferred-vs-async-operators.rst— primaryPage title updated from Deferred vs Async Operators to
Deferred, Async, and Resumable Operators.
The RST label
sdk-deferred-vs-async-operatorsis preserved unchanged soexisting external links continue to work.
Intro paragraph updated to mention all three patterns.
A
.. versionchanged:: 3.3.0note is added, pointing readers to the newsection.
New "Resumable Operators" section added before "When not to use…":
to
task_statebefore polling; on retry it reconnects to the already-runningjob instead of submitting a duplicate.
required, duplicate submission prevented automatically.
ResumableJobMixin,with a note that
SparkSubmitOperatoruses this pattern in practice.New "Three-way Comparison" table (
.. list-table::) comparing deferrable /async / resumable across six dimensions:
@taskmethod_name/kwargstask_stateNew bullet appended to the existing "When not to use" section advising
against resumable operators when a Triggerer is available and the operator is
being written from scratch.
airflow-core/docs/authoring-and-scheduling/deferring.rst— secondaryoperators alongside deferred and async.
.. _deferring/resumable:subsection after the existingmode='reschedule' vs deferrable=Truecomparison table, summarising theresumable pattern and linking to the Task SDK page for the full comparison.
task-sdk/docs/index.rst— tertiarythree patterns instead of two.
Testing
This PR changes documentation only. No Python source files were modified.
Pre-commit hooks (
prek run --from-ref main --stage pre-commit) were runlocally and passed — including RST lint, codespell, and newsfragment validation.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (claude-sonnet-4-6) following the guidelines