Hi Sai,

I suspect the issue is to do with the scheduled execution datetime. 
ExternalTaskSensor only looks for external tasks in DAGs that are the exact 
same scheduled execution datetime as the current schedule.

Because you have set your schedule interval to timedelta(minutes=5) the 
execution datetime is going to be relatively random and your 2 DAGs are 
unlikely to have the same execution datetime.

You have 2 options:

1.       Set the schedule interval using cron notations so you have predictable 
execution datetimes, i.e. */5 * * * * . Use cron guru if you’re not familiar 
with cron notation: https://crontab.guru/#*/5_*_*_*_*. Now your 2 DAGs will be 
in sync and the dependency will work.



2.       Modify your own version of ExternalTaskSensor so it is more liberal 
about looking up the execution datetime, I have had to do this for a number of 
DAGs but you have to be very careful as there a lot of edge cases (like what if 
there are 2 or more external tasks your external task sensor matches against). 
You can use the existing code of ExternalTaskSensor as your starting point: 
https://github.com/apache/airflow/blob/master/airflow/sensors/external_task_sensor.py

Regards
Damian

From: Sai Golla <[email protected]>
Sent: Saturday, February 15, 2020 23:05
To: [email protected]
Subject: FW: RE: RE: Re: Airflow Dag Dependency


Hi All,

Could any one please help me with External Task Sensor. I am facing issue with 
External Task sensor, and attached are my Dag’s.

I have kept  Mode = Reschedule which is making the job to reschedule and not 
triggering the  Task 2 in my Dag2.

Thanks
Sai Prasad Golla



=============================================================================== 
Please access the attached hyperlink for an important electronic communications 
disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
=============================================================================== 

Reply via email to