Skip to content

Type TaskInstance.task to Operator and call unmap() when needed#21563

Merged
uranusjr merged 6 commits into
apache:mainfrom
astronomer:unmapping-taskinstance
Feb 15, 2022
Merged

Type TaskInstance.task to Operator and call unmap() when needed#21563
uranusjr merged 6 commits into
apache:mainfrom
astronomer:unmapping-taskinstance

Conversation

@uranusjr

Copy link
Copy Markdown
Member

I traced all the TaskInstance.task calls I could find (may not be comprehensive but I did what I could), and analysed whether task can be mapped or not on each of their call paths. I added a runtime check when they are guaranteed to be not mapped, and additional unmap calls when needed. I also implemented MappedOperator.resources since it is needed.

This also depends on the inlets and outlets properties proposed in #21495 (right now they are type-ignored so CI can pass).

@github-actions github-actions Bot added the full tests needed We need to run full set of tests for this PR to merge label Feb 14, 2022
@github-actions

Copy link
Copy Markdown
Contributor

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

Instead of specifically check for -1, this checks the more "logical"
distinction between mapped and unmapped tasks: mapped operators always
have 0 or positive (since those are the index), while an unmapped task
has a negative value.
@uranusjr uranusjr force-pushed the unmapping-taskinstance branch from 5122769 to 91bf060 Compare February 15, 2022 12:24
@uranusjr uranusjr changed the title Change TaskInstance.task type to Operator and call unmap() when needed Type TaskInstance.task to Operator and call unmap() when needed Feb 15, 2022
@uranusjr uranusjr merged commit 7be87d8 into apache:main Feb 15, 2022
@uranusjr uranusjr deleted the unmapping-taskinstance branch February 15, 2022 13:18
@jedcunningham jedcunningham added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Feb 28, 2022
@jedcunningham jedcunningham added this to the Airflow 2.3.0 milestone Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:CLI area:dynamic-task-mapping AIP-42 area:logging area:providers area:Scheduler including HA (high availability) scheduler area:webserver Webserver related Issues changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants