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 |
-d, --downstream |
Include downstream tasks |
-e, --end-date |
Override |
-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 |
-S, --subdir |
File or directory location for DAGs. Defaults to |
-t, --task-regex |
Regex to filter specific |
-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]