airflow.providers.standard.triggers.temporal¶
Classes¶
Trigger based on a datetime. |
|
Create DateTimeTriggers based on delays. |
Module Contents¶
- class airflow.providers.standard.triggers.temporal.DateTimeTrigger(moment=None, *, target_time=None, end_from_trigger=False)[source]¶
Bases:
airflow.triggers.base.BaseTriggerTrigger based on a datetime.
Pass either
moment(a tz-aware datetime) ortarget_time(a string, possibly a Jinja template, or a datetime). Withstart_from_trigger, the operator liststarget_timein its owntemplate_fieldsand puts it instart_trigger_args.trigger_kwargs, so the triggerer renders it in place beforerun(); it is then parsed intomomenton first use.- Parameters:
moment (datetime.datetime | None) – when to yield event
target_time (datetime.datetime | str | None) – raw (possibly templated) datetime string, an alternative to
momentend_from_trigger (bool) – whether the trigger should mark the task successful after time condition reached or resume the task after time condition reached.
- async run()[source]¶
Loop until the relevant time is met.
We do have a two-phase delay to save some cycles, but sleeping is so cheap anyway that it’s pretty loose. We also don’t just sleep for “the number of seconds until the time” in case the system clock changes unexpectedly, or handles a DST change poorly.
- class airflow.providers.standard.triggers.temporal.TimeDeltaTrigger(delta, *, end_from_trigger=False)[source]¶
Bases:
DateTimeTriggerCreate DateTimeTriggers based on delays.
Subclass to create DateTimeTriggers based on time delays rather than exact moments.
While this is its own distinct class here, it will serialise to a DateTimeTrigger class, since they’re operationally the same.
- Parameters:
delta (datetime.timedelta) – how long to wait
end_from_trigger (bool) – whether the trigger should mark the task successful after time condition reached or resume the task after time condition reached.