Skip to content

Conversation

@kevinhongzl
Copy link
Contributor

closes: #43214

Why this change

This PR fixes the bug where task mapping fails to handle zero-length inputs during a rerun. This occured because tasks with map_index = 0 are incorrectly added to ready_tis in _get_ready_tis() even though _revise_map_indexes_if_mapped() had marked them as REMOVED.

Solution

  • Add addition state check to the schedulable tasks following _revise_map_indexes_if_mapped() to prevent incorrect inclusion

^ 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.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@kevinhongzl kevinhongzl force-pushed the fix-error-retry-zero-length-mapped-tasks branch from 7303b8e to dbb57e2 Compare September 27, 2025 08:31
@jason810496 jason810496 self-requested a review September 27, 2025 15:36
@kevinhongzl kevinhongzl force-pushed the fix-error-retry-zero-length-mapped-tasks branch from d01d153 to 8fb7b8e Compare September 28, 2025 16:27
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Nice catch!

@kevinhongzl kevinhongzl force-pushed the fix-error-retry-zero-length-mapped-tasks branch 3 times, most recently from 25fc322 to d9ff37f Compare September 30, 2025 09:47
@eladkal eladkal added this to the Airflow 3.1.1 milestone Sep 30, 2025
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Sep 30, 2025
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on my side.

@kevinhongzl kevinhongzl force-pushed the fix-error-retry-zero-length-mapped-tasks branch from d9ff37f to 949740d Compare September 30, 2025 16:37
@kevinhongzl kevinhongzl force-pushed the fix-error-retry-zero-length-mapped-tasks branch from 949740d to e9fa5e2 Compare October 2, 2025 14:32
@jason810496 jason810496 merged commit 6d3e841 into apache:main Oct 3, 2025
61 checks passed
sc250072 pushed a commit to Teradata/airflow that referenced this pull request Oct 3, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
dabla pushed a commit to dabla/airflow that referenced this pull request Oct 12, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
potiuk added a commit that referenced this pull request Oct 13, 2025
* Error message improvied

* Error messages of bteq improved

* Bump ruff to 0.13.3 and prek to 0.2.3 (#56355)

* fix: allow mapped tasks to accept zero-length inputs on rerun (#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

* Chart gitsync vars (#56245)

* make the variable name in .Values.dags.gitSync.credentials secret dependent on the GitSync version

* update gitsync tests

* Update provider's metadata (#56357)

* Fix install_java.sh (#56211)

Co-authored-by: Ulada Zakharava <[email protected]>

* Add new PL translations. (#56359)

---------

Co-authored-by: Amogh Desai <[email protected]>
Co-authored-by: Zhen-Lun (Kevin) Hong <[email protected]>
Co-authored-by: Kirill Romanikhin <[email protected]>
Co-authored-by: Jarek Potiuk <[email protected]>
Co-authored-by: VladaZakharova <[email protected]>
Co-authored-by: Ulada Zakharava <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
* Error message improvied

* Error messages of bteq improved

* Bump ruff to 0.13.3 and prek to 0.2.3 (apache#56355)

* fix: allow mapped tasks to accept zero-length inputs on rerun (apache#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

* Chart gitsync vars (apache#56245)

* make the variable name in .Values.dags.gitSync.credentials secret dependent on the GitSync version

* update gitsync tests

* Update provider's metadata (apache#56357)

* Fix install_java.sh (apache#56211)

Co-authored-by: Ulada Zakharava <[email protected]>

* Add new PL translations. (apache#56359)

---------

Co-authored-by: Amogh Desai <[email protected]>
Co-authored-by: Zhen-Lun (Kevin) Hong <[email protected]>
Co-authored-by: Kirill Romanikhin <[email protected]>
Co-authored-by: Jarek Potiuk <[email protected]>
Co-authored-by: VladaZakharova <[email protected]>
Co-authored-by: Ulada Zakharava <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
* Error message improvied

* Error messages of bteq improved

* Bump ruff to 0.13.3 and prek to 0.2.3 (apache#56355)

* fix: allow mapped tasks to accept zero-length inputs on rerun (apache#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

* Chart gitsync vars (apache#56245)

* make the variable name in .Values.dags.gitSync.credentials secret dependent on the GitSync version

* update gitsync tests

* Update provider's metadata (apache#56357)

* Fix install_java.sh (apache#56211)

Co-authored-by: Ulada Zakharava <[email protected]>

* Add new PL translations. (apache#56359)

---------

Co-authored-by: Amogh Desai <[email protected]>
Co-authored-by: Zhen-Lun (Kevin) Hong <[email protected]>
Co-authored-by: Kirill Romanikhin <[email protected]>
Co-authored-by: Jarek Potiuk <[email protected]>
Co-authored-by: VladaZakharova <[email protected]>
Co-authored-by: Ulada Zakharava <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
* Error message improvied

* Error messages of bteq improved

* Bump ruff to 0.13.3 and prek to 0.2.3 (apache#56355)

* fix: allow mapped tasks to accept zero-length inputs on rerun (apache#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

* Chart gitsync vars (apache#56245)

* make the variable name in .Values.dags.gitSync.credentials secret dependent on the GitSync version

* update gitsync tests

* Update provider's metadata (apache#56357)

* Fix install_java.sh (apache#56211)

Co-authored-by: Ulada Zakharava <[email protected]>

* Add new PL translations. (apache#56359)

---------

Co-authored-by: Amogh Desai <[email protected]>
Co-authored-by: Zhen-Lun (Kevin) Hong <[email protected]>
Co-authored-by: Kirill Romanikhin <[email protected]>
Co-authored-by: Jarek Potiuk <[email protected]>
Co-authored-by: VladaZakharova <[email protected]>
Co-authored-by: Ulada Zakharava <[email protected]>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
…#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
* Error message improvied

* Error messages of bteq improved

* Bump ruff to 0.13.3 and prek to 0.2.3 (apache#56355)

* fix: allow mapped tasks to accept zero-length inputs on rerun (apache#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

* Chart gitsync vars (apache#56245)

* make the variable name in .Values.dags.gitSync.credentials secret dependent on the GitSync version

* update gitsync tests

* Update provider's metadata (apache#56357)

* Fix install_java.sh (apache#56211)

Co-authored-by: Ulada Zakharava <[email protected]>

* Add new PL translations. (apache#56359)

---------

Co-authored-by: Amogh Desai <[email protected]>
Co-authored-by: Zhen-Lun (Kevin) Hong <[email protected]>
Co-authored-by: Kirill Romanikhin <[email protected]>
Co-authored-by: Jarek Potiuk <[email protected]>
Co-authored-by: VladaZakharova <[email protected]>
Co-authored-by: Ulada Zakharava <[email protected]>
kaxil pushed a commit that referenced this pull request Oct 21, 2025
* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

(cherry picked from commit 6d3e841)
TyrellHaywood pushed a commit to TyrellHaywood/airflow that referenced this pull request Oct 22, 2025
* Error message improvied

* Error messages of bteq improved

* Bump ruff to 0.13.3 and prek to 0.2.3 (apache#56355)

* fix: allow mapped tasks to accept zero-length inputs on rerun (apache#56162)

* fix: allow mapped tasks to accept zero-length inputs on rerun

* fix: add test for rerun args of different length

* chore: revise comments to align with the changes

* chore: add comments before the task state check

* fix: replace legacy query syntax

* Chart gitsync vars (apache#56245)

* make the variable name in .Values.dags.gitSync.credentials secret dependent on the GitSync version

* update gitsync tests

* Update provider's metadata (apache#56357)

* Fix install_java.sh (apache#56211)

Co-authored-by: Ulada Zakharava <[email protected]>

* Add new PL translations. (apache#56359)

---------

Co-authored-by: Amogh Desai <[email protected]>
Co-authored-by: Zhen-Lun (Kevin) Hong <[email protected]>
Co-authored-by: Kirill Romanikhin <[email protected]>
Co-authored-by: Jarek Potiuk <[email protected]>
Co-authored-by: VladaZakharova <[email protected]>
Co-authored-by: Ulada Zakharava <[email protected]>
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.

RuntimeError when retrying DAG run with zero-length mapped tasks

3 participants