pierrejeambrun commented on code in PR #66914:
URL: https://github.com/apache/airflow/pull/66914#discussion_r3281476572
##########
airflow-core/newsfragments/66914.bugfix.rst:
##########
@@ -0,0 +1 @@
+Stop recomputing ``next_dagrun_*`` fields on paused Dags each parse cycle.
Before this change, ``DagModel.calculate_dagrun_date_fields`` ran
unconditionally on every parse cycle for every Dag, including paused ones,
which caused ``next_dagrun_logical_date`` and ``next_dagrun_run_after`` to
advance one cron period per cycle while staying strictly before "now" for
``catchup=False`` timetables — visible to external API consumers via ``GET
/api/v2/dags`` and ``GET /api/v2/dags/{id}/details``. The fields now stay
frozen while the Dag is paused and are recomputed fresh by the REST and CLI
unpause paths when ``is_paused`` flips back to ``False``.
Review Comment:
To remove. We only use 'significant' newsfragment.
##########
airflow-core/src/airflow/cli/commands/dag_command.py:
##########
Review Comment:
- cli/commands/dag_command.py:353 — airflow dags next-execution
my_paused_dag will now return the frozen pre-pause "next" timestamp instead of
the drifting recompute. The existing [INFO] Please be
reminded this DAG is PAUSED now warning at line 349 is still printed, but
the date the user sees changes semantics. Worth either a sentence in that
warning ("showing the frozen pre-pause value") or just
calling it out in the PR description so it's not a surprise.
##########
airflow-core/src/airflow/models/dag.py:
##########
@@ -801,6 +816,42 @@ def calculate_dagrun_date_fields(
next_dagrun_partition_date=str(self.next_dagrun_partition_date),
)
+ @provide_session
+ def recompute_next_dagrun_fields_after_unpause(self, *, session: Session =
NEW_SESSION) -> None:
Review Comment:
Maybe here explain that the `callers flipping is_paused=False must invoke
this; the next parse cycle is the safety net if they don't.`
--
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]