airflow.triggers.temporal

Module Contents

Classes

DateTimeTrigger

Trigger based on a datetime.

TimeDeltaTrigger

Create DateTimeTriggers based on delays.

class airflow.triggers.temporal.DateTimeTrigger(moment)[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.

serialize()[source]

Return the information needed to reconstruct this Trigger.

Returns

Tuple of (class path, keyword arguments needed to re-instantiate).

Return type

tuple[str, dict[str, Any]]

async run()[source]

Simple time delay 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)[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.

Was this entry helpful?