ExternalTaskSensor

Apache Airflow Certified

Waits for a different DAG or a task in a different DAG to complete for a specific logical date.

View on GitHub

Last Updated: Nov. 16, 2022

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_idRequiredstrThe 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
external_task_idsIterable of task_ids or None, default is NoneThe list of task_ids that you want to wait for. If None (default value) the sensor waits for the DAG. Either external_task_id or external_task_ids can be passed to ExternalTaskSensor, but not both.
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 logical 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’s logical date as the first positional argument and optionally any number of keyword arguments available in the context dictionary, and returns the desired logical 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 logical date.

Was this page helpful?