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

Implement map() semantic #25085

Merged
merged 3 commits into from
Jul 25, 2022
Merged

Implement map() semantic #25085

merged 3 commits into from
Jul 25, 2022

Conversation

uranusjr
Copy link
Member

@uranusjr uranusjr commented Jul 15, 2022

This is done by adding a variant to the XComArg mechanism so we can hook extra logic into resolve() at runtime.

Some extra mechanism is added so we can continue to use XComArg like we do right now, but also prevent TransformedXComArg from needing to inherit a lot of the old XComArg nonsense like __str__ and __getitem__.

Some validation is removed from the upstream that pushed the XCom, because with map() we can no longer be sure the XCom is “wrong” when the upstream finishes (we can only know in the downstream, after transform functions are applied).

@potiuk
Copy link
Member

potiuk commented Jul 21, 2022

I don't know too much on the details to have useful review, but if you need my review @uranusjr I can dig a bit deeper if other's won't chime in.

@uranusjr
Copy link
Member Author

Feel free! This one on its own shouldn’t need too much context to understand.

airflow/models/taskinstance.py Outdated Show resolved Hide resolved
airflow/models/xcom_arg.py Outdated Show resolved Hide resolved
After implementing map(), the upstream of expand_kwargs() does not
necessarily need to push a list of dicts, but a sequence of anything
(and can rely on map() to convert elements to dicts). So we need to
relax the restriction. If the map() function returns a non-dict,
unmapping would fail anyway.
Some extra mechanism is added so we can continue to use XComArg like we
do right now, but also prevent TransformedXComArg from needing to
inherit a lot of the old XComArg nonsense like __str__ and __getitem__.
@uranusjr uranusjr merged commit 877dc89 into apache:main Jul 25, 2022
@uranusjr uranusjr deleted the aip-42-xcom-arg-map branch July 25, 2022 03:41
AIP-42: Dynamic Task Mapping automation moved this from In progress to Done Jul 25, 2022
@ephraimbuddy ephraimbuddy added the type:new-feature Changelog: New Features label Aug 15, 2022
@ephraimbuddy ephraimbuddy added this to the Airflow 2.4.0 milestone Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dynamic-task-mapping AIP-42 type:new-feature Changelog: New Features
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants