Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail task if mapping upstream fails #25757

Merged

Conversation

uranusjr
Copy link
Member

We already mark the mapped task's unmapped ti to UPSTREAM_FAILED if the upstream fails with ALL_SUCCESS, so this simply replicates the behavior for all trigger rules.

Fix #25698.

We already mark the mapped task's unmapped ti to UPSTREAM_FAILED if the
upstream fails with ALL_SUCCESS, so this simply replicates the behavior
for all trigger rules.
@uranusjr uranusjr added this to the Airflow 2.4.0 milestone Aug 17, 2022
@boring-cyborg boring-cyborg bot added the area:Scheduler including HA (high availability) scheduler label Aug 17, 2022
).update({TaskInstance.state: TaskInstanceState.REMOVED})

session.flush()
return all_expanded_tis, total_length
return all_expanded_tis, total_expanded_ti_count - 1
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the old code introduces an off-by-one error? The return value is described as “the maximum map_index” (and is used as such in BackfillJob), which should be one less than the total expand length, right?

Copy link
Member

Choose a reason for hiding this comment

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

Yup.

                def to_keep(key: TaskInstanceKey) -> bool:
                    if key.dag_id != node.dag_id or key.task_id != node.task_id or key.run_id != run_id:
                        # For another Dag/Task/Run -- don't remove
                        return True
                    return 0 <= key.map_index <= max_map_index

@uranusjr uranusjr merged commit 728a3ce into apache:main Aug 19, 2022
@uranusjr uranusjr deleted the failed-upstream-should-not-crash-expansion branch August 19, 2022 09:45
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Scheduler including HA (high availability) scheduler type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backfill mode with mapped tasks: "Failed to populate all mapping metadata"
3 participants