shivaam commented on code in PR #62561:
URL: https://github.com/apache/airflow/pull/62561#discussion_r2972763427
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -1853,8 +1853,17 @@ def _mark_backfills_complete(self, session: Session =
NEW_SESSION) -> None:
unfinished_states = (DagRunState.RUNNING, DagRunState.QUEUED)
now = timezone.utcnow()
# todo: AIP-78 simplify this function to an update statement
+ initializing_cutoff = now - timedelta(minutes=2)
query = select(Backfill).where(
Backfill.completed_at.is_(None),
+ # Guard: backfill must have at least one association,
+ # otherwise it is still being set up (see #61375).
+ # Allow cleanup of orphaned backfills older than 2 minutes
+ # that failed during initialization and never got any associations.
+ or_(
+
exists(select(BackfillDagRun.id).where(BackfillDagRun.backfill_id ==
Backfill.id)),
+ Backfill.created_at < initializing_cutoff,
Review Comment:
added this gaurd that will cleanup any backfills which dont have associated
dag runs after 2 mins. Therefore, we wont have any stuck backfills
--
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]