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

ENH: Add cron scheduler #73

Merged
merged 42 commits into from
Aug 12, 2022
Merged

ENH: Add cron scheduler #73

merged 42 commits into from
Aug 12, 2022

Conversation

Miksus
Copy link
Owner

@Miksus Miksus commented Aug 11, 2022

Add Cron style conditions.

This PR also has improvements on underlying time period mechanics most notably:

  • new condition TaskRunnable, similar to TaskExecutable
  • time periods are immutable dataclasses
  • fixed various bugs in time period All and Any (previously was not used)
  • fixed bug in StaticInterval if start/end was specified (previously was not used)
  • time periods are always left closed and right opened
  • always is now "singleton"
  • new method in time periods (create_range)
  • fixed if ints passed to time periods

Also now they are case insensitive.
Also took off some incorrect closed.
This is if no start or end is given.
Now int goes by natural language
Python's datetime has resolution of one microsecond so microseconds
makes more sense. Also makes it possible to increment the datetimes
with minimum resolution (adding one nanosecond adds nothing).
Now also works with non permanent (start and end as None)
Now the intervals are always right opened and left closed.
Note: this is not needed for rollback as left point is always included.
This is useful for Cron skip.
This condition is used similarly as TaskExecutable but instead of
relying on when the task finished, this relies on when the task started.
@Miksus Miksus added enhancement New feature or request core Relates to the core functionalities (ie. base classes) built-in Relates to the built-in tasks, conditions etc. labels Aug 11, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #73 (c8a7028) into master (b837b8b) will increase coverage by 0.28%.
The diff coverage is 94.00%.

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   90.81%   91.10%   +0.28%     
==========================================
  Files          87       88       +1     
  Lines        4050     4339     +289     
==========================================
+ Hits         3678     3953     +275     
- Misses        372      386      +14     
Impacted Files Coverage Δ
rocketry/conds/__init__.py 100.00% <ø> (ø)
rocketry/core/time/__init__.py 100.00% <ø> (ø)
rocketry/parse/time.py 100.00% <ø> (ø)
rocketry/core/time/base.py 84.14% <88.88%> (+3.22%) ⬆️
rocketry/core/time/anchor.py 87.71% <90.38%> (-1.26%) ⬇️
rocketry/pybox/time/interval.py 93.65% <92.00%> (-0.80%) ⬇️
rocketry/time/interval.py 96.29% <99.00%> (+5.82%) ⬆️
rocketry/conditions/api.py 96.87% <100.00%> (+0.18%) ⬆️
rocketry/conditions/task/task.py 91.97% <100.00%> (+0.58%) ⬆️
rocketry/core/time/utils.py 83.14% <100.00%> (ø)
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Miksus Miksus merged commit 05861b7 into master Aug 12, 2022
@Miksus Miksus deleted the dev/cron-style branch August 12, 2022 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
built-in Relates to the built-in tasks, conditions etc. core Relates to the core functionalities (ie. base classes) enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants