-
Notifications
You must be signed in to change notification settings - Fork 311
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
Refactor extract_types in Dict Transformer #3124
Refactor extract_types in Dict Transformer #3124
Conversation
Signed-off-by: Future-Outlier <[email protected]>
Code Review Agent Run #f8e289Actionable Suggestions - 1
Additional Suggestions - 1
Review Details
|
Signed-off-by: Future-Outlier <[email protected]>
Changelist by BitoThis pull request implements the following key changes.
|
"t,expected,allow_pickle", | ||
[ | ||
(None, (None, None)), | ||
(typing.Dict, ()), | ||
(typing.Dict[str, str], (str, str)), | ||
(None, (None, None), False), | ||
(typing.Dict, (), False), | ||
(typing.Dict[str, str], (str, str), False), | ||
( | ||
Annotated[typing.Dict[str, str], kwtypes(allow_pickle=True)], | ||
(str, str), | ||
Annotated[typing.Dict[str, str], kwtypes(allow_pickle=True)], | ||
(str, str), | ||
True, | ||
), | ||
(typing.Dict[Annotated[str, "a-tag"], int], (Annotated[str, "a-tag"], int)), | ||
(typing.Dict[Annotated[str, "a-tag"], int], (Annotated[str, "a-tag"], int), False), | ||
], | ||
) | ||
def test_dict_get(t, expected): | ||
def test_dict_get(t, expected, allow_pickle): | ||
assert DictTransformer.extract_types(t) == expected | ||
|
||
assert DictTransformer.is_pickle(t) == allow_pickle |
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.
This is a follow up for your PR, your PR make sense to me
#3123
Code Review Agent Run Status
|
Can you also add a test to cover the case described in flyteorg/flyte#6057? |
# If this is something like Annotated[dict[int, str], FlyteAnnotation("abc")], | ||
# we need to check if there's a FlyteAnnotation in the metadata. | ||
if _origin is Annotated: | ||
if not _args: |
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.
Can add a comment saying this should never happen. Python errors if you try to do Annotated[dict[str, str]]
with
TypeError: Annotated[...] should be used with at least two arguments (a type and an annotation).
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.
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
|
Code Review Agent Run #059fd1Actionable Suggestions - 0Additional Suggestions - 10
Review Details
|
Signed-off-by: Future-Outlier <[email protected]>
Code Review Agent Run #08028aActionable Suggestions - 1
Review Details
|
Tracking issue
#3123
Why are the changes needed?
is_pickle
functionextract_types
What changes were proposed in this pull request?
is_pickle
in the above PR.How was this patch tested?
unit test.
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This PR enhances Flytekit's type system with improved DictTransformer class and dictionary handling, while also upgrading the remote execution test suite. Key changes include new cache management system, expanded remote execution capabilities, and improved error logging with conditional display logic for better debugging visibility. The implementation covers msgpack encoding, pod template handling, and comprehensive test coverage.Unit tests added: True
Estimated effort to review (1-5, lower is better): 5