-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
fix: set default timezone to UTC for cron timezone conversions #29798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #29798 +/- ##
===========================================
+ Coverage 60.48% 83.72% +23.23%
===========================================
Files 1931 527 -1404
Lines 76236 38006 -38230
Branches 8568 0 -8568
===========================================
- Hits 46114 31819 -14295
+ Misses 28017 6187 -21830
+ Partials 2105 0 -2105
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I haven't dug in the code, but will this cause a change in behavior (meaning the actual time at which certain alerts will trigger) in some environments for some alerts? If that's the case we should either prevent that with some flag and/or adding a comment in |
Thanks @danielli-ziprecruiter for the PR! In addition to @mistercrunch's comments, can you add some tests to this PR? |
Yes, this would cause a change in behavior, but the previous behavior didn't make sense since the alert / reporting run would not occur at the configured time and timezone and instead occur at time offset by the configured timezone's relation to UTC. I can still add a comment in |
Makes sense, though wondering its possible that people might have set their alerts/reports while relying on this quirky behavior. Can we clarify the scope of alerts that would be affected (say "only the ones that set a TZ")? Is this an edge case or does it affect most alerts out there? We have to think of the thousands of organizations running hundreds of thousands or alerts/reports every day... If it's a small portion of alerts/reports, maybe a note in UPDATING.md is sufficiant. If it's a a large portion of alerts/reports, we have different options
|
ef51adf
to
0b9a4f5
Compare
I think I've found where this issue was actually introduced. This commit changes |
I think a message in https://github.com/apache/superset/blob/master/UPDATING.md seems important to let people know about any "change in behavior" for when they are upgrading. In theory whoever conducts upgrades should read through that file and ack the notices, notify their users, or take action if needed. Ideally the message is clear about the scope of the change of behavior (which types of alerts/reports will be affected, maybe it's only the alerts/reports that specify a TZ, idk) and what's the old/new behavior. |
@michael-s-molina @rusackas did we not think a comment in UPDATING.md was helpful/necessary? |
I'm sorry @mistercrunch, I think I missed your comment. I agree that a comment in |
I just created a new |
SUMMARY
This fix addresses the issue mentioned in #29797. The datetime object passed into the cron scheduling function may not have a timezone associated with it. Therefore, when trying to convert the datetime to the specified timezone, it just adds timezone to the datetime. This is an issue because the function attempts to convert the datetime back into UTC, which causes an incorrect timezone conversion in this case. The fix is to add UTC to the timezone info for the datetime object before converting it to the specified timezone.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Attempt to reproduce the bug as described in #29797. The alert should trigger correctly.
ADDITIONAL INFORMATION