Skip to content

[AIRFLOW-7049] Persistent display/filtering of DAG status - #8106

Merged
ashb merged 10 commits into
apache:masterfrom
ryanahamilton:persistent_dag_status_filter
Apr 9, 2020
Merged

ashb merged 10 commits into
apache:masterfrom
ryanahamilton:persistent_dag_status_filter

Conversation

@ryanahamilton

@ryanahamilton ryanahamilton commented Apr 3, 2020 •

Copy link
Copy Markdown
Contributor

Seeks to resolve [AIRFLOW-7049] by replacing the problematic "show/hide paused DAGs" toggle with a more robust status filter that saves and persists the user's selection.

Status Filter:

image

In context of the DAGs (home) view:

image

Status logic:

  • The status filter is set to "all" by default. If the preexisting webserver variable hide_paused_dags_by_default is set to True, the default is "active".
  • The currently selected status will always be saved in flask_session[FILTER_STATUS_COOKIE]. Value of all, active, or paused.
  • A status param in the URL will always override and resave the cookie value. e.g. /home?status=active
  • If a user leaves the page and returns to /home, the last saved cookie value will be selected.

Of note:

  • The status filter buttons include a number count correlating to the number of DAGs for each.
  • Status params are passed along within the pagination links
  • The dags.html diff is so large because I fixed a bunch of indentation while I was in there.

Tests:

  • Added a view test to confirm URL parameter values are saving to cookie value.

Make sure to mark the boxes below before creating PR: [x]


In case of fundamental code change, 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 UPDATING.md.
Read the Pull Request Guidelines for more information.

@boring-cyborg boring-cyborg Bot added the area:webserver Webserver related Issues label Apr 3, 2020
@ryanahamilton
ryanahamilton marked this pull request as ready for review April 3, 2020 20:41
@btallman

btallman commented Apr 3, 2020

Copy link
Copy Markdown
Contributor

Very nice improvement to my original hack!

@kaxil
kaxil requested review from ashb and kaxil April 4, 2020 17:42
@codecov-io

codecov-io commented Apr 4, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #8106 into master will decrease coverage by 27.74%.
The diff coverage is 93.54%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #8106       +/-   ##
===========================================
- Coverage   88.30%   60.55%   -27.75%     
===========================================
  Files         936      936               
  Lines       45272    45283       +11     
===========================================
- Hits        39979    27423    -12556     
- Misses       5293    17860    +12567     
Impacted Files Coverage Δ
airflow/www/views.py 77.01% <93.10%> (+0.33%) ⬆️
airflow/www/utils.py 80.11% <100.00%> (-0.75%) ⬇️
airflow/providers/exasol/operators/exasol.py 0.00% <0.00%> (-100.00%) ⬇️
airflow/providers/amazon/aws/hooks/kinesis.py 0.00% <0.00%> (-100.00%) ⬇️
airflow/providers/apache/livy/sensors/livy.py 0.00% <0.00%> (-100.00%) ⬇️
airflow/providers/amazon/aws/sensors/redshift.py 0.00% <0.00%> (-100.00%) ⬇️
airflow/providers/mysql/operators/s3_to_mysql.py 0.00% <0.00%> (-100.00%) ⬇️
airflow/providers/postgres/operators/postgres.py 0.00% <0.00%> (-100.00%) ⬇️
airflow/providers/microsoft/azure/operators/adx.py 0.00% <0.00%> (-100.00%) ⬇️
...irflow/providers/amazon/aws/hooks/batch_waiters.py 0.00% <0.00%> (-100.00%) ⬇️
... and 322 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b46d6c0...2a1834f. Read the comment docs.

@kaxil kaxil 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.

LGTM. We internally have a different meaning for "active" DAG but I think it is not really user-facing so it should be good. WDYT @ashb ?

@ashb

ashb commented Apr 7, 2020

Copy link
Copy Markdown
Member

What do you think about "Enabled" instead of "Active" -- cos even ignoring the is_active concept inside Airflow, Active could be taken to mean "is actively running/executing"

Comment thread airflow/www/templates/airflow/dags.html Resolved
Comment thread airflow/www/templates/airflow/dags.html Resolved
@kaxil kaxil added this to the Airflow 1.10.11 milestone Apr 7, 2020
Comment thread airflow/www/views.py Resolved
Comment thread airflow/www/views.py Resolved
Comment thread airflow/www/views.py Resolved
Comment thread airflow/www/views.py Resolved
Comment thread tests/www/test_views.py Resolved

@ashb ashb 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.

A few minor changes to code/tests, and let's change the name from "Active" to "Enabled" (I think.)

@ryanahamilton

Copy link
Copy Markdown
Contributor Author

Thank you @ashb, will get those edits taken care of!

@ashb

ashb commented Apr 7, 2020

Copy link
Copy Markdown
Member

After playing with this and seeing what it looks like we've decided that Active/Paused is the clearest, and the risk of confusion with the is_active column on the Dag table is minimal as that is never exposed to users, and only shows up in about 3 places in the code anyway.

Comment thread airflow/www/templates/airflow/dags.html Resolved
@ashb
ashb merged commit 1317cdc into apache:master Apr 9, 2020
@ryanahamilton
ryanahamilton deleted the persistent_dag_status_filter branch April 9, 2020 17:36
@kaxil kaxil added the type:improvement Changelog: Improvements label Jul 1, 2020
@ryanahamilton ryanahamilton added the area:UI Related to UI/UX. For Frontend Developers. label Nov 18, 2020
cfei18 pushed a commit to cfei18/incubator-airflow that referenced this pull request Mar 5, 2021
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:improvement Changelog: Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants