Repository navigation
Add draining state for graceful Dag pausing - #72407
Merged
dheerajturaga merged 12 commits intoSep 14, 2026
Merged
Conversation
dheerajturaga
requested review from
Lee-W,
XD-DENG,
amoghrajesh,
ashb,
bbovenzi,
bugraoz93,
choo121600,
ephraimbuddy,
guan404ming,
henry3260,
jason810496,
kaxil,
pierrejeambrun,
potiuk,
rawwar,
ryanahamilton,
shubhamraj-git,
uranusjr and
vatsrahul1001
as code owners
September 2, 2026 02:35
Backfill metadata becomes visible before its Dag runs are committed. Without protecting that initialization window, the scheduler can pause a draining Dag before the accepted backfill has work available to keep the drain open.
Ensure the Active Dags dashboard card opens the same exact set represented by its count while preserving the established meaning of the paused filter.
dheerajturaga
force-pushed
the
add-dag-draining-state
branch
from
September 11, 2026 18:59
2b80394 to
b4f8665
Compare
Stats.tsx now links the active-Dags card to dags?scheduling_state=active instead of dags?paused=false, but the e2e spec still asserted the old query param, breaking Chromium/Firefox/WebKit e2e CI.
dheerajturaga
force-pushed
the
add-dag-draining-state
branch
from
September 12, 2026 21:22
598a6e1 to
25e1a99
Compare
1 task done
Contributor
|
Tested locally. Works nicely! |
eladkal
approved these changes
Sep 14, 2026
Contributor
Backport failed to create: airflow-ctl/v0-1-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 35f33ed airflow-ctl/v0-1-testThis should apply the commit to the airflow-ctl/v0-1-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 14, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D57QaXubhpy8CDH4c23KcP
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 14, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
1 task done
1 task done
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 16, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
1 task done
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 22, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 24, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 24, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 25, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
dheerajturaga
added a commit
to dheerajturaga/airflow
that referenced
this pull request
Sep 25, 2026
Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in apache#72407. related: apache#22006
1 task done
bbovenzi
pushed a commit
that referenced
this pull request
Sep 26, 2026
* Add a bulk pause/drain action to the Dags list Draining a Dag with unfinished runs now asks whether to drain or pause immediately, which turned stopping many Dags into two clicks per Dag instead of one. Selecting several Dags in the table view and pausing or draining them together needs at most one such choice for the whole batch. Follow-up to the draining state added in #72407. related: #22006 * Mention bulk pause/drain in the Dag draining release note The bulk action in the Dags list is part of the graceful draining feature, so the release note should credit it alongside the core and airflowctl changes. * Keep already-paused Dags paused when bulk draining Draining clears is_paused, so a paused Dag caught up in a bulk drain let the scheduler resume its unfinished runs until the drain completed, the opposite of what the user asked for. Such Dags also forced the drain-vs-pause prompt even when every unpaused Dag in the selection was idle. * Add a bulk unpause action to the Dags list A selection could be paused or drained in one go but had to be resumed one toggle at a time. Unpausing always asks for confirmation because resuming many Dags at once can start a burst of catchup runs.
1 task done
2 tasks done
1 task done
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.
Pausing a Dag today is abrupt: it stops the Dag mid-flight, letting running tasks
finish but stranding queued and downstream tasks until it is unpaused. There is no
way to say "stop starting new scheduled runs, but let the work in flight finish."
That gap bites hardest during upgrades and maintenance windows. The workaround in
the wild is to rewrite every Dag's schedule to
None, wait for runs to drain, dothe work, then put the schedules back — invasive, and easy to get wrong.
This adds a
drainingscheduling state that expresses it directly:asset-triggered runs, while letting task instances in queued and running runs
continue to be scheduled.
A manual, operator-triggered, asset-materialization, or backfill request extends
the drain until the resulting work finishes.
pausedonce no unfinished runs remain andno newly accepted backfill is still initializing, recording a
drain_completedaudit log entry.
Draining is transient, not a third resting state. It always converges to
paused; the resting states are stillactiveandpaused. The UI reflects that —the pause control stays a binary toggle, and drain is offered at the one moment it
carries meaning: flipping a Dag off while it still has unfinished runs asks whether
to drain then pause or pause now. A Dag with nothing running pauses in a single
click as before, since the two are equivalent there.
API.
DAGResponsegains ascheduling_statefield.PATCH /dags/{dag_id}accepts either
is_pausedorscheduling_stateand rejects a body carrying both.Existing
is_pausedclients are unaffected.Migration. Adds
dag.is_draining(non-null, default false) with an index and aNOT (is_paused AND is_draining)check constraint. It also adds a supporting indexfor identifying an initializing backfill by Dag.
closes: #22006
Screenshots:
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-5), Claude Code (Opus 5) following the guidelines