Repository navigation
Fix manual runs getting a zero-length data interval across DST - #70089
Merged
Merged
Conversation
…lier croniter steps back on naive wall-clock time, but make_aware can map a tick inside a DST transition forward onto the current instant or later. _get_prev then returned a "previous" tick that was not strictly earlier, so a manual run got a zero-length data interval on spring-forward, or one ending after run_after on fall-back. A zero-length interval also trips the point-in-time guard in next_dagrun_info and silently skips a scheduled period.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
harjothkhara
marked this pull request as ready for review
July 19, 2026 04:55
uranusjr
reviewed
Aug 9, 2026
_skip_to_latest is the only caller that steps _get_prev twice, so a regression there would silently reappear as a run proposed for a period that has not elapsed. Nothing in the branch covered that path.
uranusjr
reviewed
Aug 10, 2026
uranusjr
approved these changes
Aug 10, 2026
Lee-W
reviewed
Aug 10, 2026
Lee-W
left a comment
Member
There was a problem hiding this comment.
one nit improvement. overall looks good
The fix lives in CronMixin._get_prev, shared by MultipleCronTriggerTimetable and CronPartitionTimetable, so a regression there would hit them too even though only CronTriggerTimetable had a DST case.
uranusjr
approved these changes
Aug 11, 2026
Lee-W
reviewed
Aug 11, 2026
Lee-W
reviewed
Aug 11, 2026
Lee-W
left a comment
Member
There was a problem hiding this comment.
I'm good after parameterization is done. Thanks!
The three timetables share CronMixin._get_prev and were being exercised by three near-identical test bodies differing only in construction and call signature.
Lee-W
approved these changes
Aug 12, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
dabla
pushed a commit
to dabla/airflow
that referenced
this pull request
Aug 14, 2026
imrichardwu
pushed a commit
to imrichardwu/airflow
that referenced
this pull request
Sep 11, 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.
Why
On the two days a year the clocks change, a manually triggered run can get a data interval that is zero length, or that ends after the run time.
With
CronDataIntervalTimetable("0 2 * * *", timezone="America/New_York"), a manual run at2024-03-10 07:30Z:croniter steps back on naive wall-clock time, but
make_awaremoves a tick that falls in the spring-forward gap onto the next real instant. When the previous tick is in the gap it lands on the current time, so_get_prevreturns the time it was asked about.That zero-length interval then costs a run.
next_dagrun_inforeads it as a point-in-time run and skips a period (#66132, correct for the case it was written for):The fall-back side overshoots instead. With
0 1 * * *inAmerica/New_Yorkat2024-11-03 05:30Z,_get_prevreturns06:00Z— half an hour in the future — soCronTriggerTimetablewithrun_immediately=Truefires a tick that has not happened yet.Also reproduces in
Europe/Zurich,Australia/SydneyandAustralia/Lord_Howe.What
_get_prevnow keeps steppingcron.get_prevuntil the result is strictly earlier than the time asked about.get_previs strictly decreasing on naive time, so it terminates.The
_covers_every_hourbranch is untouched — it uses a wall-clock delta rather thanmake_aware, so it cannot hit this.Only values that were already wrong change. Nothing outside a DST transition window is affected.
Testing
Three regression tests, all failing before and passing after:
test_cron_infer_manual_data_interval_dst— gap and fall-back, includingAustralia/Lord_Howefor its 30-minute offsettest_cron_next_dagrun_info_after_dst_manual_run— the skipped periodtest_cron_trigger_run_immediately_does_not_pick_future_run—CronTriggerTimetable, which shares the mixinairflow-core/tests/unit/timetables/is 246 passed.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 4.8 following the guidelines