This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 66ea88f0bea Fix DAG details active runs count to exclude queued runs 
(#69769)
66ea88f0bea is described below

commit 66ea88f0bea478aaa10a405603d7f8f52275210d
Author: VishwasPatel <[email protected]>
AuthorDate: Mon Jul 27 02:45:10 2026 -0700

    Fix DAG details active runs count to exclude queued runs (#69769)
    
    * Fix DAG details active runs count to exclude queued runs
    
    * Remove newsfragment
    
    ---------
    
    Co-authored-by: pierrejeambrun <[email protected]>
---
 airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py     | 2 +-
 airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py 
b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py
index 355ce4ca7a5..69b6b2932f0 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py
@@ -250,7 +250,7 @@ def get_dag_details(
         session.scalar(
             select(func.count())
             .select_from(DagRun)
-            .where(DagRun.dag_id == dag_id, 
DagRun.state.in_([DagRunState.RUNNING, DagRunState.QUEUED]))
+            .where(DagRun.dag_id == dag_id, DagRun.state == 
DagRunState.RUNNING)
         )
         or 0
     )
diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
index 4831394c45b..f47d6f54c2a 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
@@ -1278,7 +1278,7 @@ class TestDagDetails(TestDagEndpoint):
         # Verify active_runs_count field is present and correct
         assert "active_runs_count" in body
         assert isinstance(body["active_runs_count"], int)
-        assert body["active_runs_count"] == 2  # 1 running + 1 queued
+        assert body["active_runs_count"] == 1  # only running counts, queued 
does not
 
         # Test with DAG that has no active runs
         response = test_client.get(f"/dags/{DAG1_ID}/details")

Reply via email to