airflow.triggers.temporal
¶
Module Contents¶
Classes¶
Trigger based on a datetime. |
|
Create DateTimeTriggers based on delays. |
- class airflow.triggers.temporal.DateTimeTrigger(moment, *, end_from_trigger=False)[source]¶
Bases:
airflow.triggers.base.BaseTrigger
Trigger based on a datetime.
A trigger that fires exactly once, at the given datetime, give or take a few seconds.
The provided datetime MUST be in UTC.
- Parameters
moment (datetime.datetime) – when to yield event
end_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.triggers.temporal.TimeDeltaTrigger(delta, *, end_from_trigger=False)[source]¶
Bases:
DateTimeTrigger
Create 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.