2

I have a use case in which Task A of DAG1 should run once the TASK B and TASK C of DAG2 are completed.

I am using ExternalTaskSensor, but to achieve this scenario I have to create two different sensors sensing the TASK B and TASK C each.


Is is possible to achieve this using a single sensor wherein I can provide a list of Tasks for which the sensor should wait.

y2k-shubham
  • 10,183
  • 11
  • 55
  • 131
Piyush
  • 21
  • 1
  • **No**; to do it with a single sensor, you need to extend `ExternalTaskSensor` (custom operator): `ExternalMultiTaskSensor`. While i'm not certain, from the looks of it, just overriding [`get_count(..)`](https://github.com/apache/airflow/blob/d1bce91bb21d5a468fa6a0207156c28fe1ca6513/airflow/sensors/external_task_sensor.py#L171) function and replacing [single `task_id` filter](https://github.com/apache/airflow/blob/d1bce91bb21d5a468fa6a0207156c28fe1ca6513/airflow/sensors/external_task_sensor.py#L190) with [IN clause](https://stackoverflow.com/q/8603088/3679900) for multiple `task_id`s will work – y2k-shubham Sep 09 '20 at 15:47

0 Answers0