-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Miksus/dev/cron-style
ENH: Add cron scheduler
- Loading branch information
Showing
43 changed files
with
2,092 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from rocketry.conds import cron | ||
|
||
@app.task(cron('* * * * *')) | ||
def do_minutely(): | ||
... | ||
|
||
@app.task(cron('*/2 12-18 * Oct Fri')) | ||
def do_complex(): | ||
"Run at every 2nd minute past every hour from 12 through 18 on Friday in October." | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from rocketry.conds import cron | ||
|
||
@app.task(cron(minute="*/5")) | ||
def do_simple(): | ||
"Run at every 5th minute" | ||
... | ||
|
||
@app.task(cron(minute="*/2", hour="7-18", day_of_month="1,2,3", month="Feb-Aug/2")) | ||
def do_complex(): | ||
"""Run at: | ||
- Every second minute | ||
- Between 07:00 (7 a.m.) - 18:00 (6 p.m.) | ||
- On 1st, 2nd and 3rd day of month | ||
- From February to August every second month | ||
""" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
.. _cron: | ||
|
||
Cron Scheduling | ||
=============== | ||
|
||
Rocketry also natively supports `cron-like scheduling <https://en.wikipedia.org/wiki/Cron>`_. | ||
|
||
You can input a cron statement as a string: | ||
|
||
Examples | ||
-------- | ||
|
||
.. literalinclude:: /code/conds/api/cron.py | ||
:language: py | ||
|
||
Or you can use named arguments: | ||
|
||
.. literalinclude:: /code/conds/api/cron_kwargs.py | ||
:language: py | ||
|
||
See more from the official definition of cron. | ||
|
||
.. note:: | ||
|
||
Unlike most of the condition, the cron condition checks whether the task | ||
has run on the period (as standard with cron schedulers) and not whether | ||
the task has finished on the given period. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ Here are some examples: | |
|
||
logical | ||
periodical | ||
cron | ||
pipeline | ||
task_status | ||
scheduler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ | |
started, succeeded, failed, finished, | ||
|
||
scheduler_running, | ||
running | ||
running, | ||
cron | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,10 @@ | |
StaticInterval, | ||
All, Any, | ||
|
||
PARSERS | ||
PARSERS, | ||
|
||
# Constants | ||
always, | ||
) | ||
|
||
|
||
|
Oops, something went wrong.