-
Notifications
You must be signed in to change notification settings - Fork 94
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 clock-trigger offset computation. #4511
Conversation
28b1cdb
to
d05238c
Compare
d05238c
to
383ee52
Compare
Ready for review @wxtim. See updated description above. |
|
||
[scheduler] | ||
cycle point time zone = '+0530' | ||
# Default to time zone Z |
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.
(This test also fails on master, if system time is local in my timezone).
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.
I'm working my a home pc, so I can jimmy the system clock to test this.
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.
- Read
- Had a good play with the branch checked out.
- Tests passing
I did make a suggestion about adding a unit test, but I don't think it should block merging it if you want to do so.
@@ -297,6 +301,26 @@ def get_point_as_seconds(self): | |||
self.point_as_seconds += utc_offset_in_seconds | |||
return self.point_as_seconds | |||
|
|||
def get_clock_trigger_time(self, offset_str): |
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.
This feels like it might be nice to unit test it: It would make fixing any future issues with this easier.
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.
I agree with Tim about the unit test, I think it should be included before merging
Co-authored-by: Ronnie Dutta <[email protected]>
Unit test added. |
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.
Consider this approved once my suggestion for the test has been resolved
Co-authored-by: Ronnie Dutta <[email protected]>
These changes close #4510
Fixes clock-trigger time computation for clock xtriggers and old-style (task property) clock triggers. Also restore main-loop call to check old-style clock-triggers (must have lost that somewhere during Cylc 8 development).
The new way is very efficient, even for inexact offsets (months, years): the computation is done once at first call (add offset to cycle point, then convert to absolute trigger time in seconds since unix epoch which is used for all subsequent checks.
TODO:is there a less convoluted way to do the offset computation?this is probably quite inefficient compared to the old broken way? (complex ISO datetime computation in every clock check, instead of a simple float subtraction). Can this be mitigated?Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.setup.py
andconda-environment.yml
.