Bisk1 commented on code in PR #34027:
URL: https://github.com/apache/airflow/pull/34027#discussion_r1313530009
##########
airflow/jobs/scheduler_job_runner.py:
##########
@@ -1300,9 +1300,22 @@ def _create_dag_runs_dataset_triggered(
)
def _should_update_dag_next_dagruns(
- self, dag: DAG, dag_model: DagModel, total_active_runs: int | None =
None, *, session: Session
+ self,
+ dag: DAG,
+ dag_model: DagModel,
+ last_dag_run: DagRun | None = None,
+ total_active_runs: int | None = None,
+ *,
+ session: Session,
) -> bool:
"""Check if the dag's next_dagruns_create_after should be updated."""
+ # If last_dag_run is defined, the update was triggered by a scheduling
decision in this DAG run.
+ # In such case, schedule next only if last_dag_run is finished and was
an automated run.
+ if last_dag_run and not (
+ last_dag_run.state in State.finished_dr_states
+ and last_dag_run.run_type in [DagRunType.SCHEDULED,
DagRunType.BACKFILL_JOB]
Review Comment:
This is the actual bugfix: previously we didn't check run type so manual
runs were messing with scheduling decisions. Compare it with
https://github.com/apache/airflow/blob/3ae6b4e86fe807c00bd736c59df58733df2b9bf9/airflow/models/dag.py#L2943
where exact same filtering is applied before eventually invoking
calculate_dagrun_date_fields for filtered dag runs.
--
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]