# Clocks
# Clock
class
prefect.schedules.clocks.Clock
(start_date=None, end_date=None, parameter_defaults=None, labels=None)[source]Base class for Clocks
Args:
start_date (datetime, optional)
: an optional start date for the clockend_date (datetime, optional)
: an optional end date for the clockparameter_defaults (dict, optional)
: an optional dictionary of default Parameter values; if provided, these values will be passed as the Parameter values for all Flow Runs which are run on this clock's eventslabels (List[str], optional)
: a list of labels to apply to all flow runs generated from this Clock
methods: |
---|
prefect.schedules.clocks.Clock.events (after=None)[source] |
Generator that emits clock events
|
# IntervalClock
class
prefect.schedules.clocks.IntervalClock
(interval, start_date=None, end_date=None, parameter_defaults=None, labels=None)[source]A clock formed by adding timedelta
increments to a start_date.
IntervalClocks support any interval, but if deployed to Prefect Cloud only intervals of one minute or greater are allowed.
NOTE: If the IntervalClock
start time is provided with a DST-observing timezone, then the clock 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 clock 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 clock, the interval clock will adjust for DST boundaries so that the clock-hour remains constant. This means that a daily clock that always fires at 9am will observe DST and continue to fire at 9am in the local time zone.
Note that this behavior is different from the CronClock
.
Args:
interval (timedelta)
: interval on which this clock occursstart_date (datetime, optional)
: first date of clock. If None, will be set to "2019-01-01 00:00:00 UTC"end_date (datetime, optional)
: an optional end date for the clockparameter_defaults (dict, optional)
: an optional dictionary of default Parameter values; if provided, these values will be passed as the Parameter values for all Flow Runs which are run on this clock's eventslabels (List[str], optional)
: a list of labels to apply to all flow runs generated from this Clock
TypeError
: if start_date is not a datetimeValueError
: if provided interval is less than or equal to zero
methods: |
---|
prefect.schedules.clocks.IntervalClock.events (after=None)[source] |
Generator that emits clock events
|
# CronClock
class
prefect.schedules.clocks.CronClock
(cron, start_date=None, end_date=None, parameter_defaults=None, labels=None, day_or=None)[source]Cron clock.
NOTE: If the CronClock's
start time is provided with a DST-observing timezone, then the clock will adjust itself. Cron's rules for DST are based on clock times, not intervals. This means that an hourly cron clock will fire on every new clock hour, not every elapsed hour; for example, when clocks are set back this will result in a two-hour pause as the clock will fire the first time 1am is reached and the first time 2am is reached, 120 minutes later. Longer clocks, such as one that fires at 9am every morning, will automatically adjust for DST.
Note that this behavior is different from the IntervalClock
.
NOTE: CronClock
respects microseconds meaning for a clock that runs once a day, if the start time is (2020, 1, 1, 0, 0, 0, 1)
then the first scheduled run will be (2020, 1, 2, 0, 0, 0, 0)
.
Args:
cron (str)
: a valid cron stringstart_date (datetime, optional)
: an optional start date for the clockend_date (datetime, optional)
: an optional end date for the clockparameter_defaults (dict, optional)
: an optional dictionary of default Parameter values; if provided, these values will be passed as the Parameter values for all Flow Runs which are run on this clock's eventslabels (List[str], optional)
: a list of labels to apply to all flow runs generated from this Clockday_or (bool, optional)
: Control how croniter handlesday
andday_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.
ValueError
: if the cron string is invalid
methods: |
---|
prefect.schedules.clocks.CronClock.events (after=None)[source] |
Generator that emits clock events
|
# DatesClock
Clock that fires on specific dates
Args:
dates (List[datetime])
: a list ofdatetimes
on which the clock should fireparameter_defaults (dict, optional)
: an optional dictionary of default Parameter values; if provided, these values will be passed as the Parameter values for all Flow Runs which are run on this clock's eventslabels (List[str], optional)
: a list of labels to apply to all flow runs generated from this Clock
methods: |
---|
prefect.schedules.clocks.DatesClock.events (after=None)[source] |
Generator that emits clock events
|
This documentation was auto-generated from commit n/a
on July 1, 2021 at 18:35 UTC
← Adjustments Filters →