-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Ensuring XCom return value can be mapped for dynamically-mapped @task_group
's
#51556
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
Conversation
cc: @rawwar, do you mind taking a peek at this one? |
Why is the expected behavior that mapping over a custom key is forbidden? Would it possible to add a fix suggestion (or a doc link with fix suggestions) to the error message? It could be one of the following:
|
Custom keys were forbidden to reduce the workload (both design and implementation) when the feature was initially rolled out. Feel free to open an issue to discuss how it can happen and propose an implementation. |
From @rawwar, moving this here.
I verified this in 3.x - I will make sure to create a PR to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be done in a separate PR, but the pattern I noticed is we’re always creating an ExpandInput object, and call this ensure function immediately afterwards. Maybe we should call the function in the class’s init instead.
#51109 outlined an issue where trying to dynamically map over an XCom return value using a custom key resulted in unexpected behavior. Rather than leveraging the
list
that was stored at that key, it would dynamically-map TaskGroups using the key-value pairs in the return value itself.This PR addresses this by applying the same logic present in the
_TaskDecorator
class to_TaskGroupFactory
. When attempting to map over a list stored via a keyb
in thedict return value of a Task
t`, the following exception will be raised:Rather than the faulty logic outlined in #51109, the DAG will fail to parse. This matches the same behavior as
@task
. This logic was implemented for both.expand()
and.expand_kwargs()
.To test this, the following DAG was written. The result is now a DAG Import Error, with the stack trace below.