Allowing dataclasses which require list protobuf deserialization#2614
Allowing dataclasses which require list protobuf deserialization#2614JackUrb wants to merge 5 commits into
Conversation
Signed-off-by: JackUrb <jack@datologyai.com>
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 <jack@datologyai.com>
Signed-off-by: JackUrb <jack@datologyai.com>
pingsutw
left a comment
There was a problem hiding this comment.
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.
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.
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_literalmethod. If the_MessageToDictmethod returns alistinstead of adict, rather than try to construct a protobufStruct(which can't be done for a list), we use a separate_handle_list_literalmethod, which ultimately treats the processing more similarly to theListTransformer.An additional change is made to the
assert_typemethod to avoid an issue where theisinstanceclause was unnecessarily evaluated (due to the logic ordering) in cases where the typetcould be a generic (for which the assertion errorisinstance() argument 2 cannot be a parameterized genericwould be thrown). Swapping the logic order means that ifget_originis not None (which occurs in parameterized generics), theisinstancewill not be called.How was this patch tested?
Adds a new test to the
TypeEnginetesting,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