-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(sdk): Get short name of complex input/output types to ensure we can map to appropriate de|serializer #6504
fix(sdk): Get short name of complex input/output types to ensure we can map to appropriate de|serializer #6504
Conversation
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.
@alexlatchford Thank you for the contribution.
Can you please add an entry under https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md#current-version-still-in-development
42110d9
to
3a566aa
Compare
Hey @chensun thanks for the review, I think I've answered all feedback. Let me know if you need anything more from my end to get this merged 😄 |
/retest |
0f5e100
to
2ea2ae9
Compare
…appropriate de|serializer Also: - Simplify _data_passing methods, add in type hints and docstrings. - Remove get_deserializer_code_for_type.
2ea2ae9
to
43efad8
Compare
Just fixed the conflicts on this one @chensun so should be ready once the tests pass! |
/lgtm Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…an map to appropriate de|serializer (kubeflow#6504) Also: - Simplify _data_passing methods, add in type hints and docstrings. - Remove get_deserializer_code_for_type.
…an map to appropriate de|serializer (kubeflow#6504) Also: - Simplify _data_passing methods, add in type hints and docstrings. - Remove get_deserializer_code_for_type.
Description of your changes:
The problem is that to turn an input value like
"[]"
into apython
List
type you need to use something likejson.loads
. To tellargparse.ArgumentParser
to usejson.loads
kfp
must be able to map the input type to this deserializer function, it does this in theget_deserializer_code_for_type_struct
method (see code here). Unfortunately thetype_name_to_deserializer
cannot possibly contain all theList[<type>]
combinations so if you have a type hint that usesList[str]
instead of justList
you need to run thetype_annotation_utils.get_short_type_name
to stripList[<type>]
to justList
so we can map to the appropriate serializer method. The same logic applies forDict[<type>]
toDict
too.This is behavior that changed in Python v3.7+, KFP have been fixing various issues around this since then, see these PRs:
typing.Optional
#5716typing
type hints #5153