Why does the ExternalTaskSensor get stuck?

This article is a part of my "100 data engineering tutorials in 100 days" challenge. (31/100)

If you configured an ExternalTaskSensor in Airflow to wait until a task in another DAG finishes (or the entire DAG finishes), you have probably noticed that it behaves surprisingly. Most data engineers assume that it is a bug, and their sensor gets stuck for whatever reason. I have to admit that I find it annoying because the documentation of the ExternalTaskSensor does not warn us about it.

ExternalTaskSensor works only if the other DAG has the same execution date equal to the expected execution date. Sure, you can specify the execution time delta, but it is not a time range.

For example:

  • The execution date of the DAG that contains the sensor is: 2020-10-01 14:00:00
  • The execution delta = 3 hours

In this situation, the other DAG’s execution date must be 2020-10-01 11:00:00.

I think that most data engineers expect that delta = 3 hours means that the other DAG may execute at any time between 11:00 and 14:00.

Remember to share on social media!
If you like this text, please share it on Facebook/Twitter/LinkedIn/Reddit or other social media.

If you want to contact me, send me a message on LinkedIn or Twitter.

Would you like to have a call and talk? Please schedule a meeting using this link.

Bartosz Mikulski
Bartosz Mikulski * data/machine learning engineer * conference speaker * co-founder of Software Craft Poznan & Poznan Scala User Group

This website DOES NOT use cookies
but you may still see the cookies set earlier if you have already visited it.