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

Support multiple XCom output in the BaseOperator #37297

Merged
merged 4 commits into from
Feb 12, 2024

Conversation

hussein-awala
Copy link
Member

closes: #37284

This PR adds a new argument multiple_outputs to BaseOperator to push multiple XCom when it set to True instead of pushing the result to return_value XCom.

@jannisko
Copy link
Contributor

Thanks for jumping on this request! @hussein-awala
I was kind of hoping to contribute myself but I guess I was too slow 😄

@jannisko
Copy link
Contributor

The implementation for the taskflow decorator seems to return the xcoms separately (with different keys) and in its original form with the default key:
image
I'm not sure if it makes sense to recreate this behavior.

@hussein-awala
Copy link
Member Author

I'm not sure if it makes sense to recreate this behavior.

Yes, we can do that. I wonder if we need to duplicate all the behaviors, for example, inferring multiple_outputs (#20800) when the execute method has a mapping as the returned value type.

@jannisko
Copy link
Contributor

Yes, we can do that. I wonder if we need to duplicate all the behaviors, for example, inferring multiple_outputs (#20800) when the execute method has a mapping as the returned value type.

I didn't actually notice that there was type-hint based inferral until now 😄
I feel like this feature is too niche to warrant introducing a breaking change to all operators though.

@potiuk
Copy link
Member

potiuk commented Feb 10, 2024

I didn't actually notice that there was type-hint based inferral until now 😄
I feel like this feature is too niche to warrant introducing a breaking change to all operators though.

Yep. Author of the classic operator should make the decision on their own if they want to return multiple_outputs or not.

@hussein-awala hussein-awala merged commit cdd1a48 into apache:main Feb 12, 2024
56 checks passed
@JoyceChan-KSO
Copy link

Hi, I think this feature been added by airflow 2.0 + version
image
https://airflow.apache.org/docs/apache-airflow/2.0.0/concepts.html

is this feature dropped before?

@jannisko
Copy link
Contributor

@JoyceChan-KSO yes this feature was available for the TaskFlow style operators already, but missing for the classic operators inheriting from BaseOperator (see original issue) 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add multiple_outputs option to PythonOperator
6 participants