kaxil commented on code in PR #72054:
URL: https://github.com/apache/airflow/pull/72054#discussion_r4743614105


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -247,6 +247,12 @@ def cancel_backfill(backfill_id: NonNegativeInt, session: 
SessionDep) -> Backfil
         raise HTTPException(status.HTTP_404_NOT_FOUND, BACKFILL_NOT_FOUND)
     if b.completed_at is not None:
         raise HTTPException(status.HTTP_409_CONFLICT, "Backfill is already 
completed.")
+    # The backfill row is committed before its Dag runs and associations are 
created. Cancelling
+    # in that window would fail no runs, and the runs would later start under 
a completed backfill.
+    if not session.scalar(select(exists().where(BackfillDagRun.backfill_id == 
b.id))):

Review Comment:
   cc @dstandish 



-- 
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]

Reply via email to