clear

Definition

Deletes execution information of task instances, returning them to the state before they ever ran.

Usage

$ airflow tasks clear [-h] [-R] [-d] [-e END_DATE] [-X] [-x] [-f] [-r]
                    [-s START_DATE] [-S SUBDIR] [-t TASK_REGEX] [-u] [-v] [-y]
                    dag_id

Arguments

Parameter Description

dag_id

ID of the DAG

-R, --dag-regex

Search dag_id as regex instead of exact string

-d, --downstream

Include downstream tasks

-e, --end-date

Override end_date. The date format is YYYY-MM-DD

-X, --exclude-parentdag

Exclude parent DAGs if the task cleared is a part of a sub-DAG

-x, --exclude-subdags

Exclude sub-DAGs

-f, --only-failed

Only failed jobs

-r, --only-running

Only running jobs

-s, --start-date

Override start_date. The date format is YYYY-MM-DD

-S, --subdir

File or directory location for DAGs. Defaults to [AIRFLOW_HOME]/dags, where [AIRFLOW_HOME] is the value set for AIRFLOW_HOME config in airflow.cfg

-t, --task-regex

Regex to filter specific task_ids

-u, --upstream

Include upstream tasks

-y, --yes

Do not prompt to confirm

-h, --help

Print out the help manual for this command

-v, --verbose

Make logging output more verbose

Examples

To clear all failed tasks for the specified DAG, run:

$ airflow tasks clear example_dag_decorator --only-failed

Output example:

[2025-04-03T04:50:11.935+0000] {dagbag.py:541} INFO - Filling up the DagBag from /opt/airflow/dags
You are about to delete these 1 tasks:
<TaskInstance: example_dag_decorator.send_email manual__2025-04-03T11:27:54.722760+00:00 [failed]>

Are you sure? [y/n]
Found a mistake? Seleсt text and press Ctrl+Enter to report it