nailo2c commented on code in PR #58543:
URL: https://github.com/apache/airflow/pull/58543#discussion_r3156432725
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2264,6 +2266,63 @@ def _update_state(dag: SerializedDAG, dag_run: DagRun):
dag_run.run_id,
)
continue
+ # For AssetAndTimeSchedule, defer starting until all required
assets are queued.
+ # Only gate scheduled runs; manual and backfill runs should start
immediately.
+ if isinstance(dag.timetable, AssetAndTimeSchedule) and
dag_run.run_type == DagRunType.SCHEDULED:
+ # Reuse dagrun_timeout to fail runs that wait in QUEUED for
assets for too long.
+ if (
+ dag.dagrun_timeout
+ and dag_run.queued_at
+ and dag_run.queued_at < timezone.utcnow() -
dag.dagrun_timeout
+ ):
+ dag_run.set_state(DagRunState.FAILED)
+ session.flush()
+ self.log.info(
+ "Run %s of %s has timed-out while waiting for assets",
+ dag_run.run_id,
+ dag_run.dag_id,
+ )
+ if (
+ dag_run.run_type
+ in (
+ DagRunType.SCHEDULED,
+ DagRunType.MANUAL,
+ DagRunType.ASSET_TRIGGERED,
+ )
Review Comment:
Ah... yes that's redundant, since line 2271 has set DagRunType to SCHEDULED,
we don't need to check it here again. Great catch.
--
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]