Allow filtering the Dags list by failed and success runs in any run state filter - #69875
Conversation
|
I think this UX needs to be refined. I don't think any user would realistically search "any dag that has ever had a success", even "any dag that has ever had a failure" could quickly be useless for very old failures. I think we first need a time range filter for use cases like "dags with a failure in the last week", or "dags with any runs in the last 24 hours" |
|
Thanks for the review. Agreed that searching for "ever had a success" is unrealistic. I had added Before the backend details, I'd like to settle the UI direction first. Two options: Option A — attach a time window to the existing "Any run" filter Screen.Recording.2026-07-19.at.2.27.01.PM.movWhen a state is selected, a Option B — merge the two run-state filters into one Screen.Recording.2026-07-19.at.2.40.08.PM.movGoing a step further. Having "Last run state" and "Any run state" side by side is itself a bit confusing, so this merges them into a single My preference is B . |
|
Yes, I prefer B too. Good idea |
pierrejeambrun
left a comment
There was a problem hiding this comment.
In the current implementation, this is a net gain. (additional options to filter, while still leveraging indexes and keeping performance good)
I would merge this in the current form and follow up with a UX refactoring for those two filters in a second PR.
|
Discussed with Brent, let's merge this iteration which brings value. @yuseok89 please feel free to follow up with a new PR on the UX improvement suggested by Brent. |
|
@pierrejeambrun |
…tate filter (apache#69875) (cherry picked from commit a990ce9)
Closes #67094
The Dags list has two run-state filters. "Last run state" matches on a Dag's latest run, and "Any run state" matches a Dag that has any run in the chosen state. The "Any run state" filter only offered
queuedandrunning, so a Dag with failed runs but a green latest run could not be found from the Dags list at all.This adds
failedandsuccessto it, so both filters now cover all four states.What changed
_AnyDagRunStateFilter). The filter now supports all four run states. Its query moved fromdag_id IN (SELECT DISTINCT dag_id FROM dag_run WHERE state = X)to a correlatedEXISTS, which the existing(dag_id, state)index resolves per Dag instead of scanning every run in the state. No new index is needed.Performance
Measured on a large
dag_runtable (a few million rows) across a few thousand Dags(Postgres), filtering bydag_run_state=success(the heaviest state):DISTINCTscan of all matching runs: around a second or moreEXISTS: tens of millisecondsThe
EXISTScost grows only with Dag count (one index seek per Dag, stopping at the first match), not with run volume, so it stays fast well beyond typical Dag counts, and the gap widens further as run history grows.Demo
Screen.Recording.2026-07-14.at.11.09.50.PM.mov
Was generative AI tooling used to co-author this PR?
{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.