Skip to content

Schedule

Represents a schedule for batch jobs.

__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. "0 */2 * * *"). If provided alongside helper parameters, the helpers take precedence.

''
at_minutes list[int] | None

Specific minutes past the hour to run (e.g. [0, 30] for ":00" and ":30").

None
every_minute int | None

Run every N minutes (e.g. 5 for every 5 minutes).

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. ["mon", "wed", "fri"]).

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. ["jan", "apr", "jul", "oct"]).

None
every_month int | None

Run every N months.

None
timezone str | None

IANA timezone name (e.g. "America/New_York").

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

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

Returns the compiled cron string.