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


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -946,8 +946,14 @@ def get_queued_dag_runs_to_set_running(cls, session: 
Session) -> ScalarResult[Da
                 # capacity for 1.  this could be improved.
                 coalesce(running_drs.c.num_running, text("0"))
                 < coalesce(Backfill.max_active_runs, DagModel.max_active_runs),
-                # don't set paused dag runs as running
-                not_(coalesce(cast("ColumnElement[bool]", Backfill.is_paused), 
False)),
+                # don't set paused dag runs as running, but a completed 
backfill's
+                # is_paused flag is stale: a run cleared after the backfill was
+                # cancelled (cancel sets is_paused=True and completed_at) must 
still
+                # be schedulable, otherwise it is stuck in queued forever.
+                or_(
+                    Backfill.completed_at.isnot(None),

Review Comment:
   Updated the description: it now covers the 409 on cancel, the renamed test 
and the new route test, the pre-upgrade orphans (including the rolling-upgrade 
case), and the over-2-minute creation case.



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