-
Notifications
You must be signed in to change notification settings - Fork 299
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
Allowing dataclasses which require list protobuf deserialization #2614
Conversation
Signed-off-by: JackUrb <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2614 +/- ##
===========================================
- Coverage 94.08% 45.00% -49.09%
===========================================
Files 32 223 +191
Lines 1842 20651 +18809
Branches 0 4012 +4012
===========================================
+ Hits 1733 9293 +7560
- Misses 109 11230 +11121
- Partials 0 128 +128 ☔ View full report in Codecov by Sentry. |
Signed-off-by: JackUrb <[email protected]>
Signed-off-by: JackUrb <[email protected]>
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.
thanks. overall lgtm. Some tests are failing in python 3.9. mind taking a look
struct.update(message_dict) | ||
except Exception: | ||
if isinstance(message_dict, list): | ||
return self._handle_list_literal(ctx, message_dict) |
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.
nit: could we do this?
if isinstance(message_dict, list):
return self._handle_list_literal(ctx, message_dict)
else:
struct.update(message_dict)
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.
Seems like yes, will update
@pingsutw I'm having a hard time telling quite why the test is failing in the narrow case of py3.9 tensorflow file conversion. Is there any retry logic somewhere else in flyte that effectively checks for successful conversion, and then does something else on failure? It's hard to navigate why this conversion is this specific case breaks, and the |
Note, it's possible this is entirely superseded by #2600 - @Future-Outlier happy to assist on that effort if extra hands would help. |
@JackUrb |
Indeed, this entire issue is resolved by flyteorg/flyte#5742. Very excited for v1.14.0 to come out! Thanks @Future-Outlier |
Tracking issue
closes flyteorg/flyte/issues/5593
closes flyteorg/flyte/issues/4581
Why are the changes needed?
As described in flyteorg/flyte/issues/5593, when handling the protobuf serialization/deserialization for a dataclass, attributes that are lists end up being deserialized to lists rather than dicts (despite the function being
_MessageToDict
).What changes were proposed in this pull request?
The primary change is to the
ProtobufTransformer
'sto_literal
method. If the_MessageToDict
method returns alist
instead of adict
, rather than try to construct a protobufStruct
(which can't be done for a list), we use a separate_handle_list_literal
method, which ultimately treats the processing more similarly to theListTransformer
.An additional change is made to the
assert_type
method to avoid an issue where theisinstance
clause was unnecessarily evaluated (due to the logic ordering) in cases where the typet
could be a generic (for which the assertion errorisinstance() argument 2 cannot be a parameterized generic
would be thrown). Swapping the logic order means that ifget_origin
is not None (which occurs in parameterized generics), theisinstance
will not be called.How was this patch tested?
Adds a new test to the
TypeEngine
testing,test_DataclassTransformer_for_list_attributes
.We've also been running this change locally for some time, and it has been stable.
Setup process
Screenshots
Check all the applicable boxes