22

I know there is a way to delete a DAG. But is it possible to delete a DAG run with a specific run_id? Something like:

airflow delete_dag_run <dag_id> <run_id>

Oleg Alexander
  • 909
  • 1
  • 7
  • 11

2 Answers2

38

To delete a DAG Run from the Airflow UI:

  1. Browse > "DAG Runs".
  2. Select the DAG Runs you want to delete with the checkboxes on the left.
  3. "With selected" > Delete.
prayagupa
  • 30,204
  • 14
  • 155
  • 192
Oleg Alexander
  • 909
  • 1
  • 7
  • 11
7

You can also delete the "DAG Runs" from airflow database:

DELETE FROM dag_run
WHERE dag_id='my_dag_id' AND 
state='STATE_I_WANT_TO_DELETE'
prayagupa
  • 30,204
  • 14
  • 155
  • 192
  • is removing from db enought so airflow won't somehow take this runs out from memory/session whatever and execute? – andilabs May 06 '21 at 12:18
  • 1
    @andilabs Thats a good question, my experience was airflow seemed to constantly check database so i did not see much delay there. Which makes sense to me because database is the final state of DAGs. And even if I change from airflow console UI I'm sure it will also update the database. – prayagupa May 06 '21 at 23:10
  • Shouldn't the task instances be deleted too? – Bumsik Kim Dec 28 '21 at 06:28