Skip to content

Restarting a single mapped task restarts all sibling tasks as well #54779

Closed

Description

@MarcusCramer91

Apache Airflow version

3.0.4

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

No response

What happened?

Cannot restart a single mapped task. It always restarts all sibling mapped tasks as well. I found this old issue #24699 so I thought it should be working, but doesn't for me. We have multiple issues here:

  1. When clearing the individual task it shows all siblings in the "Downstream" selection.
  2. It re-runs all sibling tasks. Cannot tell for certain this isn't just a UI bug in this simple example. But in my real-world use case, where Airflow triggers Google Cloud Run Jobs, it does spawn n Cloud Run Jobs upon restart.
  3. It also re-runs all downstream tasks for all map indices.
  4. For previous task executions, upon UI reload, I only get "::group::Log message source details: sources=["Could not read served logs: 'TaskInstanceHistory' object has no attribute 'triggerer_job'"]" and not the actual logs.

Or am I misunderstanding this feature?

What you think should happen instead?

Only the selected mapped task should be restarted.

The logs should properly show up in the UI for previous task tries.

Only downstream tasks with the same map index should be re-run (not sure this is easily possible or intended, but without it I don't see how restarting individual tasks would be of much use).

How to reproduce

@task
def task1(val: str):
    print("Task 2" + val)

@task
def task2(val: str):
    print("Task 2" + val)

@dag(dag_id="test")
def get_dag() -> None:
    t1 = task1.expand(val=["foo", "bar"])
    t2 = task2.expand(val=["foo", "bar"])
    t1 >> t2

get_dag()

Run once. Then re-run an individual task of task1.

Operating System

Debian GNU/Linux 12 (bookworm)

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

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

Activity

  1. added
    kind:bug
    needs-triage
    on Aug 21, 2025
  2. added
    affected_version:3.0
    on Aug 21, 2025
  3. jroachgolf84 commented on Aug 21, 2025

    @jroachgolf84
    Collaborator

    I am able to reproduce this behavior. However, I'd like to address this point below:

    Only downstream tasks with the same map index should be re-run (not sure this is easily possible or intended, but without it I don't see how restarting individual tasks would be of much use).

    In this case, if I cleared the state of task1[0], I would expect both task2[0] and task1[0] to be re-run, not just task2[0].

  4. added theissue type on Aug 21, 2025
  5. removed
    needs-triage
    on Aug 21, 2025
  6. MarcusCramer91 commented on Aug 29, 2025

    @MarcusCramer91
    Author

    I am able to reproduce this behavior. However, I'd like to address this point below:

    Only downstream tasks with the same map index should be re-run (not sure this is easily possible or intended, but without it I don't see how restarting individual tasks would be of much use).

    In this case, if I cleared the state of task1[0], I would expect both task2[0] and task1[0] to be re-run, not just task2[0].

    Agree! But I wouldn't expect task2[1] and task1[1] to be re-run, right?

  7. added
    priority:medium
    on Sep 2, 2025
  8. MarcusCramer91 commented on Sep 15, 2025

    @MarcusCramer91
    Author

    Any updates here? :) This is really making production use for us more cumbersome right now.

  9. kevinhongzl commented on Sep 30, 2025

    @kevinhongzl
    Contributor

    Hi @MarcusCramer91
    I tried restarting a single mapped task by unselecting all the options (past, future, upstream, etc.) above:

    Image

    and it worked as expected. No other task instances were restarted except the one I clicked on. Would you mind checking this to see if it works for you?

  10. matthieuauger commented on Sep 30, 2025

    @matthieuauger
    Contributor

    Hello,

    I think the initial issue is related to "Downstream" related tasks and depth-first workflows.

    Use case is when you have multiple mapped tasks in a workflow, for example in a group.
    My personal is use case is that I download data for each of my users with mapped tasks.

    My DAG looks like this

    • TaskGroup (mapped to 10 users)
      • Task 1 : create_job (mapped to 10 users with the group)
      • Task 2 : download_data (mapped to 10 users with the group)
      • Task 3 : validate_data (mapped to 10 users with the group)

    Let's assume everything went well for 9 out of 10 users (index 0 to 8) but failed for last user (mapped task index 9).

    I would like to be able to restart task instance create_job[9], click downstream and see download_data[9] and validate_date[9].

    This is really useful because currently if a mapped task fails, you need to re-run everything.

    I tried again with new version but issue still persist

    Image
  11. MarcusCramer91 commented on Oct 13, 2025

    @MarcusCramer91
    Author

    @kevinhongzl Exactly what @matthieuauger said :)

  12. uranusjr commented on Oct 29, 2025

    @uranusjr
    Member

    Can any of you try 3.1.1? I believe this is a duplicate to #56289.

  13. matthieuauger commented on Oct 29, 2025

    @matthieuauger
    Contributor

    @uranusjr Just tried on 3.1.1 but restarting create_job[0] also trigger all indexes for downstream tasks within the group.

    Image
  14. uranusjr commented on Oct 30, 2025

    @uranusjr
    Member

    So now it correctly only triggers create_job[0] (instead of all create_job instances), but the downstream handling is still not correct?

  15. matthieuauger commented on Oct 30, 2025

    @matthieuauger
    Contributor

    Indeed good catch! I just retried it and it seems to be an improvement from previous situation

  16. uranusjr commented on Oct 30, 2025

    @uranusjr
    Member

    Cool, I’ll take a stab at this and hopefully fix the downstream issue in the next release.

  17. matthieuauger commented on Oct 30, 2025

    @matthieuauger
    Contributor

    That would be a really huge improvement from my perspective, real one-piece-flow enabled on my DAGs. Can't wait

  18. eric-workweek commented on Oct 31, 2025

    @eric-workweek
    Image

    It seems like this is also a problem in version 2.11.0 (Airflow 2.11.0+astro.3 specifically)?

  19. added this to the Airflow 3.1.3 milestone on Nov 3, 2025
  20. matthieuauger commented on Dec 16, 2025

    @matthieuauger
    Contributor

    Hello,

    I tried this on last Airflow version but this still does not work as described here: #54779 (comment)

    If you restart a mapped task, it doesn't include its siblings, which is good.

    But it still includes all the downstream task siblings.

    In my screenshot for example, when I restart the create_job n°25 I still get all the mapped tasks for downstream task request_report_creation.

    Could we reopen this issue?

    Image
  21. MarcusCramer91 commented on Feb 2, 2026

    @MarcusCramer91
    Author

    I can confirm what @matthieuauger said. Any chance you could have a second look @uranusjr ? :)

    I am not 100% certain how exactly it would work, since it somehow must be specified that a downstream mapped task refers to the same mapping indices as the retried task. But it is a very common use case to map multiple tasks to the same array as stated above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

affected_version:3.0area:corearea:dynamic-task-mappingkind:bugpriority:medium

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions