Skip to content

Commit

Permalink
update pingsu's nit advice
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Sep 25, 2024
1 parent c9616ca commit 6e6d449
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flytepropeller/pkg/controller/nodes/attr_path_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"github.com/flyteorg/flyte/flytepropeller/pkg/controller/nodes/errors"
)

const messagepack = "msgpack"

// resolveAttrPathInPromise resolves the literal with attribute path
// If the promise is chained with attributes (e.g. promise.a["b"][0]), then we need to resolve the promise
func resolveAttrPathInPromise(nodeID string, literal *core.Literal, bindAttrPath []*core.PromiseAttribute) (*core.Literal, error) {
Expand Down Expand Up @@ -41,13 +43,11 @@ func resolveAttrPathInPromise(nodeID string, literal *core.Literal, bindAttrPath
// resolve dataclass and Pydantic BaseModel
if scalar := currVal.GetScalar(); scalar != nil {
if binary := scalar.GetBinary(); binary != nil {
// Start from index "count"
currVal, err = resolveAttrPathInBinary(nodeID, binary, bindAttrPath[count:])
if err != nil {
return nil, err
}
} else if generic := scalar.GetGeneric(); generic != nil {
// Start from index "count"
currVal, err = resolveAttrPathInPbStruct(nodeID, generic, bindAttrPath[count:])
if err != nil {
return nil, err
Expand Down Expand Up @@ -104,7 +104,7 @@ func resolveAttrPathInBinary(nodeID string, binaryIDL *core.Binary, bindAttrPath
var tmpVal interface{}
var exist bool

if serializationFormat == "msgpack" {
if serializationFormat == messagepack {
err := msgpack.Unmarshal(binaryBytes, &currVal)
if err != nil {
return nil, err

Check warning on line 110 in flytepropeller/pkg/controller/nodes/attr_path_resolver.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/attr_path_resolver.go#L110

Added line #L110 was not covered by tests
Expand Down Expand Up @@ -135,7 +135,7 @@ func resolveAttrPathInBinary(nodeID string, binaryIDL *core.Binary, bindAttrPath
}
}

if serializationFormat == "msgpack" {
if serializationFormat == messagepack {
// Marshal the current value to MessagePack bytes
resolvedBinaryBytes, err := msgpack.Marshal(currVal)
if err != nil {
Expand Down

0 comments on commit 6e6d449

Please sign in to comment.