Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

airflow.providers.standard.sensors.time_delta

Classes

TimeDeltaSensor

Waits for a timedelta.

TimeDeltaSensorAsync

Deprecated. Use TimeDeltaSensor with deferrable=True instead.

WaitSensor

A sensor that waits a specified period of time before completing.

Module Contents

class airflow.providers.standard.sensors.time_delta.TimeDeltaSensor(*, delta, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), end_from_trigger=False, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Waits for a timedelta.

The delta will be evaluated against data_interval_end if present for the dag run, otherwise run_after will be used.

Parameters:
  • delta (datetime.timedelta) – time to wait before succeeding.

  • deferrable (bool) – Run sensor in deferrable mode. If set to True, task will defer itself to avoid taking up a worker slot while it is waiting.

See also

For more information on how to use this sensor, take a look at the guide: TimeDeltaSensor

delta[source]
deferrable = True[source]
end_from_trigger = False[source]
poke(context)[source]

Override when deriving this class.

execute(context)[source]

Depending on the deferrable flag, either execute the sensor in a blocking way or defer it.

  • Sync path → use BaseSensorOperator.execute() which loops over poke.

  • Async path → defer to DateTimeTrigger and free the worker slot.

execute_complete(context, event=None)[source]

Handle the event when the trigger fires and return immediately.

class airflow.providers.standard.sensors.time_delta.TimeDeltaSensorAsync(*, end_from_trigger=False, delta, **kwargs)[source]

Bases: TimeDeltaSensor

Deprecated. Use TimeDeltaSensor with deferrable=True instead.

Sphinx-autoapi-skip:

class airflow.providers.standard.sensors.time_delta.WaitSensor(time_to_wait, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

A sensor that waits a specified period of time before completing.

This differs from TimeDeltaSensor because the time to wait is measured from the start of the task, not the data_interval_end of the DAG run.

Parameters:
  • time_to_wait (datetime.timedelta | int) – time length to wait after the task starts before succeeding.

  • deferrable (bool) – Run sensor in deferrable mode

deferrable = True[source]
execute(context)[source]

Derive when creating an operator.

The main method to execute the task. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?