Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home: filter running/failed and active/paused dags #39701

Merged
merged 4 commits into from
May 30, 2024

Conversation

ecodina
Copy link
Contributor

@ecodina ecodina commented May 18, 2024

Closes: #39675

Now, on the home page, the two sets of buttons (filter DAG states and DAG Run states work together). I have had to add a new button on the home page to view all states:

image

I've had to add a few SQL queries to ensure that the number next to each label is correct. Without them, if a DAG has multiple running DAG Runs, it counts them all. For example: we have 1 DAG with 3 running DAG runs --> without the new queries, a (3) appears, instead of a (1).

Moreover, the numbers next to the label may seem strange at first, since they change continuously according to the applied filters.

I initially thought of making this work as the TAGs filter, but it is nice to see the count next to the label.

@PApostol since you developed this initially: what do you think?


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels May 18, 2024
@PApostol
Copy link
Contributor

Good work, just a couple of questions for my understanding:

  1. What's "All states" required for? Maybe "Running" and "Failed" can just work with the existing "All", "Active", "Paused"?

  2. Regarding the new SQL to count all DAG runs - not sure what the best approach is here. Do we want to see how many unique DAGs are currently running regardless of how many instances of the same DAG are running (current implementation)? Or do we want to see the total number of DAG runs (even if all come from the same DAG, say if you're doing a backloading).

Perhaps some comments from the Airflow maintainers would help here.

P.S. did you mean to link #39675 instead of #30429 by any chance?

@ecodina
Copy link
Contributor Author

ecodina commented May 18, 2024

Good work, just a couple of questions for my understanding:

  1. What's "All states" required for? Maybe "Running" and "Failed" can just work with the existing "All", "Active", "Paused"?

I added this button in order to reset the Running/Failed filter. For example:

  • I select "Active"
  • I select "Failed"

I now want to see "Active" + "Any state". What should I do? By adding this button, you can do it.

Moreover, you clearly show that the properties filtered by each set is different. One filters Dag properties, while the other focuses on DagRun

  1. Regarding the new SQL to count all DAG runs - not sure what the best approach is here. Do we want to see how many unique DAGs are currently running regardless of how many instances of the same DAG are running (current implementation)? Or do we want to see the total number of DAG runs (even if all come from the same DAG, say if you're doing a backloading).

Perhaps some comments from the Airflow maintainers would help here.

While I was developing this I found it very confusing to see a "Running (8)" but only 1 DAG on the list (with 8 running DAG runs). I believe that the # of DAGs running is better displayed on the Cluster Activity page.

P.S. did you mean to link #39675 instead of #30429 by any chance?

You are right! Thanks for seeing this!

@RNHTTR
Copy link
Collaborator

RNHTTR commented May 18, 2024

I added this button in order to reset the Running/Failed filter. For example:

  • I select "Active"
  • I select "Failed"

I now want to see "Active" + "Any state". What should I do? By adding this button, you can do it.

Might it be cleaner to just unselect failed? There are only two buttons, so I don't know that it makes sense to include an "all states" button when there are only two states to choose from.

@ecodina
Copy link
Contributor Author

ecodina commented May 18, 2024

Might it be cleaner to just unselect failed? There are only two buttons, so I don't know that it makes sense to include an "all states" button when there are only two states to choose from.

I liked the idea, so I implemented it. Now it looks like the current version:

image

@bbovenzi
Copy link
Contributor

Might it be cleaner to just unselect failed? There are only two buttons, so I don't know that it makes sense to include an "all states" button when there are only two states to choose from.

I liked the idea, so I implemented it. Now it looks like the current version:

image

Might it be cleaner to just unselect failed? There are only two buttons, so I don't know that it makes sense to include an "all states" button when there are only two states to choose from.

I liked the idea, so I implemented it. Now it looks like the current version:

image

I like this. Let's get rid of the ?lastrun=all_states param, that should be the default when nothing is specified.

@bbovenzi bbovenzi modified the milestone: Airflow 2.9.2 May 20, 2024
@ecodina
Copy link
Contributor Author

ecodina commented May 20, 2024

@bbovenzi done! Similarly to the tags I added the "reset_filter" param to reset the cookie when we deselect the filter. However, the user does not see it, since it immediately redirects.

airflow/www/views.py Outdated Show resolved Hide resolved
@ecodina ecodina force-pushed the filter-failed-running branch 2 times, most recently from 5fcd624 to ae78ffc Compare May 22, 2024 16:37
@bbovenzi
Copy link
Contributor

I agree that the count for Running and Failed should just be the count of dags and not runs.

I am less sure if we only want to filter by lastrun. I would want to know if a dag is running, if it thats not the most recent run (backfill or manually clearing).

@ecodina
Copy link
Contributor Author

ecodina commented May 23, 2024

I agree that the count for Running and Failed should just be the count of dags and not runs.

I am less sure if we only want to filter by lastrun. I would want to know if a dag is running, if it thats not the most recent run (backfill or manually clearing).

@bbovenzi Even though the param is called lastrun, the query looks if there is any running instance of the DAG. So backfills should also be incldued. If you feel that another name for the param would be better, let me know and I'll change it!

Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

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

Cool. Lgtm then!

@bbovenzi bbovenzi merged commit eb7826f into apache:main May 30, 2024
39 checks passed
@ecodina ecodina deleted the filter-failed-running branch May 30, 2024 16:32
@utkarsharma2 utkarsharma2 added the type:new-feature Changelog: New Features label Jun 3, 2024
fdemiane pushed a commit to fdemiane/airflow that referenced this pull request Jun 6, 2024
* Home: filter running,failed and active/paused dags

* deselect filter on click

* remove "all_states" param

* explicit cookie val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DAG list: filter FAILED/RUNNING
5 participants