-
Notifications
You must be signed in to change notification settings - Fork 671
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
Remove LiteralTypeForLiteral
by creating IsInstance
function
#5909
base: master
Are you sure you want to change the base?
Remove LiteralTypeForLiteral
by creating IsInstance
function
#5909
Conversation
Signed-off-by: Mecoli1219 <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5909 +/- ##
==========================================
- Coverage 36.97% 36.92% -0.06%
==========================================
Files 1318 1318
Lines 132506 132547 +41
==========================================
- Hits 48994 48942 -52
- Misses 79256 79345 +89
- Partials 4256 4260 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
LiteralTypeForLiteral
by creating IsInstance
functionLiteralTypeForLiteral
by creating IsInstance
function
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 you test every test case be affected in flytekit remote?
and provide screenshot?
I think this function is not well tested by unit test and integration test.
if _, ok := lit.GetValue().(*core.Literal_Collection); !ok { | ||
return false | ||
} | ||
for _, x := range lit.GetCollection().Literals { |
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.
If we add the tuple literal type but still represent the literal as a collection, how do we check if this collection is a tuple or not
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.
The type of Literal for tuple will be Literal_Collection
, but the LiteralType won't. We'll have to create another new InstanceChecker
(perhaps tupleInstanceChecker
) to deal with that.
func IsInstance(lit *core.Literal, t *core.LiteralType) bool { | ||
instanceChecker := getInstanceChecker(t) | ||
|
||
if lit.GetOffloadedMetadata() != nil { |
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.
i'd add a condition here to make sure the field is actually present.
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.
sorry incomplete review... will get back to this later.
Signed-off-by: Mecoli1219 <[email protected]>
Signed-off-by: Mecoli1219 <[email protected]>
@Future-Outlier I tested the IsInstance with the flytekit's unit tests and integration tests. I couldn't run eager in my environment, and it is not related to this update. Besides that, all test works successfully. |
Signed-off-by: Mecoli1219 <[email protected]>
LiteralTypeForLiteral
by creating IsInstance
functionLiteralTypeForLiteral
by creating IsInstance
function
Tracking issue
#5908
Why are the changes needed?
The current Tuple IDL design is complicated by this function since if we want to guess the
LiteralType
fromLiteral
, we have to store the name of the tuple and the name of each field inside the tuple in theLiteral
.However, guessing the
LiteralType
is not necessary for Flyte since whenever we create a new literal, there must be a target type (maybe inputs or outputs, but they will always have a defined type). Also, almost all use cases ofLiteralTypeForLiteral
are followed by a functionAreTypesCastable
, we could simply combine these two functions into a function determining whether a Literal could be instantiated by a LiteralType. It is really similar toisinstance()
function in Python.What changes were proposed in this pull request?
IsInstance()
for the flytepropeller to check whether a Literal could be represented by a LiteralType.LiteralTypeForLiteral
and update all necessary code in FlyteAdmin & FlytePropeller.LiteralTypeForLiteral
toIsInstance
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Additional Concerns
Someone suggested that we shouldn't merge this PR before the release