Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a DAG run in Apache Airflow?

Tags:

airflow

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>

like image 343
Oleg Alexander Avatar asked Oct 19 '19 01:10

Oleg Alexander


People also ask

How do I delete an Airflow task?

Click on the "select all" checkbox at the top of the list to select all of the queued tasks. Now, in the "Actions" menu, select "Clear" and apply it to all of the queued tasks. Confirm your choice to Clear the queued tasks. Airflow should immediately prepare to run the queued tasks.

How do I delete Airflow logs?

To clean up scheduler log files I do delete them manually two times in a week to avoid the risk of logs deleted which needs to be required for some reasons. I clean the logs files by [sudo rm -rd airflow/logs/] command.

What does clear do in Airflow?

If you want to re-run a task in Airflow, the best way to do so is to press Clear or Delete (language depends on the Airflow version you're running), not Run . Hitting this will clear the state of your failed task and allow the scheduler to pick it back up and re-run it.


2 Answers

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.
like image 192
Oleg Alexander Avatar answered Sep 20 '22 01:09

Oleg Alexander


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'
like image 27
prayagupa Avatar answered Sep 19 '22 01:09

prayagupa