Skip to content

Show task state counts for the latest Dag run on the Dags list page - #69619

Open
yuseok89 wants to merge 2 commits into
apache:mainfrom
yuseok89:feature/66947-dag-list-latest-run-ti-state-counts
Open

Show task state counts for the latest Dag run on the Dags list page#69619
yuseok89 wants to merge 2 commits into
apache:mainfrom
yuseok89:feature/66947-dag-list-latest-run-ti-state-counts

Conversation

@yuseok89

@yuseok89 yuseok89 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

closes: #66947

Each Dag card and table row on the Dag list page now shows the task-instance state breakdown of that Dag's most recent run, as clickable badges. Clicking a badge opens that run's task list filtered by the state, restoring the scan-then-click "Recent Tasks" workflow from Airflow 2.

What changed

  • New endpoint GET /api/v2/ui/dags/latest_run_task_instance_state_counts. For the requested Dag IDs it resolves each Dag's latest run and counts its task instances grouped by state. dag_ids is bounded to the API max page limit. A run's task instances are bounded by the Dag's task structure, so the per-state counts are exact.
  • Card view shows the state badges below the recent-runs bar chart.
  • Table view adds compact badges in a new "Latest run tasks" column.
  • Dynamic badges show only the states present in the run, ordered by priority (most urgent first). Task instances with no state yet appear as no_status.

Unlike the run-state badges from #67242 (which count a Dag's runs by state), these count the task instances of its single latest run.

Demo

Screen.Recording.2026-07-08.at.11.08.18.PM.mov

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    • Opus 4.8

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default labels Jul 8, 2026
@yuseok89
yuseok89 force-pushed the feature/66947-dag-list-latest-run-ti-state-counts branch 6 times, most recently from cb0a135 to 48872f8 Compare July 9, 2026 15:55
@yuseok89
yuseok89 marked this pull request as ready for review July 9, 2026 23:47
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 11, 2026
@bbovenzi

Copy link
Copy Markdown
Contributor

Thanks for opening this.

Let's make sure dags list performance issues are resolved first. Like in this PR: #69806. Only after that should we add any more complexity to the dags list

@yuseok89

yuseok89 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for opening this.

Let's make sure dags list performance issues are resolved first. Like in this PR: #69806. Only after that should we add any more complexity to the dags list

Makes sense, thanks. I'll take a look at the dags list performance work too and see if there's anything I can help with there.

@yuseok89
yuseok89 force-pushed the feature/66947-dag-list-latest-run-ti-state-counts branch from 48872f8 to 2972d54 Compare August 4, 2026 15:26
@yuseok89
yuseok89 force-pushed the feature/66947-dag-list-latest-run-ti-state-counts branch from 2972d54 to fc551db Compare August 5, 2026 14:22
@yuseok89

yuseok89 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi @bbovenzi.
The dags list performance work is now resolved (#69806 merged, #69609 closed).
So would this be a good time to pick it back up?

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you benchmark this when there are millions of TI and hundred of thousand of runs in the DB?

I would like to double check performance, my feeling is that it will not scale way because of the subqueries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:translations area:UI Related to UI/UX. For Frontend Developers. ready for maintainer review Set after triaging when all criteria pass. translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAG list page: show task state counts for the most recent DAG run per DAG

4 participants