ExternalTaskSensor

Apache Airflow Certified

Waits for a different DAG or a task in a different DAG to complete for a specific execution_date

View Source

Last Updated: May. 7, 2021

Access Instructions

Install the Apache Airflow provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

external_dag_idstrThe dag_id that contains the task you want to wait for
external_task_idstr or NoneThe task_id that contains the task you want to wait for. If None (default value) the sensor waits for the DAG
allowed_statesIterableIterable of allowed states, default is ['success']
failed_statesIterableIterable of failed or dis-allowed states, default is None
execution_deltaOptional[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_fnOptional[Callable]function that receives the current execution date as the first positional argument and optionally any number of keyword arguments available in the context dictionary, and returns the desired execution dates to query. Either execution_delta or execution_date_fn can be passed to ExternalTaskSensor, but not both.
check_existenceboolSet 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).

Documentation

Waits for a different DAG or a task in a different DAG to complete for a specific execution_date

Was this page helpful?