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

new utc baseline for (old) schedule PR, make some datetime objs tzaware #489

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sarnold
Copy link

@sarnold sarnold commented Oct 20, 2021

Minimal rework of #256 <= that needs use-case testing by interested parties. When I used the old version of ^^ that PR I had to setup the logging to use time.gmtime to get the right (UTC) log times, however, in newer py3 versions you can use https://docs.python.org/3/library/logging.html?highlight=logging%20time#logging.Formatter.formatTime (note the note about py3.9)

Hopefully someone finds this useful; I just don't have time right now to go back to my old project and try upgrading, etc. Enjoy!

Setting TZ environment var in runtime may be required (also a good idea)

schedule/test changes:

  • import timezone and set UTC default
  • adjust last_run and idle_seconds to be utc times
  • make until/cancel_after tzaware, update datetime strings
  • make should_run/run/_is_overdue use UTC times
  • make test_until_time use tzaware datetime for asserts
  • remove runtime assert, raise ScheduleError instead

setting TZ environment var in runtime may be required (also a good idea)

schedule/test changes:

* import timezone and set UTC default
* adjust last_run and idle_seconds to be utc times
* make until/cancel_after tzaware, update datetime strings
* make should_run/run/_is_overdue use UTC times
* make test_until_time use tzaware datetime for asserts
* remove runtime assert, raise ScheduleError instead

Signed-off-by: Stephen L Arnold <nerdboy@gentoo.org>
@samgermain
Copy link

@dbader Please review this

Signed-off-by: Stephen L Arnold <nerdboy@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants