guan404ming commented on code in PR #68657:
URL: https://github.com/apache/airflow/pull/68657#discussion_r3432562579
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dashboard.py:
##########
@@ -147,26 +137,30 @@ def dag_stats(
.correlate(DagModel)
.scalar_subquery()
)
- latest_runs_subq = (
- select(latest_state.label("state"))
+ dag_counts_query = (
+ select(
+ func.coalesce(func.sum(case((DagModel.is_paused == false(), 1))),
0).label("active"),
+ func.coalesce(func.sum(case((latest_state == DagRunState.FAILED,
1))), 0).label("failed"),
Review Comment:
Good catch on the asymmetry, but it's intentional in my opinion.
running/queued are "active" states, and a Dag can have several active runs at
once (backfill/catchup), so we count any run. failed/success is a "terminal"
state answering "how did the latest run go", so I think if it stay latest-only
would be better. The overlap (a Dag re-running after a past failure) reflects
real state, and these are independent dimensions rather than mutually exclusive
buckets.
--
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]