Skip to content

Conversation

@evgenii-prusov
Copy link
Contributor

@evgenii-prusov evgenii-prusov commented Jul 19, 2025

Summary

Fixes task_id duplication when unmapping a MappedOperator within a TaskGroup. Previously, task IDs would get double-prefixed (e.g., tg1.tg1.mapped_task instead of tg1.mapped_task).

Problem

When MappedOperator.unmap() is called, it passes the already-prefixed task_id to BaseOperator.__init__, which applies the prefix again via task_group.child_id().

closes: #52334

Solution

Check if task_id already contains the task group prefix before passing to BaseOperator, preventing double prefixing.

Testing

Added test test_mapped_operator_in_task_group_no_duplicate_prefix to verify the fix. All existing tests pass.


@boring-cyborg
Copy link

boring-cyborg bot commented Jul 19, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@evgenii-prusov
Copy link
Contributor Author

@Lee-W , please, have a look

@eladkal eladkal added backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch type:bug-fix Changelog: Bug Fixes labels Jul 19, 2025
@eladkal eladkal added this to the Airflow 3.0.4 milestone Jul 19, 2025
Co-authored-by: Wei Lee <weilee.rx@gmail.com>
@Lee-W Lee-W merged commit 6b618ef into apache:main Jul 22, 2025
76 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jul 22, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@github-actions
Copy link

Backport failed to create: v3-0-test. View the failure log Run details

Status Branch Result
v3-0-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 6b618ef v3-0-test

This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

@evgenii-prusov evgenii-prusov deleted the fix/task-52334 branch August 3, 2025 06:26
amoghrajesh pushed a commit to astronomer/airflow that referenced this pull request Aug 11, 2025
…or (apache#53532)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Co-authored-by: Evgenii Prusov <evgenii.prusov@daiichisankyo.com>
(cherry picked from commit 6b618ef)
amoghrajesh pushed a commit to astronomer/airflow that referenced this pull request Aug 11, 2025
…or (apache#53532)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Co-authored-by: Evgenii Prusov <evgenii.prusov@daiichisankyo.com>
(cherry picked from commit 6b618ef)
amoghrajesh pushed a commit to astronomer/airflow that referenced this pull request Aug 11, 2025
…or (apache#53532)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Co-authored-by: Evgenii Prusov <evgenii.prusov@daiichisankyo.com>
(cherry picked from commit 6b618ef)
kaxil pushed a commit that referenced this pull request Aug 11, 2025
…or (#53532)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Co-authored-by: Evgenii Prusov <evgenii.prusov@daiichisankyo.com>
(cherry picked from commit 6b618ef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:task-sdk backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task group names are duplicated in Task's task_id for MappedOperator

4 participants