Skip to content

Conversation

@zhiyong-ong
Copy link
Contributor

@zhiyong-ong zhiyong-ong commented Nov 4, 2022

This fixes the bug where clearing a parent dag will not clear the child dag's mapped task.

The bug was due to TaskInstanceKey accepting its attributes in the order (dag_id, task_id, run_id, try_number, map_index) while in _get_task_instances, the pk_tuple that we pass into TaskInstanceKey to get the result is (dag_id, task_id, run_id, map_index), missing out the try_number. So TaskInstanceKey assumes that the map_index value supplied is try_number and defaults the value of map_index to -1. This causes a bunch of problems downstream when we try and retrieve the TaskInstance from the table using the map_index as part of the filter.

fixes: #27462

@zhiyong-ong zhiyong-ong marked this pull request as ready for review November 4, 2022 09:48
@potiuk potiuk requested a review from uranusjr November 7, 2022 21:52
@zhiyong-ong zhiyong-ong force-pushed the fix-mapped-task-recursive-clearing branch from a27e48a to e13ca42 Compare November 16, 2022 19:43
@potiuk
Copy link
Member

potiuk commented Nov 16, 2022

Static checks need fixing.

@uranusjr uranusjr changed the title fix clearing child dag mapped tasks from parent dag Fix clearing child dag mapped tasks from parent dag Nov 17, 2022
@uranusjr uranusjr merged commit 5ce9c82 into apache:main Nov 17, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 17, 2022

Awesome work, congrats on your first merged pull request!

@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Nov 22, 2022
@yuqian90 yuqian90 added this to the Airflow 2.4.4 milestone Nov 22, 2022
@ephraimbuddy ephraimbuddy modified the milestones: Airflow 2.4.4, Airflow 2.5.0 Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clearing the parent dag will not clear child dag's mapped tasks

5 participants