-
Notifications
You must be signed in to change notification settings - Fork 619
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
[Flyte][3][flytepropeller][Attribute Access][flytectl] Binary IDL With MessagePack #5763
Conversation
Signed-off-by: Future-Outlier <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5763 +/- ##
==========================================
+ Coverage 36.31% 36.35% +0.03%
==========================================
Files 1304 1304
Lines 110072 110147 +75
==========================================
+ Hits 39974 40044 +70
Misses 65936 65936
- Partials 4162 4167 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
t.Run("Generic", func(t *testing.T) { | ||
literalVal := map[string]interface{}{ | ||
"x": 1, | ||
"y": "ystringvalue", | ||
} | ||
var literalType = &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_STRUCT}} | ||
lit, err := MakeLiteralForType(literalType, literalVal) |
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]>
@@ -559,12 +562,35 @@ func MakeLiteralForType(t *core.LiteralType, v interface{}) (*core.Literal, erro | |||
strValue = fmt.Sprintf("%.0f", math.Trunc(f)) | |||
} | |||
if newT.Simple == core.SimpleType_STRUCT { | |||
// If the type is a STRUCT, we expect the input to be a complex object |
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.
will this not break if the clients or otherside have the old view of struct?
i.e, this seems backwards incompatible?
cc @EngHabu
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 will not break JSON string
case, since this is not a string type.
Signed-off-by: Future-Outlier <[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.
Hey @Future-Outlier, what happens if a new flytekit produced a msgpack and old flytekit tried to consume it?
@@ -11,14 +12,16 @@ import ( | |||
"github.com/flyteorg/flyte/flytestdlib/storage" | |||
) | |||
|
|||
const messagepack = "msgpack" |
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.
Please move this const to one place and reference it everywhere...
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'll move it now.
switch resolvedVal := currVal.(type) { | ||
// map | ||
case map[interface{}]interface{}: | ||
tmpVal, exist = resolvedVal[attr.GetStringValue()] |
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.
What will GetStringValue() return if if the attr is foo[0]
? shouldn't it fail in that case and say "you can't index into a struct" or something ?
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.
currVal = tmpVal | ||
// list | ||
case []interface{}: | ||
if int(attr.GetIntValue()) >= len(resolvedVal) { |
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.
ditto here. If it's foo.bar
GetIntValue() will return 0 I presume? it should fail here too
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.
yes, GetIntValue() will return 0
, but foo.bar
will go to the up map
case, so it will called attr.GetStringValue
to get the bar
attribute
// Unsupported serialization format | ||
return nil, errors.Errorf(errors.PromiseAttributeResolveError, nodeID, | ||
"Unsupported format '%v' found for literal value.\n"+ | ||
"Please ensure the serialization format is supported.", serializationFormat) |
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 case can never happen, right? since you checked for that early on
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.
Yes, I can remove it
upstream output (msgpack) -> downstream input (msgpack) This will fail when executing the pod plugin, but not crashed the propeller. |
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Details about 1: @dataclass
class DC2:
a: float
b: DC
c: List[DC]
d: Dict[int, DC]
o = DC2()
x=o.d[1].a # This should be `int` type, but will return `Struct` type when using `get literal type` function. |
…h MessagePack (flyteorg#5763) Signed-off-by: Siddhant Rai <[email protected]>
Tracking Issue
Issue #5318
Why are these changes needed?
flytectl
to create and get executions.Note: This PR includes handling of primitive types, Flyte types, and dataclasses.
What changes are proposed in this pull request?
Attribute Access
msgpack
bytes inBinary Literal
.Binary Literal
.flytectl
flytectl
, serialize it tomsgpack
bytes and create a binary scalar directly.This version is more concise, avoids redundant words, and clarifies the structure a bit.
How was this patch tested?
Attribute Access
unit tests and remote execution
flytectl
command line
get_task.yaml
Setup process
single binary
Screenshots
Local Execution
Remote Execution
Check all the applicable boxes