TSKVenkat opened a new pull request, #72250:
URL: https://github.com/apache/airflow/pull/72250

   Changing a Dag from an hourly to a daily cron stops it being scheduled 
again. The scheduler keeps logging `run already exists; skipping dagrun 
creation` for a `logical_date` that is already taken and never advances past 
it, so the Dag silently stops producing runs until rows are deleted by hand.
   
   `_align_to_prev` maps the previous run's interval end back onto the new 
schedule. When the new cron is coarser than the one that produced that run, the 
result is the boundary the run already occupies, so `next_dagrun_info` proposes 
a `logical_date` identical to the existing run's.
   
   Reproduced on `main` (3.4.0) with the reporter's scenario — an hourly run at 
`2026-05-04 00:00` with interval `[00:00, 01:00)`, then a switch to `0 0 * * *`:
   
   ```
     previous run logical_date : 2026-05-04 00:00:00+00:00
     proposed next logical_date: 2026-05-04 00:00:00+00:00   <- collides, 
scheduler stalls
   ```
   
   and after the change:
   
   ```
     proposed next logical_date: 2026-05-05 00:00:00+00:00   <- advances
   ```
   
   A guard for this already existed, added in #66132, but it only covered the 
zero-length intervals `CronTriggerTimetable` leaves behind (`start == end`). 
The collision is not specific to those: it happens whenever the previous run 
came from any finer schedule. Comparing the proposed `logical_date` against the 
previous run's expresses the invariant the scheduler actually depends on — a 
proposed run must be strictly later than the last one — and subsumes the 
zero-length case, so the existing test for it still passes unchanged.
   
   Tests: `test_coarser_schedule_does_not_re_emit_logical_date` covers the 
hourly-to-daily switch for both catchup settings. It fails on `main` (2 failed) 
and passes with this change, while 
`test_zero_length_last_interval_does_not_re_emit_logical_date` passes on both 
sides. Full `airflow-core/tests/unit/timetables/` run: 253 passed, 1 
pre-existing failure in `test_workday_timetable.py` caused by `pandas` missing 
from my environment (it fails identically on unmodified `main`).
   
   closes: #66754
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to