TimeDeltaSensor

Use the TimeDeltaSensor to end sensing after specific time.

airflow/example_dags/example_sensors.py[source]

t0 = TimeDeltaSensor(task_id="wait_some_seconds", delta=datetime.timedelta(seconds=2))

TimeDeltaSensorAsync

Use the TimeDeltaSensorAsync to end sensing after specific time. It is an async version of the operator and requires Triggerer to run.

airflow/example_dags/example_sensors.py[source]

t0a = TimeDeltaSensorAsync(task_id="wait_some_seconds_async", delta=datetime.timedelta(seconds=2))

TimeSensor

Use the TimeSensor to end sensing after time specified.

airflow/example_dags/example_sensors.py[source]

t1 = TimeSensor(
    task_id="fire_immediately", target_time=datetime.datetime.now(tz=datetime.timezone.utc).time()
)

t2 = TimeSensor(
    task_id="timeout_after_second_date_in_the_future",
    timeout=1,
    soft_fail=True,
    target_time=(datetime.datetime.now(tz=datetime.timezone.utc) + datetime.timedelta(hours=1)).time(),
)

TimeSensorAsync

Use the TimeSensorAsync to end sensing after time specified. It is an async version of the operator and requires Triggerer to run.

airflow/example_dags/example_sensors.py[source]

t1a = TimeSensorAsync(
    task_id="fire_immediately_async", target_time=datetime.datetime.now(tz=datetime.timezone.utc).time()
)

t2a = TimeSensorAsync(
    task_id="timeout_after_second_date_in_the_future_async",
    timeout=1,
    soft_fail=True,
    target_time=(datetime.datetime.now(tz=datetime.timezone.utc) + datetime.timedelta(hours=1)).time(),
)

Was this entry helpful?