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

feat: add timezones to report cron #15849

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented Jul 22, 2021

SUMMARY

We have a new column on the report_schedule table that defaults timezone to "UTC". This pr reads that timezone from the report and then runs the cron schedule according to that schedule. In a future PR I will add in a UI that allows users to change that timezone and save different values to the report_schedule table, such as "America/New_York" or "America/Los_Angeles"

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

We want to make sure that all existing reports continue to run on UTC. To test, create a report and make sure that it runs at the appropriate time.

_DEV__Superset
_DEV__Superset
This ran at 4:44pm PDT

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@eschutho eschutho force-pushed the elizabeth/add_timezone_to_cron branch 2 times, most recently from d74a7fd to bd17a85 Compare July 22, 2021 23:48
@eschutho eschutho marked this pull request as draft July 23, 2021 00:14
@eschutho eschutho force-pushed the elizabeth/add_timezone_to_cron branch from bd17a85 to 60662ec Compare July 23, 2021 23:46
@eschutho eschutho marked this pull request as ready for review July 24, 2021 00:09
@eschutho eschutho force-pushed the elizabeth/add_timezone_to_cron branch from 60662ec to e8deda7 Compare July 26, 2021 23:02
@eschutho eschutho force-pushed the elizabeth/add_timezone_to_cron branch from e8deda7 to b086d52 Compare July 27, 2021 00:12
rv = self.client.post(uri, json=report_schedule_data)
assert rv.status_code == 400
data = json.loads(rv.data.decode("utf-8"))
assert data == {"message": {"timezone": ["Field may not be null."]}}
Copy link
Member

@hughhhh hughhhh Jul 27, 2021

Choose a reason for hiding this comment

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

nit: write this as a separate test

Copy link
Member Author

Choose a reason for hiding this comment

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

do you think because it's a negative assertion instead of the positive ones?

@hughhhh hughhhh self-requested a review July 27, 2021 16:14
@codecov
Copy link

codecov bot commented Jul 28, 2021

Codecov Report

Merging #15849 (d6ba5e5) into master (9c854ff) will decrease coverage by 0.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15849      +/-   ##
==========================================
- Coverage   77.09%   76.81%   -0.29%     
==========================================
  Files         984      986       +2     
  Lines       51782    51872      +90     
  Branches     7028     7028              
==========================================
- Hits        39920    39843      -77     
- Misses      11637    11804     +167     
  Partials      225      225              
Flag Coverage Δ
hive ?
mysql 81.40% <100.00%> (-0.13%) ⬇️
postgres 81.43% <100.00%> (-0.13%) ⬇️
presto ?
python 81.51% <100.00%> (-0.57%) ⬇️
sqlite 81.06% <100.00%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/reports/api.py 87.78% <ø> (ø)
superset/models/reports.py 100.00% <100.00%> (ø)
superset/reports/schemas.py 98.76% <100.00%> (+0.04%) ⬆️
superset/tasks/cron_util.py 100.00% <100.00%> (ø)
superset/tasks/scheduler.py 67.44% <100.00%> (-7.11%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 69.80% <0.00%> (-16.71%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-6.43%) ⬇️
superset/commands/importers/v1/examples.py 38.02% <0.00%> (-2.28%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
... and 25 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 9c854ff...d6ba5e5. Read the comment docs.

@eschutho eschutho merged commit ea49aa3 into apache:master Jul 28, 2021
@eschutho eschutho deleted the elizabeth/add_timezone_to_cron branch July 28, 2021 01:28
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* add timezones to report cron

* fix test
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
* add timezones to report cron

* fix test
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* add timezones to report cron

* fix test
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* add timezones to report cron

* fix test
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/L 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants