Schedule
Build a schedule object for batch/workflow jobs using friendly fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cron_expression
|
str
|
Raw cron expression to use (string). |
''
|
at_minutes
|
list[int] | None
|
Specific minutes within the hour, e.g. [0, 30]. |
None
|
every_minute
|
int | None
|
Run every N minutes. |
None
|
at_hours
|
list[int] | None
|
Specific hours within the day, e.g. [0, 12]. |
None
|
every_hour
|
int | None
|
Run every N hours. |
None
|
weekdays
|
list[str] | None
|
Weekdays by name, e.g. ["Mon", "Wed", "Fri"]. |
None
|
day_of_month
|
int | None
|
Day of the month (1-31). |
None
|
in_month
|
list[str] | None
|
Months by name, e.g. ["Jan", "Jul"]. |
None
|
every_month
|
int | None
|
Run every N months. |
None
|
timezone
|
str | None
|
Time zone name, e.g. "UTC". |
None
|
run_after_job_uuid
|
str | None
|
Job UUID to run after. |
None
|
run_after_job_name
|
str | None
|
Job name to run after. |
None
|
run_after_job_condition
|
str | None
|
Condition for dependency, e.g. "on failure". |
None
|
Examples:
schedule = Schedule(at_hours=[0])
schedule = Schedule(at_minutes=[0, 30], weekdays=["Mon", "Wed", "Fri"])
__init__(cron_expression='', at_minutes=None, every_minute=None, at_hours=None, every_hour=None, weekdays=None, day_of_month=None, in_month=None, every_month=None, timezone=None, run_after_job_uuid=None, run_after_job_name=None, run_after_job_condition=None)
Initialize a Schedule.
You can either provide a raw cron_expression or use the human-readable helper parameters (which are compiled into cron syntax automatically).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cron_expression
|
str
|
A raw cron string (e.g. |
''
|
at_minutes
|
list[int] | None
|
Specific minutes past the hour to run
(e.g. |
None
|
every_minute
|
int | None
|
Run every N minutes (e.g. |
None
|
at_hours
|
list[int] | None
|
Specific hours of the day to run (0 -- 23). |
None
|
every_hour
|
int | None
|
Run every N hours. |
None
|
weekdays
|
list[str] | None
|
Days of the week to run
(e.g. |
None
|
day_of_month
|
int | None
|
Day of the month to run (1 -- 31). |
None
|
in_month
|
list[str] | None
|
Months to run in
(e.g. |
None
|
every_month
|
int | None
|
Run every N months. |
None
|
timezone
|
str | None
|
IANA timezone name (e.g. |
None
|
run_after_job_uuid
|
str | None
|
UUID of a job that must complete before this schedule triggers. |
None
|
run_after_job_name
|
str | None
|
Name of a job that must complete before this schedule triggers. |
None
|
run_after_job_condition
|
str | None
|
Required completion status of the
predecessor job (e.g. |
None
|
Example
from datatailr import Schedule
# Every weekday at 08:00 and 16:00 UTC
s = Schedule(at_hours=[8, 16], weekdays=["mon","tue","wed","thu","fri"])
get_cron_string()
Return the compiled cron string.
Returns:
| Type | Description |
|---|---|
str
|
Cron string (str). |
Examples:
>>> Schedule(
... at_minutes=[0, 15, 30, 45],
... at_hours=[0, 12],
... weekdays=["Mon", "Wed", "Fri"],
... day_of_month=15,
... in_month=["Jan", "Jul"],
... ).get_cron_string()
'0 0,15,30,45 0,12 15 1,7 1,3,5'