Skip to content

Commit

Permalink
#minor Revert "Adopt flyteidl's ordered variable map change flyteorg#198
Browse files Browse the repository at this point in the history
" (flyteorg#207)

* Revert "Adopt flyteidl's ordered variable map change (flyteorg#198)"

This reverts commit 5a8e120

Signed-off-by: Sean Lin <[email protected]>
  • Loading branch information
mayitbeegh authored Sep 9, 2021
1 parent 298278f commit 28fec54
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 340 deletions.
2 changes: 1 addition & 1 deletion flyteplugins/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/aws/aws-sdk-go-v2/config v1.0.0
github.com/aws/aws-sdk-go-v2/service/athena v1.0.0
github.com/coocood/freecache v1.1.1
github.com/flyteorg/flyteidl v0.20.1
github.com/flyteorg/flyteidl v0.21.0
github.com/flyteorg/flytestdlib v0.3.33
github.com/go-logr/zapr v0.4.0 // indirect
github.com/go-test/deep v1.0.7
Expand Down
4 changes: 2 additions & 2 deletions flyteplugins/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/flyteorg/flyteidl v0.20.1 h1:S+jJBmtRtzUcLNAgXJNsVza/6SRS/cmtKu/zAUvC6+U=
github.com/flyteorg/flyteidl v0.20.1/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U=
github.com/flyteorg/flyteidl v0.21.0 h1:AwHNusfxJMfRRSDk2QWfb3aIlyLJrFWVGtpXCbCtJ5A=
github.com/flyteorg/flyteidl v0.21.0/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U=
github.com/flyteorg/flytestdlib v0.3.13/go.mod h1:Tz8JCECAbX6VWGwFT6cmEQ+RJpZ/6L9pswu3fzWs220=
github.com/flyteorg/flytestdlib v0.3.33 h1:+oCx3zXUIldL7CWmNMD7PMFPXvGqaPgYkSKn9wB6qvY=
github.com/flyteorg/flytestdlib v0.3.33/go.mod h1:7cDWkY3v7xsoesFcDdu6DSW5Q2U2W5KlHUbUHSwBG1Q=
Expand Down
182 changes: 41 additions & 141 deletions flyteplugins/go/tasks/pluginmachinery/flytek8s/copilot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,9 @@ func TestDownloadCommandArgs(t *testing.T) {
assert.Error(t, err)

iFace := &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
}
d, err := DownloadCommandArgs("s3://from", "s3://output-meta", "/to", core.DataLoadingConfig_JSON, iFace)
Expand All @@ -131,10 +121,10 @@ func TestDownloadCommandArgs(t *testing.T) {
vm := &core.VariableMap{}
assert.NoError(t, proto.Unmarshal(serIFaceBytes, vm))
assert.Len(t, vm.Variables, 2)
for i, v := range iFace.Variables {
v2 := vm.Variables[i]
assert.Equal(t, v.Name, v2.Name, "for index %d, keys do not match", i)
assert.Equal(t, v.Var.Type.GetSimple(), v2.Var.Type.GetSimple(), "for %s, types do not match", v.Name)
for k, v := range iFace.Variables {
v2, ok := vm.Variables[k]
assert.True(t, ok)
assert.Equal(t, v.Type.GetSimple(), v2.Type.GetSimple(), "for %s, types do not match", k)
}
}
}
Expand All @@ -146,19 +136,9 @@ func TestSidecarCommandArgs(t *testing.T) {

iFace := &core.TypedInterface{
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand All @@ -176,10 +156,10 @@ func TestSidecarCommandArgs(t *testing.T) {
if2 := &core.TypedInterface{}
assert.NoError(t, proto.Unmarshal(serIFaceBytes, if2))
assert.Len(t, if2.Outputs.Variables, 2)
for i, v := range iFace.Outputs.Variables {
v2 := if2.Outputs.Variables[i]
assert.Equal(t, v.Name, v2.Name, "for index %d, keys do not match", i)
assert.Equal(t, v.Var.Type.GetSimple(), v2.Var.Type.GetSimple(), "for %s, types do not match", v.Name)
for k, v := range iFace.Outputs.Variables {
v2, ok := if2.Outputs.Variables[k]
assert.True(t, ok)
assert.Equal(t, v.Type.GetSimple(), v2.Type.GetSimple(), "for %s, types do not match", k)
}
}
}
Expand Down Expand Up @@ -378,29 +358,14 @@ func TestAddCoPilotToContainer(t *testing.T) {
c := v1.Container{}
iface := &core.TypedInterface{
Inputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "o",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"o": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand All @@ -415,29 +380,14 @@ func TestAddCoPilotToContainer(t *testing.T) {
c := v1.Container{}
iface := &core.TypedInterface{
Inputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "o",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"o": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand All @@ -456,19 +406,9 @@ func TestAddCoPilotToContainer(t *testing.T) {
c := v1.Container{}
iface := &core.TypedInterface{
Inputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand All @@ -487,13 +427,8 @@ func TestAddCoPilotToContainer(t *testing.T) {
c := v1.Container{}
iface := &core.TypedInterface{
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "o",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"o": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand Down Expand Up @@ -572,29 +507,14 @@ func TestAddCoPilotToPod(t *testing.T) {
pod := v1.PodSpec{}
iface := &core.TypedInterface{
Inputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "o",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"o": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand Down Expand Up @@ -624,19 +544,9 @@ func TestAddCoPilotToPod(t *testing.T) {
pod := v1.PodSpec{}
iface := &core.TypedInterface{
Inputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "x",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
{
Name: "y",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"x": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
"y": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand All @@ -654,13 +564,8 @@ func TestAddCoPilotToPod(t *testing.T) {
pod := v1.PodSpec{}
iface := &core.TypedInterface{
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "o",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"o": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand All @@ -678,13 +583,8 @@ func TestAddCoPilotToPod(t *testing.T) {
pod := v1.PodSpec{}
iface := &core.TypedInterface{
Outputs: &core.VariableMap{
Variables: []*core.VariableMapEntry{
{
Name: "o",
Var: &core.Variable{
Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}},
},
},
Variables: map[string]*core.Variable{
"o": {Type: &core.LiteralType{Type: &core.LiteralType_Simple{Simple: core.SimpleType_INTEGER}}},
},
},
}
Expand Down
25 changes: 0 additions & 25 deletions flyteplugins/go/tasks/pluginmachinery/utils/task.go

This file was deleted.

54 changes: 0 additions & 54 deletions flyteplugins/go/tasks/pluginmachinery/utils/task_test.go

This file was deleted.

Loading

0 comments on commit 28fec54

Please sign in to comment.