Skip to content

Airflow 3 Clear Task Instance for past or future doesn't work #54134

@josegabrielrivera

Description

@josegabrielrivera

Apache Airflow version

3.0.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

#47036 included a validation that raises an exception when a clear instance call is made with the dag_run_id defined.

The problem comes when you try to do one of the most common re-run scenario using the web UI: Clear Task Instance for future and/or downstream. You can't, because selecting the task automatically adds a dag_run_id to the request if I'm not wrong.

The re-run tasks documentation says that this is the way to proceed for re-running tasks:

Past - All the instances of the task in the runs before the DAG’s most recent data interval
Future - All the instances of the task in the runs after the DAG’s most recent data interval

Now it forces you to clear the dags one by one, instead of let airflow calculate all the necessary tasks to be cleared.

What you think should happen instead?

The moment you click on the Past or Future buttons on the Clear Task Instance dialog, it says "Non Task Instances found.", digging into the network requests, I can see the following error on the endpoint api/v2/dags/my_dag_name/clearTaskInstances:

{
    "detail": "Cannot use include_past or include_future when dag_run_id is provided because logical_date is not applicable."
}

I would expect to behave as it does on Airflow 2 versions, populating the list with the future/past affected tasks to be able to clear and re-run them.

How to reproduce

Using the basic DAG from the documentation, do a backfill for a few days or wait until you have some runs.

  1. Go to the web UI and open the DAG
  2. Click on a task from which we want to rerun
  3. Click on Clear Task Instance
  4. Click on Future or Past (depending if you have future or pasts tasks to be cleared, doesn't matter both generates the same issue)

Operating System

Debian GNU/Linux 12 (bookworm)

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected_version:3.0Issues Reported for 3.0area:UIRelated to UI/UX. For Frontend Developers.area:corekind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions