TimeDeltaSensor

Use the TimeDeltaSensor to end sensing after specific time.

airflow/example_dags/example_sensors.py[source]

  1. t0 = TimeDeltaSensor(task_id="wait_some_seconds", delta=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]

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

TimeSensor

Use the TimeSensor to end sensing after time specified.

airflow/example_dags/example_sensors.py[source]

  1. t1 = TimeSensor(task_id="fire_immediately", target_time=datetime.now(tz=UTC).time())
  2. t2 = TimeSensor(
  3. task_id="timeout_after_second_date_in_the_future",
  4. timeout=1,
  5. soft_fail=True,
  6. target_time=(datetime.now(tz=UTC) + timedelta(hours=1)).time(),
  7. )

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]

  1. t1a = TimeSensorAsync(task_id="fire_immediately_async", target_time=datetime.now(tz=UTC).time())
  2. t2a = TimeSensorAsync(
  3. task_id="timeout_after_second_date_in_the_future_async",
  4. timeout=1,
  5. soft_fail=True,
  6. target_time=(datetime.now(tz=UTC) + timedelta(hours=1)).time(),
  7. )