airflow.sensors.external_task_sensor
¶
Module Contents¶
-
class
airflow.sensors.external_task_sensor.
ExternalTaskSensor
(external_dag_id, external_task_id=None, allowed_states=None, execution_delta=None, execution_date_fn=None, check_existence=False, *args, **kwargs)[source]¶ Bases:
airflow.sensors.base_sensor_operator.BaseSensorOperator
Waits for a different DAG or a task in a different DAG to complete for a specific execution_date
- Parameters
external_dag_id (str) – The dag_id that contains the task you want to wait for
external_task_id (str or None) – The task_id that contains the task you want to wait for. If
None
(default value) the sensor waits for the DAGallowed_states (list) – list of allowed states, default is
['success']
execution_delta (datetime.timedelta) – time difference with the previous execution to look at, the default is the same execution_date as the current task or DAG. For yesterday, use [positive!] datetime.timedelta(days=1). Either execution_delta or execution_date_fn can be passed to ExternalTaskSensor, but not both.
execution_date_fn (callable) – function that receives the current execution date and returns the desired execution dates to query. Either execution_delta or execution_date_fn can be passed to ExternalTaskSensor, but not both.
check_existence (bool) – Set to True to check if the external task exists (when external_task_id is not None) or check if the DAG to wait for exists (when external_task_id is None), and immediately cease waiting if the external task or DAG does not exist (default value: False).