-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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 XComArg concat() #40172
Implement XComArg concat() #40172
Conversation
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.
To be honest, I'm not completely convinced of the importance of this feature, but it might be useful in some case.
Could you update the documentation by describing the new XCom operation chain
?
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.
My initial reaction was the semantics could be confused with a TaskFlow-specific implementation of airflow.models.baseoperator.chain
but it doesn't function the same way. This seems to mirror itertools.chain()
, but because there is already a chain()
method at the operator level we might need a different semantic? Maybe .combine()
is another option?
Curious what others think too.
This is cool, and I would definitely use this personally.
Oddly enough, this seems useful for the discussion in #40124? |
I briefly searched how other ecosystems call this and |
Maybe |
I don’t like |
Maybe just |
I think I’m going to go with |
SGTM |
Alright, I’ve made the name change and added docs. |
Very nice! BTW I think it's also interesting to be able to do thing against specific items in the XCOM rather than all of it. |
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.
Looks great!
Just curious if DAG authors would also be able to concat XComArgs from two sets of mapped tasks? If yes, then maybe worth adding to the docs too?
Not sure I follow this |
Related to a question I could think of DAG authors asking: "Does this work with mapped-task inputs?". graph LR;
mapped_task_1-->aggregate_mapped_tasks;
mapped_task_2-->aggregate_mapped_tasks;
meaning aggregate_mapped_tasks(input=mapped_task_1.concat(mapped_task_2)) Looking again the "... |
I added some text to call out chaining calls. |
This is useful when you want to do a thing against more than one list of things. You can sort of already do this with an extra task, but this is lazier and saves some resources both in the XCom storage and memory needed to run tasks.