Occasionally, Airflow DAGs get stuck in the running state but don’t want to run any tasks. From my observations, it happens mostly when we clear many DAG runs in one DAG because we want to reprocess a large number of tasks.

To avoid this problem, I suggest using the backfill command to restart only a small subset of DAGS. For example, a week of work, wait until it finishes, and restarting another batch.

Anyway, what to do when it is too late, and we have already ended up in a situation when everything is running, but nothing actually wants to run.

The first thing we can do is using the airflow clear command to remove the current state of those DAG runs. We can specify the date range using the -s and -e parameters:

airflow clear -s 2020-01-01 -e 2020-01-07 dag_id

Want to build AI systems that actually work?

Download my expert-crafted GenAI Transformation Guide for Data Teams and discover how to properly measure AI performance, set up guardrails, and continuously improve your AI solutions like the pros.

When that is not enough, we need to use the Airflow UI. In the menu, click the ‘Browse” tab, and open the ‘DAG Runs’ view.

On this page, we should find the DAG runs that don’t want to run, select them, and click the ‘With selected’ menu option. In the new menu, we click the ‘Delete’ command.

After that, Airflow should recreate the missing task instances and perhaps starts to execute the code.

Want to build AI systems that actually work?

Download my expert-crafted GenAI Transformation Guide for Data Teams and discover how to properly measure AI performance, set up guardrails, and continuously improve your AI solutions like the pros.

Older post

Why does the DayOfWeekSensor exist in Airflow?

How to make an Airflow DAG wait until a specified day of the week

Newer post

How to read from SQL table in PySpark using a query instead of specifying a table

Fetching data using a SQL query in PySpark

Are you looking for an experienced AI consultant? Do you need assistance with your RAG or Agentic Workflow?
Book a Quick Consultation, send me a message on LinkedIn. Book a Quick Consultation or send me a message on LinkedIn

>