dstandish commented on code in PR #59724:
URL: https://github.com/apache/airflow/pull/59724#discussion_r2645710548
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2277,6 +2255,43 @@ def _schedule_dag_run(
return callback_to_run
+ def _update_next_dagrun_fields(
+ self,
+ *,
+ serdag: SerializedDAG,
+ dag_model: DagModel,
+ session: Session,
+ active_non_backfill_runs: int | None = None,
+ data_interval: DataInterval,
+ ):
+ """
+ Conditionally update fields next_dagrun and next_dagrun_create_after
on dag table.
+
+ The ``dag_run`` param is only to be given when
Review Comment:
and the reason you needed to not give it unconditionally is because when you
have just createed the run, it's always not in terminated state. but the
"should update" logic before would check that the state of the given run must
be terminal, else it would not increment next dag run. so if, in the dag
creation context, we were to give it what it asked for (the last dag run) it
would have done the wrong thing. this is why the logic needed to be pulled out
so the evaluation happens outside of the function, and the function always does
what it says it's going to do.
--
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]