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

Remove the default config from the Configuration View, show only running configuration #14641

Closed
wants to merge 7 commits into from
Closed

Remove the default config from the Configuration View, show only running configuration #14641

wants to merge 7 commits into from

Conversation

BasPH
Copy link
Contributor

@BasPH BasPH commented Mar 6, 2021

This PR removes airflow.cfg from the Airflow Configuration view, and shows only the rendered view, with the goal to remove confusion about which configuration is currently active.

My motivation is that I often encounter people not knowing that you can scroll down to see the active configuration, thinking the airflow.cfg (which is displayed first) is the configuration currently active (which are defaults that might be overridden by env vars).

Summary of changes:

  • UI shows only rendered config
  • UI shows an info message in case AIRFLOW__WEBSERVER__EXPOSE_CONFIG=False
  • Removed argument raw=true, this can be substituted by the Config endpoint of the REST API
  • Removed pre_subtitle (the ascii art thing + version)

Screenshots of old & new behaviours:

AIRFLOW__WEBSERVER__EXPOSE_CONFIG=False

  • Previously:

image

  • New:

image

AIRFLOW__WEBSERVER__EXPOSE_CONFIG=True

  • Previously:

image

  • New: Displays only running configuration, no more (non active) defaults in airflow.cfg

image


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
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.

@BasPH BasPH added the area:UI Related to UI/UX. For Frontend Developers. label Mar 6, 2021
@BasPH BasPH requested review from ashb and ryanahamilton as code owners March 6, 2021 11:06
@boring-cyborg boring-cyborg bot added the area:webserver Webserver related Issues label Mar 6, 2021
return self.render_template(
'airflow/config.html',
title=title,
pre_subtitle=settings.HEADER + " v" + airflow.__version__,
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we need to render the header? It look good in cli but showing it in web UI does not seem a good experience. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO it doesn't add anything relevant, so I'd remove it. Shall I add that to this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed pre_subtitle altogether, the version is also displayed in the footer.

"configuration, most likely for security reasons."

if request.args.get('raw') == "true":
return Response(response=json.dumps(table), status=200, mimetype="application/json")
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why to use json? Returning plain text allowed users do the copy past of configuration. I see not use case for json.

Copy link
Member

Choose a reason for hiding this comment

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

If we're going to return json we should just content negotiation (i.e. Accept headers)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be consistent, I figured the raw=true argument should also return the rendered configuration. The airflow.cfg content was loaded as lines of text, but the rendered configuration is loaded as a list of tuples. So, I had to decide on an output format and figured JSON would make sense.

Thinking about it, the new REST API does exactly what we want (content negotiation, (https://github.com/apache/airflow/blob/master/airflow/api_connexion/endpoints/config_endpoint.py#L66-L87). We could also simply remove the raw=true argument and tell people to use the REST API, instead of maintaining this? I've never seen anybody using it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went digging for possible usage, the raw=true code was first added 5 years ago: d12dc18. Seems like "first iteration" was permanent after all😄

Shall I remove the raw=true argument and direct people to the REST API in UPDATING.md?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went ahead and removed raw=true

Copy link
Member

Choose a reason for hiding this comment

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

If I correctly understand removing the raw option marks this PR automatically as Airflow 3.0, right? Should we do some type of depreciation warning first and remove it with 3.0?

I know this is probably rarely used feature but we decided to use semver.

@BasPH
Copy link
Contributor Author

BasPH commented Mar 9, 2021

@ashb @turbaszek I went ahead and removed the raw=true argument. Changed UPDATING.md to say it has been substituted by the REST API.

Also, I removed the subtitle in the Configuration view:

image

WDYT?

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Apr 24, 2021
@turbaszek
Copy link
Member

@BasPH any plans to bring this in?

@github-actions github-actions bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Apr 25, 2021
@ryanahamilton
Copy link
Contributor

I had also been bothered by having to scroll down the page and had created an alternative solution to this (that I have yet to PR). This would essentially keep the same content and present it in a tabbed interface:

Screen Recording 2021-04-26 at 09 41 12 AM

Is there value in retaining access to the defaults as well?

@ashb
Copy link
Member

ashb commented Apr 26, 2021

@ryanahamilton Sometimes, yes. Perhaps a check box for "include default config", (Or similar) so by default it only shows the changed settings, but that it is possible to show all running config.

@github-actions
Copy link

github-actions bot commented Aug 9, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 9, 2021
@github-actions github-actions bot closed this Aug 15, 2021
@BasPH
Copy link
Contributor Author

BasPH commented Dec 7, 2021

@ryanahamilton I would like to revive this PR since it continues to lead to confusion. I quite like your solution, any plans to make a PR for it?

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 stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants