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

[AIRFLOW-8875] fix Dag Run UI execution date with timezone cannot be saved issue #8875

Closed

Conversation

realradical
Copy link
Contributor

@realradical realradical commented May 15, 2020

This PR is to address the following bug: #8842
Airflow 1.10.10 displays datetime with timezone on the web UI. Currently, when user tries to create a dag run on the UI, it gives invalid DateTime error which prevents the dag run being created.
image


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

  • Description above provides context of the change
  • Unit tests coverage for changes (not needed for documentation changes)
  • Target Github ISSUE in description if exists
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

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 May 15, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented May 15, 2020

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://apache-airflow-slack.herokuapp.com/

@realradical realradical changed the title [AIRFLOW-8842] fix Dag Run UI execution date with timezone cannot be saved issue [AIRFLOW-8875] fix Dag Run UI execution date with timezone cannot be saved issue May 15, 2020
airflow/www/forms.py Outdated Show resolved Hide resolved
@realradical
Copy link
Contributor Author

@ashb the quarantined CI build job fails.. any idea?

@realradical realradical requested a review from ashb May 18, 2020 09:02
@ashb
Copy link
Member

ashb commented May 18, 2020

Looking better @realradical!

Can you test that changing the timezone in the UI updates this field while the page is open? (If it doesn't it means it's missing an html class)

I also think that we should test more than one timezone, and for completeness, test what happens when the form is submitted without a TZ (it should use the "default" configured TZ. So we should also use @conf_vars for that test to change the default for that one test to not be UTC.)

@realradical
Copy link
Contributor Author

realradical commented May 18, 2020

@conf_vars

@ashb I tried changing the timezone in the UI and it works!

I used @conf_vars({("core", "default_timezone"): "America/Toronto"}) in the test without timezone. However, the timezone setting used in timezone.make_aware utility function is initialized before the config overriding in my test. https://github.com/apache/airflow/blob/master/airflow/settings.py

Personally I don't think we need to cover this case, the frontend should make sure that the datetime submitted always with a timezone.

@ashb
Copy link
Member

ashb commented May 18, 2020

@realradical I think the backend change you have here is good! With it it should accept any datetime that the UI displays, but without it it would only accept TZ in the current TZ.

i.e. the change as you had it meant you could copy-and-paste a date-time with TZ and have it work, so I'd still think this is a good change to have.

@realradical
Copy link
Contributor Author

@ashb i accidentally closed the pr. will create another one now. sorry about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants