sharetheknowledge commented on code in PR #69869: URL: https://github.com/apache/airflow/pull/69869#discussion_r4490804920
########## airflow-core/docs/authoring-and-scheduling/timetable.rst: ########## @@ -368,10 +368,14 @@ scheduled run, because the next run is advanced one period to avoid colliding with the previous run's ``logical_date``. The reverse direction (data interval -> trigger) does not skip a run. -This transition can happen without editing a Dag, in two ways: +This transition can happen without editing a Dag, in three ways: Review Comment: Dropped the note, and the paragraph now names each key for its own schedule type. Changed to "any of these changes". ########## airflow-core/newsfragments/69869.significant.rst: ########## @@ -0,0 +1,63 @@ +Fix ``create_delta_data_intervals`` being ignored for timedelta/relativedelta schedules + +``[scheduler] create_delta_data_intervals`` now correctly controls timetable selection +for DAGs that pass a ``timedelta`` or ``relativedelta`` to ``schedule=``. Before this +fix, ``create_cron_data_intervals`` silently governed both cron-string DAGs **and** +timedelta/relativedelta DAGs, making ``create_delta_data_intervals`` a no-op. + +**Who is affected:** + +Users who set ``create_cron_data_intervals = True`` in their Airflow 3 config to +preserve Airflow 2 data-interval semantics for cron DAGs (as recommended by +``upgrading_to_airflow3.rst``) are also unintentionally running their +``timedelta``/``relativedelta`` DAGs on ``DeltaDataIntervalTimetable``. After this +fix, those DAGs will fall through to the correct default (``DeltaTriggerTimetable``) +unless ``create_delta_data_intervals`` is also set to ``True``. + +This also affects DAGs migrated from Airflow 2 via ``conversion_v1_to_v2``, which +rebuilds timetables through the same code path. + +**Behaviour changes:** + +- ``create_delta_data_intervals`` now takes effect as documented. +- ``create_cron_data_intervals`` now affects **only** cron-string DAGs. +- The two config keys are independent, as ``config.yml`` always documented. + +**Migration:** + +If you rely on ``DeltaDataIntervalTimetable`` for ``timedelta``/``relativedelta`` +DAGs (i.e. you need contiguous data intervals and ``ds``/``ts`` anchored at +``data_interval_start``), set this **before** the next scheduler restart:: + + [scheduler] + create_delta_data_intervals = True + +You can safely set this flag on current ``main`` (before this fix ships) because Review Comment: Added the `cron=False, delta=True` group (one skipped run). Migration is now "set the delta key to the same value as the cron key before upgrading", which covers both groups. Reworded to your suggestion and replaced "scheduler restart" with "before upgrading". ########## airflow-core/newsfragments/69869.significant.rst: ########## @@ -0,0 +1,63 @@ +Fix ``create_delta_data_intervals`` being ignored for timedelta/relativedelta schedules Review Comment: Retitled as suggested and removed the "fix" wording. ########## airflow-core/newsfragments/69869.significant.rst: ########## @@ -0,0 +1,63 @@ +Fix ``create_delta_data_intervals`` being ignored for timedelta/relativedelta schedules + +``[scheduler] create_delta_data_intervals`` now correctly controls timetable selection +for DAGs that pass a ``timedelta`` or ``relativedelta`` to ``schedule=``. Before this +fix, ``create_cron_data_intervals`` silently governed both cron-string DAGs **and** +timedelta/relativedelta DAGs, making ``create_delta_data_intervals`` a no-op. + +**Who is affected:** + +Users who set ``create_cron_data_intervals = True`` in their Airflow 3 config to +preserve Airflow 2 data-interval semantics for cron DAGs (as recommended by +``upgrading_to_airflow3.rst``) are also unintentionally running their +``timedelta``/``relativedelta`` DAGs on ``DeltaDataIntervalTimetable``. After this +fix, those DAGs will fall through to the correct default (``DeltaTriggerTimetable``) +unless ``create_delta_data_intervals`` is also set to ``True``. + +This also affects DAGs migrated from Airflow 2 via ``conversion_v1_to_v2``, which +rebuilds timetables through the same code path. + +**Behaviour changes:** + +- ``create_delta_data_intervals`` now takes effect as documented. +- ``create_cron_data_intervals`` now affects **only** cron-string DAGs. +- The two config keys are independent, as ``config.yml`` always documented. + +**Migration:** + +If you rely on ``DeltaDataIntervalTimetable`` for ``timedelta``/``relativedelta`` +DAGs (i.e. you need contiguous data intervals and ``ds``/``ts`` anchored at +``data_interval_start``), set this **before** the next scheduler restart:: + + [scheduler] + create_delta_data_intervals = True + +You can safely set this flag on current ``main`` (before this fix ships) because +``create_delta_data_intervals`` was previously a no-op - setting it to ``True`` +will have no effect until the fix is in place, so there is no risk of an +unexpected timetable switch during the transition. + +Switching a DAG from ``DeltaTriggerTimetable`` to ``DeltaDataIntervalTimetable`` +(i.e. flipping ``create_delta_data_intervals`` from ``False`` to ``True`` when +existing DAG runs are present) skips one scheduled run to avoid colliding with +the previous run's ``logical_date``. Plan for this one-period gap or convert +affected DAGs to an explicit ``DeltaDataIntervalTimetable(...)`` instance in Review Comment: Removed, agreed it doesn't avoid the skip. ########## airflow-core/docs/installation/upgrading_to_airflow3.rst: ########## @@ -388,6 +388,26 @@ These include: Airflow 3 dagruns already exist (going ``CronTriggerTimetable`` -> ``CronDataIntervalTimetable``), one scheduled run is skipped to avoid colliding with the previous run's ``logical_date``. + +- The ``create_delta_data_intervals`` configuration is now **functional**. Previously, a bug caused Review Comment: Rewritten around the Airflow 2 -> 3 default change, matching the cron bullet. The bug history is now only in the newsfragment. ########## airflow-core/docs/installation/upgrading_to_airflow3.rst: ########## @@ -388,6 +388,26 @@ These include: Airflow 3 dagruns already exist (going ``CronTriggerTimetable`` -> ``CronDataIntervalTimetable``), one scheduled run is skipped to avoid colliding with the previous run's ``logical_date``. + +- The ``create_delta_data_intervals`` configuration is now **functional**. Previously, a bug caused + ``create_cron_data_intervals`` to silently control timetable selection for both cron-string DAGs + **and** ``timedelta``/``relativedelta`` DAGs, making ``create_delta_data_intervals`` a no-op. + + This affects users who set ``create_cron_data_intervals = True`` to preserve Airflow 2 + data-interval semantics for cron DAGs (as the upgrade guide recommends). Because of the bug, + that flag was also keeping ``timedelta``/``relativedelta`` DAGs on ``DeltaDataIntervalTimetable``. + After this fix those DAGs fall through to ``DeltaTriggerTimetable`` instead, shifting Review Comment: Fixed: `data_interval_end` no longer listed as shifting, and the zero-width window is called out. Replaced `conversion_v1_to_v2` with "Dags whose serialized form was written by Airflow 2" in both places. -- 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]
