Fix stats of dynamic mapped tasks after automatic retries of failed tasks - #44300
Merged
Conversation
try_number for dynamic mapped tasks
shahar1
marked this pull request as ready for review
November 23, 2024 10:08
shahar1
requested review from
ashb,
bbovenzi,
jscheffl,
pierrejeambrun and
ryanahamilton
as code owners
November 23, 2024 10:08
jscheffl
approved these changes
Nov 23, 2024
jscheffl
left a comment
Contributor
There was a problem hiding this comment.
I was reading the text multiple times and still have trouble understanding the query logic... but I can confirm it fixes the problem.
eladkal
approved these changes
Nov 23, 2024
Contributor
potiuk
pushed a commit
that referenced
this pull request
Nov 24, 2024
…amic mapped tasks (#44300) (#44319) * [v2-10-test] Avoid grouping task instance stats by try_number for dynamic mapped tasks (#44300) (cherry picked from commit 5e52bd2) Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com> * Update test_views_grid.py --------- Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
utkarsharma2
pushed a commit
that referenced
this pull request
Dec 4, 2024
…amic mapped tasks (#44300) (#44319) * [v2-10-test] Avoid grouping task instance stats by try_number for dynamic mapped tasks (#44300) (cherry picked from commit 5e52bd2) Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com> * Update test_views_grid.py --------- Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
utkarsharma2
pushed a commit
that referenced
this pull request
Dec 9, 2024
…amic mapped tasks (#44300) (#44319) * [v2-10-test] Avoid grouping task instance stats by try_number for dynamic mapped tasks (#44300) (cherry picked from commit 5e52bd2) Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com> * Update test_views_grid.py --------- Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
got686-yandex
pushed a commit
to got686-yandex/airflow
that referenced
this pull request
Jan 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #44245
Cause
The query for fetching the stats of task instances groups them by
task_id,run_id,state, andtry_number. However, usingtry_numberfor dynamic mapped tasks leads to incorrect results as individual tasks within the mapping might have differenttry_numbervalues.Example
Let's say that within a dynamic mapped task there were 10 expansions - 4 of them failed in the first time and reran (i.e.,

try_number = 2).In this case, the API response will eventually show only statistics regarding the most recent
try_number.Note
Intermediate results might not exactly follow the latter pattern, as they also depend on the
TaskInstance.stateparameter of thegroup_by.Solution
In the query, avoid grouping by
try_numberonly for dynamic mapped tasks (map_index != -1).^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.