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

Fix clock-trigger offset computation. #4511

Merged
merged 6 commits into from Jan 10, 2022
Merged

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Nov 15, 2021

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

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.py and conda-environment.yml.
  • Appropriate tests are included (unit and/or functional).
  • Appropriate change log entry included.
  • No documentation update required.

@hjoliver hjoliver added the bug label Nov 15, 2021
@hjoliver hjoliver added this to the cylc-8.0rc1 milestone Nov 15, 2021
@hjoliver hjoliver self-assigned this Nov 15, 2021
@wxtim wxtim self-requested a review December 16, 2021 21:17
@hjoliver hjoliver force-pushed the clock-trigger-fix branch 5 times, most recently from 28b1cdb to d05238c Compare December 21, 2021 01:00
@hjoliver hjoliver marked this pull request as ready for review December 21, 2021 02:27
@hjoliver
Copy link
Member Author

Ready for review @wxtim. See updated description above.


[scheduler]
cycle point time zone = '+0530'
# Default to time zone Z
Copy link
Member Author

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).

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 working my a home pc, so I can jimmy the system clock to test this.

Copy link
Member

@wxtim wxtim left a 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):
Copy link
Member

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.

Copy link
Member

@MetRonnie MetRonnie left a 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

tests/functional/clock-trigger-inexact/00-big-offset.t Outdated Show resolved Hide resolved
hjoliver and others added 2 commits January 5, 2022 09:53
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
@hjoliver
Copy link
Member Author

hjoliver commented Jan 6, 2022

Unit test added.

Copy link
Member

@MetRonnie MetRonnie left a 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 <61982285+MetRonnie@users.noreply.github.com>
@hjoliver hjoliver merged commit 818c92d into cylc:master Jan 10, 2022
@hjoliver hjoliver deleted the clock-trigger-fix branch January 10, 2022 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wall_clock xtrigger offset bug
3 participants