prefect.client.schemas.schedules
is_valid_timezone
is_schedule_type
construct_schedule
interval
: An interval on which to schedule runs. Accepts either a number
or a timedelta object. If a number is given, it will be interpreted as seconds.anchor_date
: The start date for an interval schedule.cron
: A cron schedule for runs.rrule
: An rrule schedule of when to execute runs of this flow.timezone
: A timezone to use for the schedule. Defaults to UTC.IntervalSchedule
interval
increments to an anchor_date
. If no
anchor_date
is supplied, the current UTC time is used. If a
timezone-naive datetime is provided for anchor_date
, it is assumed to be
in the schedule’s timezone (or UTC). Even if supplied with an IANA timezone,
anchor dates are always stored as UTC offsets, so a timezone
can be
provided to determine localization behaviors like DST boundary handling. If
none is provided it will be inferred from the anchor date.
NOTE: If the IntervalSchedule
anchor_date
or timezone
is provided in a
DST-observing timezone, then the schedule will adjust itself appropriately.
Intervals greater than 24 hours will follow DST conventions, while intervals
of less than 24 hours will follow UTC intervals. For example, an hourly
schedule will fire every UTC hour, even across DST boundaries. When clocks
are set back, this will result in two runs that appear to both be
scheduled for 1am local time, even though they are an hour apart in UTC
time. For longer intervals, like a daily schedule, the interval schedule
will adjust for DST boundaries so that the clock-hour remains constant. This
means that a daily schedule that always fires at 9am will observe DST and
continue to fire at 9am in the local time zone.
Args:
interval
: an interval to schedule onanchor_date
: an anchor date to schedule increments against;
if not provided, the current timestamp will be usedtimezone
: a valid timezone stringvalidate_timezone
CronSchedule
cron
: a valid cron stringtimezone
: a valid timezone string in IANA tzdata format (for example,
America/New_York).day_or
: Control how croniter handles day
and day_of_week
entries. Defaults to True, matching cron which connects those values using
OR. If the switch is set to False, the values are connected using AND. This
behaves like fcron and enables you to e.g. define a job that executes each
2nd friday of a month by setting the days of month and the weekday.valid_timezone
valid_cron_string
RRuleSchedule
dateutils.rrule
.
RRules are appropriate for any kind of calendar-date manipulation, including
irregular intervals, repetition, exclusions, week day or day-of-month
adjustments, and more.
Note that as a calendar-oriented standard, RRuleSchedules
are sensitive to
to the initial timezone provided. A 9am daily schedule with a daylight saving
time-aware start date will maintain a local 9am time through DST boundaries;
a 9am daily schedule with a UTC start date will maintain a 9am UTC time.
Args:
rrule
: a valid RRule stringtimezone
: a valid timezone stringvalidate_rrule_str
from_rrule
to_rrule
valid_timezone
NoSchedule