ExternalTaskSensor
Apache AirflowWaits for a different DAG, task group, or task to complete for a specific logical date.
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
Documentation
Waits for a different DAG, task group, or task to complete for a specific logical date.
If both external_task_group_id and external_task_id are None
(default), the sensor waits for the DAG. Values for external_task_group_id and external_task_id can’t be set at the same time.
By default, the ExternalTaskSensor will wait for the external task to succeed, at which point it will also succeed. However, by default it will not fail if the external task fails, but will continue to check the status until the sensor times out (thus giving you time to retry the external task without also having to clear the sensor).
It is possible to alter the default behavior by setting states which cause the sensor to fail, e.g. by setting allowed_states=[State.FAILED]
and failed_states=[State.SUCCESS]
you will flip the behaviour to get a sensor which goes green when the external task fails and immediately goes red if the external task succeeds!
Note that soft_fail
is respected when examining the failed_states. Thus if the external task enters a failed state and soft_fail == True
the sensor will _skip_ rather than fail. As a result, setting soft_fail=True
and failed_states=[State.SKIPPED]
will result in the sensor skipping if the external task skips.