Skip to content

[v3-3-test] Fix Dag scheduling stall after switching to a coarser cron (#72498) - #72679

Merged
vatsrahul1001 merged 1 commit into
v3-3-testfrom
backport-3111701-v3-3-test
Sep 8, 2026
Merged

vatsrahul1001 merged 1 commit into
v3-3-testfrom
backport-3111701-v3-3-test

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor
  • Clarify coarser schedule regression test comment
    (cherry picked from commit 3111701)

Co-authored-by: Jason(Zhe-You) Liu [email protected]

#72498)

* Fix Dag scheduling stall after switching to a coarser cron

Changing a Dag's schedule to a coarser cron (e.g. hourly to daily) could
make the realigned next run collide with the logical_date of the run
already on record. The scheduler would then loop on "run already exists;
skipping dagrun creation" forever instead of advancing, since every input
to the recompute (the DAG's static start_date, the stale reference run)
is a fixed constant that reproduces the identical collision every time.

A single-step guard for this class of collision already existed for the
narrower case of a CronTriggerTimetable-to-CronDataIntervalTimetable
switch. A single step turns out to always be enough for both shipped
_DataIntervalTimetable subclasses, but only because of invariants that
are specific to them and aren't enforced anywhere -- a custom Timetable
isn't guaranteed to uphold them. Retry a bounded number of times instead
of assuming one step suffices, and fail loudly if that budget is
exhausted rather than looping unbounded, which would otherwise hang the
scheduler's main loop for every Dag if a future _get_next implementation
ever stopped strictly advancing.

* Simplify the coarser-schedule-stall guard to a single bounded retry

Only one advance past the previous run's start is provably necessary
for both shipped _DataIntervalTimetable subclasses; a second retry was
unproven margin that only existed to satisfy a synthetic test case, not
any real or documented timetable behavior. A bounded while loop implied
that margin was load-bearing. Replacing it with a single retry followed
by a loud failure keeps the same fail-fast guarantee -- a custom
Timetable needing more than one step is still caught immediately rather
than silently retried -- while matching what the invariant actually
proves.

* Use ValueError for timetable alignment guard

* Avoid exposing timetable internals in error message

* Simplify schedule change test runner helper

* Clarify zero-length interval test wording

* Clarify coarser schedule regression test comment
(cherry picked from commit 3111701)

Co-authored-by: Jason(Zhe-You) Liu <[email protected]>
@jason810496
jason810496 marked this pull request as ready for review September 8, 2026 04:17
@jason810496 jason810496 added this to the Airflow 3.3.2 milestone Sep 8, 2026
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026
@vatsrahul1001
vatsrahul1001 merged commit 016dae4 into v3-3-test Sep 8, 2026
100 of 109 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-3111701-v3-3-test branch September 8, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants