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

Fix TIPydantic serialization of MappedOperator #39288

Conversation

dstandish
Copy link
Contributor

Previously we relied on SerializedBaseOperator.serialize_operator for serialization of all Operator objects but this is no bueno because it does not work for mapped operator. Instead we use BaseSerialization.serialize, which calls the right method for each obj type. To make this actually work for db isolation though, we had to do a few more things. 1. operator_class obj was not deserialized properly so fixed that. It's a weird case cus it roundtrips to a dict -- not a class. Also expand_input did not work quite right because it roundtrips to _ExpandInputRef. Then we had to make a small change to get_map_type_key since we might have _ExpandInputRef here.

Previously we relied on SerializedBaseOperator.serialize_operator for serialization of all Operator objects but this is no bueno because it does not work for mapped operator.  Instead we use BaseSerialization.serialize, which calls the right method for each obj type.  To make this actually work for db isolation though, we had to do a few more things.  1. operator_class obj was not deserialized properly so fixed that. It's a weird case cus it roundtrips to a dict -- not a class.  Also expand_input did not work quite right because it roundtrips to _ExpandInputRef.  Then we had to make a small change to get_map_type_key since we might have _ExpandInputRef here.

(cherry picked from commit 65748fa)
Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could be great to add unit tests associated to changes in models

@dstandish
Copy link
Contributor Author

@uranusjr do you have any concerns with this PR?

@dstandish
Copy link
Contributor Author

@uranusjr just going to merge this for now; if you look and find issues, we can make changes.

@dstandish dstandish merged commit c2f1739 into apache:main May 24, 2024
41 checks passed
@dstandish dstandish deleted the fix-tipydantic-serialization-of-mappedoperator branch May 24, 2024 21:04
@potiuk
Copy link
Member

potiuk commented May 26, 2024

Hey @dstandish -> this one has been merged without rebasing after it has not been run for a month or so and it broke main quite heavily. I will revert it now and it should be re-created and fixed

potiuk added a commit to potiuk/airflow that referenced this pull request May 26, 2024
@potiuk
Copy link
Member

potiuk commented May 26, 2024

Update - it was not a month, but I think it has clashed with other changes in the meantime.

@potiuk
Copy link
Member

potiuk commented May 26, 2024

I will also see if I can fix those issues in paralell, while checking if this is indeed the problem - so I might be able to fix it.

potiuk added a commit to potiuk/airflow that referenced this pull request May 26, 2024
The apache#39288 clashed with another change and failed main
potiuk added a commit that referenced this pull request May 26, 2024
The #39288 clashed with another change and failed main
RNHTTR pushed a commit to RNHTTR/airflow that referenced this pull request Jun 1, 2024
Previously we relied on SerializedBaseOperator.serialize_operator for serialization of all Operator objects but this is no bueno because it does not work for mapped operator.  Instead we use BaseSerialization.serialize, which calls the right method for each obj type.  To make this actually work for db isolation though, we had to do a few more things.  1. operator_class obj was not deserialized properly so fixed that. It's a weird case cus it roundtrips to a dict -- not a class.  Also expand_input did not work quite right because it roundtrips to _ExpandInputRef.  Then we had to make a small change to get_map_type_key since we might have _ExpandInputRef here.
RNHTTR pushed a commit to RNHTTR/airflow that referenced this pull request Jun 1, 2024
@utkarsharma2 utkarsharma2 added the type:bug-fix Changelog: Bug Fixes label Jun 3, 2024
@ephraimbuddy ephraimbuddy added this to the Airflow 2.10.0 milestone Jun 3, 2024
@utkarsharma2 utkarsharma2 added AIP-44 Airflow Internal API changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) and removed type:bug-fix Changelog: Bug Fixes labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AIP-44 Airflow Internal API area:serialization changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants