From 0437b714d81ac32c5d696a69cd85f9d7a24256fb Mon Sep 17 00:00:00 2001 From: Haytham Abuelfutuh Date: Wed, 2 Jun 2021 14:17:42 -0700 Subject: [PATCH] Refactor to ensure branch node rename is consistent in all nodes and connections (#268) * Bump to pick up latest plugins (#267) Signed-off-by: Katrina Rogan Signed-off-by: Haytham Abuelfutuh * Reflect node id change in upstream and downstream connections Signed-off-by: Haytham Abuelfutuh * wip Signed-off-by: Haytham Abuelfutuh * fix lint issue Signed-off-by: Ketan Umare Signed-off-by: Haytham Abuelfutuh * Fix connections for branch nodes Signed-off-by: Haytham Abuelfutuh * Support mismatching interfaces for branches Signed-off-by: Haytham Abuelfutuh * only fail adding nodes in compiler transformer when nodes are different Signed-off-by: Haytham Abuelfutuh * remove replaceNodeID Signed-off-by: Haytham Abuelfutuh * Fix unit tests Signed-off-by: Haytham Abuelfutuh * Clean up commented code Signed-off-by: Haytham Abuelfutuh * bump DCO Signed-off-by: Haytham Abuelfutuh * Cleanup Signed-off-by: Haytham Abuelfutuh * Revert config.yaml Signed-off-by: Haytham Abuelfutuh * PR Comments Signed-off-by: Haytham Abuelfutuh Co-authored-by: Katrina Rogan Co-authored-by: Ketan Umare --- pkg/compiler/builders.go | 28 +- pkg/compiler/common/builder.go | 11 +- pkg/compiler/common/mocks/workflow_builder.go | 54 +- pkg/compiler/test/compiler_test.go | 151 +++- .../testdata/branch/compiled/success_1.json | 425 ++++++++++- .../branch/compiled/success_10_simple.json | 660 ++++++++++++++++++ .../testdata/branch/compiled/success_2.json | 475 ++++++++++++- .../testdata/branch/compiled/success_3.json | 454 +++++++++++- .../testdata/branch/compiled/success_4.json | 558 ++++++++++++++- .../testdata/branch/compiled/success_5.json | 585 +++++++++++++++- .../testdata/branch/compiled/success_6.json | 383 +++++++++- .../branch/compiled/success_7_nested.json | 470 ++++++++++++- .../branch/compiled/success_8_nested.json | 569 +++++++++++++++ .../branch/compiled/success_9_nested.json | 609 ++++++++++++++++ .../test/testdata/branch/k8s/success_1.json | 393 ++++++++++- .../branch/k8s/success_10_simple.json | 598 ++++++++++++++++ .../test/testdata/branch/k8s/success_2.json | 434 +++++++++++- .../test/testdata/branch/k8s/success_3.json | 419 ++++++++++- .../test/testdata/branch/k8s/success_4.json | 507 +++++++++++++- .../test/testdata/branch/k8s/success_5.json | 532 +++++++++++++- .../test/testdata/branch/k8s/success_6.json | 362 +++++++++- .../testdata/branch/k8s/success_7_nested.json | 446 +++++++++++- .../testdata/branch/k8s/success_8_nested.json | 527 ++++++++++++++ .../testdata/branch/k8s/success_9_nested.json | 550 +++++++++++++++ .../testdata/branch/success_10_simple.json | 489 +++++++++++++ .../testdata/branch/success_8_nested.json | 441 ++++++++++++ .../testdata/branch/success_9_nested.json | 453 ++++++++++++ pkg/compiler/transformers/k8s/node.go | 9 +- pkg/compiler/validators/bindings.go | 16 +- pkg/compiler/validators/bindings_test.go | 14 +- pkg/compiler/validators/branch.go | 27 +- pkg/compiler/validators/branch_test.go | 7 +- pkg/compiler/validators/interface.go | 4 + pkg/compiler/validators/interface_test.go | 7 +- pkg/compiler/validators/node.go | 9 +- pkg/compiler/validators/vars.go | 23 - pkg/compiler/workflow_compiler.go | 37 +- pkg/compiler/workflow_compiler_test.go | 7 +- 38 files changed, 11606 insertions(+), 137 deletions(-) create mode 100755 pkg/compiler/test/testdata/branch/compiled/success_10_simple.json create mode 100755 pkg/compiler/test/testdata/branch/compiled/success_8_nested.json create mode 100755 pkg/compiler/test/testdata/branch/compiled/success_9_nested.json create mode 100755 pkg/compiler/test/testdata/branch/k8s/success_10_simple.json create mode 100755 pkg/compiler/test/testdata/branch/k8s/success_8_nested.json create mode 100755 pkg/compiler/test/testdata/branch/k8s/success_9_nested.json create mode 100755 pkg/compiler/test/testdata/branch/success_10_simple.json create mode 100755 pkg/compiler/test/testdata/branch/success_8_nested.json create mode 100755 pkg/compiler/test/testdata/branch/success_9_nested.json diff --git a/pkg/compiler/builders.go b/pkg/compiler/builders.go index 01b6457eaf..e71d2c8a6a 100755 --- a/pkg/compiler/builders.go +++ b/pkg/compiler/builders.go @@ -1,6 +1,8 @@ package compiler import ( + "fmt" + "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" c "github.com/flyteorg/flytepropeller/pkg/compiler/common" ) @@ -12,12 +14,13 @@ type flyteNode = core.Node // A builder object for the Graph struct. This contains information the compiler uses while building the final Graph // struct. type workflowBuilder struct { - CoreWorkflow *flyteWorkflow - LaunchPlans map[c.WorkflowIDKey]c.InterfaceProvider - Tasks c.TaskIndex - downstreamNodes c.StringAdjacencyList - upstreamNodes c.StringAdjacencyList - Nodes c.NodeIndex + CoreWorkflow *flyteWorkflow + LaunchPlans map[c.WorkflowIDKey]c.InterfaceProvider + Tasks c.TaskIndex + downstreamNodes c.StringAdjacencyList + upstreamNodes c.StringAdjacencyList + Nodes c.NodeIndex + NodeBuilderIndex c.NodeIndex // These are references to all subgraphs and tasks passed to CompileWorkflow. They will be passed around but will // not show in their entirety in the final Graph. The required subset of these will be added to each subgraph as @@ -30,7 +33,7 @@ type workflowBuilder struct { func (w workflowBuilder) GetFailureNode() c.Node { if w.GetCoreWorkflow() != nil && w.GetCoreWorkflow().GetTemplate() != nil && w.GetCoreWorkflow().GetTemplate().FailureNode != nil { - return w.NewNodeBuilder(w.GetCoreWorkflow().GetTemplate().FailureNode) + return w.GetOrCreateNodeBuilder(w.GetCoreWorkflow().GetTemplate().FailureNode) } return nil @@ -52,8 +55,15 @@ func (w workflowBuilder) GetUpstreamNodes() c.StringAdjacencyList { return w.upstreamNodes } -func (w workflowBuilder) NewNodeBuilder(n *flyteNode) c.NodeBuilder { - return &nodeBuilder{flyteNode: n} +func (w workflowBuilder) GetOrCreateNodeBuilder(n *flyteNode) c.NodeBuilder { + address := fmt.Sprintf("%p", n) + if existingBuilder, found := w.NodeBuilderIndex[address]; found { + return existingBuilder + } + + newObj := &nodeBuilder{flyteNode: n} + w.NodeBuilderIndex[address] = newObj + return newObj } func (w workflowBuilder) GetNode(id c.NodeID) (node c.NodeBuilder, found bool) { diff --git a/pkg/compiler/common/builder.go b/pkg/compiler/common/builder.go index be65dd2dec..84238db910 100644 --- a/pkg/compiler/common/builder.go +++ b/pkg/compiler/common/builder.go @@ -11,6 +11,14 @@ const ( EndNodeID = "end-node" ) +type EdgeDirection uint8 + +const ( + EdgeDirectionBidirectional EdgeDirection = iota + EdgeDirectionDownstream + EdgeDirectionUpstream +) + //go:generate mockery -all -output=mocks -case=underscore // A mutable workflow used during the build of the intermediate layer. @@ -21,8 +29,9 @@ type WorkflowBuilder interface { AddUpstreamEdge(nodeProvider, nodeDependent NodeID) AddDownstreamEdge(nodeProvider, nodeDependent NodeID) AddNode(n NodeBuilder, errs errors.CompileErrors) (node NodeBuilder, ok bool) + AddEdges(n NodeBuilder, edgeDirection EdgeDirection, errs errors.CompileErrors) (ok bool) ValidateWorkflow(fg *core.CompiledWorkflow, errs errors.CompileErrors) (Workflow, bool) - NewNodeBuilder(n *core.Node) NodeBuilder + GetOrCreateNodeBuilder(n *core.Node) NodeBuilder } // A mutable node used during the build of the intermediate layer. diff --git a/pkg/compiler/common/mocks/workflow_builder.go b/pkg/compiler/common/mocks/workflow_builder.go index d2deaa10e7..806bf7789d 100644 --- a/pkg/compiler/common/mocks/workflow_builder.go +++ b/pkg/compiler/common/mocks/workflow_builder.go @@ -21,6 +21,38 @@ func (_m *WorkflowBuilder) AddDownstreamEdge(nodeProvider string, nodeDependent _m.Called(nodeProvider, nodeDependent) } +type WorkflowBuilder_AddEdges struct { + *mock.Call +} + +func (_m WorkflowBuilder_AddEdges) Return(ok bool) *WorkflowBuilder_AddEdges { + return &WorkflowBuilder_AddEdges{Call: _m.Call.Return(ok)} +} + +func (_m *WorkflowBuilder) OnAddEdges(n common.NodeBuilder, edgeDirection common.EdgeDirection, errs errors.CompileErrors) *WorkflowBuilder_AddEdges { + c := _m.On("AddEdges", n, edgeDirection, errs) + return &WorkflowBuilder_AddEdges{Call: c} +} + +func (_m *WorkflowBuilder) OnAddEdgesMatch(matchers ...interface{}) *WorkflowBuilder_AddEdges { + c := _m.On("AddEdges", matchers...) + return &WorkflowBuilder_AddEdges{Call: c} +} + +// AddEdges provides a mock function with given fields: n, edgeDirection, errs +func (_m *WorkflowBuilder) AddEdges(n common.NodeBuilder, edgeDirection common.EdgeDirection, errs errors.CompileErrors) bool { + ret := _m.Called(n, edgeDirection, errs) + + var r0 bool + if rf, ok := ret.Get(0).(func(common.NodeBuilder, common.EdgeDirection, errors.CompileErrors) bool); ok { + r0 = rf(n, edgeDirection, errs) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + // AddExecutionEdge provides a mock function with given fields: nodeFrom, nodeTo func (_m *WorkflowBuilder) AddExecutionEdge(nodeFrom string, nodeTo string) { _m.Called(nodeFrom, nodeTo) @@ -481,26 +513,26 @@ func (_m *WorkflowBuilder) GetUpstreamNodes() common.StringAdjacencyList { return r0 } -type WorkflowBuilder_NewNodeBuilder struct { +type WorkflowBuilder_GetOrCreateNodeBuilder struct { *mock.Call } -func (_m WorkflowBuilder_NewNodeBuilder) Return(_a0 common.NodeBuilder) *WorkflowBuilder_NewNodeBuilder { - return &WorkflowBuilder_NewNodeBuilder{Call: _m.Call.Return(_a0)} +func (_m WorkflowBuilder_GetOrCreateNodeBuilder) Return(_a0 common.NodeBuilder) *WorkflowBuilder_GetOrCreateNodeBuilder { + return &WorkflowBuilder_GetOrCreateNodeBuilder{Call: _m.Call.Return(_a0)} } -func (_m *WorkflowBuilder) OnNewNodeBuilder(n *core.Node) *WorkflowBuilder_NewNodeBuilder { - c := _m.On("NewNodeBuilder", n) - return &WorkflowBuilder_NewNodeBuilder{Call: c} +func (_m *WorkflowBuilder) OnGetOrCreateNodeBuilder(n *core.Node) *WorkflowBuilder_GetOrCreateNodeBuilder { + c := _m.On("GetOrCreateNodeBuilder", n) + return &WorkflowBuilder_GetOrCreateNodeBuilder{Call: c} } -func (_m *WorkflowBuilder) OnNewNodeBuilderMatch(matchers ...interface{}) *WorkflowBuilder_NewNodeBuilder { - c := _m.On("NewNodeBuilder", matchers...) - return &WorkflowBuilder_NewNodeBuilder{Call: c} +func (_m *WorkflowBuilder) OnGetOrCreateNodeBuilderMatch(matchers ...interface{}) *WorkflowBuilder_GetOrCreateNodeBuilder { + c := _m.On("GetOrCreateNodeBuilder", matchers...) + return &WorkflowBuilder_GetOrCreateNodeBuilder{Call: c} } -// NewNodeBuilder provides a mock function with given fields: n -func (_m *WorkflowBuilder) NewNodeBuilder(n *core.Node) common.NodeBuilder { +// GetOrCreateNodeBuilder provides a mock function with given fields: n +func (_m *WorkflowBuilder) GetOrCreateNodeBuilder(n *core.Node) common.NodeBuilder { ret := _m.Called(n) var r0 common.NodeBuilder diff --git a/pkg/compiler/test/compiler_test.go b/pkg/compiler/test/compiler_test.go index 0806f1ceb4..3b7249f64c 100644 --- a/pkg/compiler/test/compiler_test.go +++ b/pkg/compiler/test/compiler_test.go @@ -10,6 +10,8 @@ import ( "strings" "testing" + "k8s.io/apimachinery/pkg/util/sets" + "github.com/go-test/deep" "github.com/ghodss/yaml" @@ -182,6 +184,113 @@ func TestDynamic(t *testing.T) { })) } +func getAllSubNodeIDs(n *core.Node) sets.String { + res := sets.NewString() + if branchNode := n.GetBranchNode(); branchNode != nil { + thenNode := branchNode.IfElse.Case.ThenNode + if hasPromiseInputs(thenNode.GetInputs()) { + res.Insert(thenNode.GetId()) + } + + res = res.Union(getAllSubNodeIDs(thenNode)) + + for _, other := range branchNode.IfElse.Other { + if hasPromiseInputs(other.ThenNode.GetInputs()) { + res.Insert(other.ThenNode.GetId()) + } + + res = res.Union(getAllSubNodeIDs(other.ThenNode)) + } + + if elseNode := branchNode.IfElse.GetElseNode(); elseNode != nil { + if hasPromiseInputs(elseNode.GetInputs()) { + res.Insert(elseNode.GetId()) + } + + res = res.Union(getAllSubNodeIDs(elseNode)) + } + } + + // TODO: Support Sub workflow + + return res +} + +type nodePredicate func(n *core.Node) bool + +var hasPromiseNodePredicate = func(n *core.Node) bool { + return hasPromiseInputs(n.GetInputs()) +} + +var allNodesPredicate = func(n *core.Node) bool { + return true +} + +func getAllMatchingNodes(wf *core.CompiledWorkflow, predicate nodePredicate) sets.String { + s := sets.NewString() + for _, n := range wf.Template.Nodes { + if predicate(n) { + s.Insert(n.GetId()) + } + + s = s.Union(getAllSubNodeIDs(n)) + } + + return s +} + +func bindingHasPromiseInputs(binding *core.BindingData) bool { + switch v := binding.GetValue().(type) { + case *core.BindingData_Collection: + for _, d := range v.Collection.Bindings { + if bindingHasPromiseInputs(d) { + return true + } + } + case *core.BindingData_Map: + for _, d := range v.Map.Bindings { + if bindingHasPromiseInputs(d) { + return true + } + } + case *core.BindingData_Promise: + return true + } + + return false +} + +func hasPromiseInputs(bindings []*core.Binding) bool { + for _, b := range bindings { + if bindingHasPromiseInputs(b.Binding) { + return true + } + } + + return false +} + +func assertNodeIDsInConnections(t testing.TB, nodeIDsWithDeps, allNodeIDs sets.String, connections *core.ConnectionSet) bool { + actualNodeIDs := sets.NewString() + for id, lst := range connections.Downstream { + actualNodeIDs.Insert(id) + actualNodeIDs.Insert(lst.Ids...) + } + + for id, lst := range connections.Upstream { + actualNodeIDs.Insert(id) + actualNodeIDs.Insert(lst.Ids...) + } + + notFoundInConnections := nodeIDsWithDeps.Difference(actualNodeIDs) + correct := assert.Empty(t, notFoundInConnections, "All nodes must appear in connections") + + notFoundInNodes := actualNodeIDs.Difference(allNodeIDs) + correct = correct && assert.Empty(t, notFoundInNodes, "All connections must correspond to existing nodes") + + return correct +} + func TestBranches(t *testing.T) { errors.SetConfig(errors.Config{IncludeSource: true}) assert.NoError(t, filepath.Walk("testdata/branch", func(path string, info os.FileInfo, err error) error { @@ -195,16 +304,36 @@ func TestBranches(t *testing.T) { t.Run(path, func(t *testing.T) { // If you want to debug a single use-case. Uncomment this line. - //if !strings.HasSuffix(path, "success_1.json") { + //if !strings.HasSuffix(path, "success_8_nested.json") { // t.SkipNow() //} raw, err := ioutil.ReadFile(path) assert.NoError(t, err) wf := &core.WorkflowClosure{} - err = jsonpb.UnmarshalString(string(raw), wf) - if !assert.NoError(t, err) { - t.FailNow() + if filepath.Ext(path) == ".json" { + err = jsonpb.UnmarshalString(string(raw), wf) + if !assert.NoError(t, err) { + t.FailNow() + } + } else if filepath.Ext(path) == ".pb" { + err = proto.Unmarshal(raw, wf) + if !assert.NoError(t, err) { + t.FailNow() + } + + m := &jsonpb.Marshaler{ + Indent: " ", + } + raw, err := m.MarshalToString(wf) + if !assert.NoError(t, err) { + t.FailNow() + } + + err = ioutil.WriteFile(strings.TrimSuffix(path, filepath.Ext(path))+".json", []byte(raw), os.ModePerm) + if !assert.NoError(t, err) { + t.FailNow() + } } t.Log("Compiling Workflow") @@ -215,8 +344,10 @@ func TestBranches(t *testing.T) { t.FailNow() } - marshaler := jsonpb.Marshaler{} - rawStr, err := marshaler.MarshalToString(compiledWfc) + m := &jsonpb.Marshaler{ + Indent: " ", + } + rawStr, err := m.MarshalToString(compiledWfc) if !assert.NoError(t, err) { t.Fail() } @@ -238,6 +369,12 @@ func TestBranches(t *testing.T) { } } + allNodeIDs := getAllMatchingNodes(compiledWfc.Primary, allNodesPredicate) + nodeIDsWithDeps := getAllMatchingNodes(compiledWfc.Primary, hasPromiseNodePredicate) + if !assertNodeIDsInConnections(t, nodeIDsWithDeps, allNodeIDs, compiledWfc.Primary.Connections) { + t.FailNow() + } + inputs := map[string]interface{}{} for varName, v := range compiledWfc.Primary.Template.Interface.Inputs.Variables { inputs[varName] = coreutils.MustMakeDefaultLiteralForType(v.Type) @@ -252,7 +389,7 @@ func TestBranches(t *testing.T) { }, "namespace") if assert.NoError(t, err) { - raw, err := json.Marshal(flyteWf) + raw, err := json.MarshalIndent(flyteWf, "", " ") if assert.NoError(t, err) { assert.NotEmpty(t, raw) } diff --git a/pkg/compiler/test/testdata/branch/compiled/success_1.json b/pkg/compiler/test/testdata/branch/compiled/success_1.json index e9fd78dd47..c8a5e81182 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_1.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_1.json @@ -1 +1,424 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"project","domain":"domain","name":"test_serialization.my_wf","version":"version"},"metadata":{},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}]},{"id":"node-0","metadata":{"name":"test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}},{"id":"node-1","metadata":{"name":"test1","retries":{},"interruptible":false},"inputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"upstreamNodeIds":["node-0"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"out_0"},"rightValue":{"primitive":{"integer":"1"}}}},"thenNode":{"id":"node-1-branchnode-0","metadata":{"name":"test_serialization.t2","retries":{},"interruptible":false},"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"}}}},"error":{"failedNodeId":"test1","message":"Unable to choose branch"}}}}],"outputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"node-0":{"ids":["node-1"]},"node-1":{"ids":["end-node"]},"start-node":{"ids":["node-0"]}},"upstream":{"end-node":{"ids":["node-1"]},"node-0":{"ids":["start-node"]},"node-1":{"ids":["node-0"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "project", + "domain": "domain", + "name": "test_serialization.my_wf", + "version": "version" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ] + }, + { + "id": "node-0", + "metadata": { + "name": "test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + }, + { + "id": "node-1", + "metadata": { + "name": "test1", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "out_0" + }, + "rightValue": { + "primitive": { + "integer": "1" + } + } + } + }, + "thenNode": { + "id": "node-1-branchnode-0", + "metadata": { + "name": "test_serialization.t2", + "retries": { + + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + } + } + } + }, + "error": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + } + } + } + ], + "outputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "node-0": { + "ids": [ + "node-1" + ] + }, + "node-1": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "node-0" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "node-1" + ] + }, + "node-0": { + "ids": [ + "start-node" + ] + }, + "node-1": { + "ids": [ + "node-0" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_10_simple.json b/pkg/compiler/test/testdata/branch/compiled/success_10_simple.json new file mode 100755 index 0000000000..b255580c6c --- /dev/null +++ b/pkg/compiler/test/testdata/branch/compiled/success_10_simple.json @@ -0,0 +1,660 @@ +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.basic_boolean_wf", + "version": "abc" + }, + "metadata": { + + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ] + }, + { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.coin_toss", + "retries": { + + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + } + } + }, + { + "id": "n1", + "metadata": { + "name": "test", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n0.o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "upstreamNodeIds": [ + "n0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "n0.o0" + }, + "rightValue": { + "primitive": { + "boolean": true + } + } + } + }, + "thenNode": { + "id": "n1-n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.success", + "retries": { + + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.success", + "version": "abc" + } + } + } + }, + "elseNode": { + "id": "n1-n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.failed", + "retries": { + + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.failed", + "version": "abc" + } + } + } + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "n0": { + "ids": [ + "n1" + ] + }, + "n1": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "n0" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "n1" + ] + }, + "n0": { + "ids": [ + "start-node" + ] + }, + "n1": { + "ids": [ + "n0" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.success", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.failed", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + }, + "b": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + }, + "o1": { + "type": { + "simple": "FLOAT" + }, + "description": "o1" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "BOOLEAN" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_2.json b/pkg/compiler/test/testdata/branch/compiled/success_2.json index 48820fa416..5e1479146b 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_2.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_2.json @@ -1 +1,474 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"project","domain":"domain","name":"test_serialization.my_wf","version":"version"},"metadata":{},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},{"id":"node-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}},{"id":"node-1","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}},{"id":"node-2","metadata":{"name":"test1","retries":{},"interruptible":false},"inputs":[{"var":"node-0.out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}},{"var":"node-1.out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"upstreamNodeIds":["node-0","node-1"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"node-0.out_0"},"rightValue":{"var":"node-1.out_0"}}},"thenNode":{"id":"node-2-branchnode-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t2","retries":{},"interruptible":false},"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"}}}},"error":{"failedNodeId":"test1","message":"Unable to choose branch"}}}}],"outputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"node-0":{"ids":["node-2"]},"node-1":{"ids":["node-2"]},"node-2":{"ids":["end-node"]},"start-node":{"ids":["node-0","node-1"]}},"upstream":{"end-node":{"ids":["node-2"]},"node-0":{"ids":["start-node"]},"node-1":{"ids":["start-node"]},"node-2":{"ids":["node-0","node-1"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "project", + "domain": "domain", + "name": "test_serialization.my_wf", + "version": "version" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + { + "id": "node-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + }, + { + "id": "node-1", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + }, + { + "id": "node-2", + "metadata": { + "name": "test1", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "node-0.out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + }, + { + "var": "node-1.out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-0", + "node-1" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.out_0" + }, + "rightValue": { + "var": "node-1.out_0" + } + } + }, + "thenNode": { + "id": "node-2-branchnode-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t2", + "retries": { + + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + } + } + } + }, + "error": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + } + } + } + ], + "outputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "node-0": { + "ids": [ + "node-2" + ] + }, + "node-1": { + "ids": [ + "node-2" + ] + }, + "node-2": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "node-0", + "node-1" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "node-2" + ] + }, + "node-0": { + "ids": [ + "start-node" + ] + }, + "node-1": { + "ids": [ + "start-node" + ] + }, + "node-2": { + "ids": [ + "node-0", + "node-1" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_3.json b/pkg/compiler/test/testdata/branch/compiled/success_3.json index de85ced031..3578ec5758 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_3.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_3.json @@ -1 +1,453 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"project","domain":"domain","name":"test_serialization.my_wf","version":"version"},"metadata":{},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}]},{"id":"node-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}},{"id":"node-1","metadata":{"name":"test1","retries":{},"interruptible":false},"inputs":[{"var":".a","binding":{"promise":{"nodeId":"start-node","var":"a"}}},{"var":"node-0.out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"upstreamNodeIds":["node-0"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"node-0.out_0"},"rightValue":{"var":".a"}}},"thenNode":{"id":"node-1-branchnode-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"upstreamNodeIds":["node-0"],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}}},"error":{"failedNodeId":"test1","message":"Unable to choose branch"}}}}],"outputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"node-0":{"ids":["node-1"]},"node-1":{"ids":["end-node"]},"start-node":{"ids":["node-0","node-1"]}},"upstream":{"branchnode-0":{"ids":["node-0"]},"end-node":{"ids":["node-1"]},"node-0":{"ids":["start-node"]},"node-1":{"ids":["node-0","start-node"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "project", + "domain": "domain", + "name": "test_serialization.my_wf", + "version": "version" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ] + }, + { + "id": "node-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + }, + { + "id": "node-1", + "metadata": { + "name": "test1", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + }, + { + "var": "node-0.out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.out_0" + }, + "rightValue": { + "var": ".a" + } + } + }, + "thenNode": { + "id": "node-1-branchnode-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + } + }, + "error": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + } + } + } + ], + "outputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "node-0": { + "ids": [ + "node-1", + "node-1-branchnode-0" + ] + }, + "node-1": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "node-0", + "node-1" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "node-1" + ] + }, + "node-0": { + "ids": [ + "start-node" + ] + }, + "node-1": { + "ids": [ + "node-0", + "start-node" + ] + }, + "node-1-branchnode-0": { + "ids": [ + "node-0" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_4.json b/pkg/compiler/test/testdata/branch/compiled/success_4.json index 76e1c6bdc9..6f5431d98f 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_4.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_4.json @@ -1 +1,557 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"project","domain":"domain","name":"test_serialization.my_wf","version":"version"},"metadata":{},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},{"id":"node-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}},{"id":"node-1","metadata":{"name":"test1","retries":{},"interruptible":false},"inputs":[{"var":".a","binding":{"promise":{"nodeId":"start-node","var":"a"}}},{"var":"node-0.out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"upstreamNodeIds":["node-0"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"node-0.out_0"},"rightValue":{"var":".a"}}},"thenNode":{"id":"node-1-branchnode-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"upstreamNodeIds":["node-0"],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}}},"error":{"failedNodeId":"test1","message":"Unable to choose branch"}}}},{"id":"node-2","metadata":{"name":"test2","retries":{},"interruptible":false},"inputs":[{"var":".a","binding":{"promise":{"nodeId":"start-node","var":"a"}}},{"var":"node-1.out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"upstreamNodeIds":["node-1"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"node-1.out_0"},"rightValue":{"var":".a"}}},"thenNode":{"id":"node-2-branchnode-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t3","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"upstreamNodeIds":["node-1"],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"}}}},"error":{"failedNodeId":"test2","message":"Unable to choose a branch"}}}}],"outputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"node-0":{"ids":["node-1"]},"node-1":{"ids":["node-2"]},"node-2":{"ids":["end-node"]},"start-node":{"ids":["node-0","node-1","node-2"]}},"upstream":{"branchnode-0":{"ids":["node-0","node-1"]},"end-node":{"ids":["node-2"]},"node-0":{"ids":["start-node"]},"node-1":{"ids":["node-0","start-node"]},"node-2":{"ids":["node-1","start-node"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "project", + "domain": "domain", + "name": "test_serialization.my_wf", + "version": "version" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + { + "id": "node-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + }, + { + "id": "node-1", + "metadata": { + "name": "test1", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + }, + { + "var": "node-0.out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.out_0" + }, + "rightValue": { + "var": ".a" + } + } + }, + "thenNode": { + "id": "node-1-branchnode-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + } + }, + "error": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + } + } + }, + { + "id": "node-2", + "metadata": { + "name": "test2", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + }, + { + "var": "node-1.out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-1" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-1.out_0" + }, + "rightValue": { + "var": ".a" + } + } + }, + "thenNode": { + "id": "node-2-branchnode-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t3", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-1" + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + } + } + } + }, + "error": { + "failedNodeId": "test2", + "message": "Unable to choose a branch" + } + } + } + } + ], + "outputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "node-0": { + "ids": [ + "node-1", + "node-1-branchnode-0" + ] + }, + "node-1": { + "ids": [ + "node-2", + "node-2-branchnode-0" + ] + }, + "node-2": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "node-0", + "node-1", + "node-2" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "node-2" + ] + }, + "node-0": { + "ids": [ + "start-node" + ] + }, + "node-1": { + "ids": [ + "node-0", + "start-node" + ] + }, + "node-1-branchnode-0": { + "ids": [ + "node-0" + ] + }, + "node-2": { + "ids": [ + "node-1", + "start-node" + ] + }, + "node-2-branchnode-0": { + "ids": [ + "node-1" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_5.json b/pkg/compiler/test/testdata/branch/compiled/success_5.json index 3a5cdd1a1c..b8ced620c5 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_5.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_5.json @@ -1 +1,584 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"project","domain":"domain","name":"test_serialization.my_wf","version":"version"},"metadata":{},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"},"b":{"type":{"simple":"STRING"},"description":"b"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"},"out_1":{"type":{"simple":"STRING"},"description":"out_1"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-0","var":"t1_int_output"}}},{"var":"out_1","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},{"id":"node-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t1","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"}}},{"id":"node-1","metadata":{"name":"test1","retries":{},"interruptible":false},"inputs":[{"var":"node-0.t1_int_output","binding":{"promise":{"nodeId":"node-0","var":"t1_int_output"}}}],"upstreamNodeIds":["node-0"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"node-0.t1_int_output"},"rightValue":{"primitive":{"integer":"4"}}}},"thenNode":{"id":"node-1-branchnode-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t2","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"b"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"}}}},"other":[{"condition":{"comparison":{"operator":"GTE","leftValue":{"var":"node-0.t1_int_output"},"rightValue":{"primitive":{"integer":"5"}}}},"thenNode":{"id":"node-1-branchnode-1","metadata":{"name":"flytekit.annotated.task.test_serialization.t2","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"promise":{"nodeId":"node-0","var":"c"}}}],"upstreamNodeIds":["node-0"],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"}}}}],"error":{"failedNodeId":"test1","message":"Unable to choose branch"}}}},{"id":"node-2","metadata":{"name":"test2","retries":{},"interruptible":false},"inputs":[{"var":"node-1.out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"upstreamNodeIds":["node-1"],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"leftValue":{"var":"node-1.out_0"},"rightValue":{"primitive":{"stringValue":"hello "}}}},"thenNode":{"id":"node-2-branchnode-0","metadata":{"name":"flytekit.annotated.task.test_serialization.t2","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"scalar":{"primitive":{"stringValue":"It is hello"}}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"}}}},"elseNode":{"id":"node-2-branchnode-1","metadata":{"name":"flytekit.annotated.task.test_serialization.t2","retries":{},"interruptible":false},"inputs":[{"var":"a","binding":{"scalar":{"primitive":{"stringValue":"Not Hello!"}}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"}}}}}}],"outputs":[{"var":"out_0","binding":{"promise":{"nodeId":"node-0","var":"t1_int_output"}}},{"var":"out_1","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"node-0":{"ids":["end-node","node-1"]},"node-1":{"ids":["node-2"]},"node-2":{"ids":["end-node"]},"start-node":{"ids":["node-0"]}},"upstream":{"branchnode-0":{"ids":["start-node"]},"branchnode-1":{"ids":["node-0"]},"end-node":{"ids":["node-0","node-2"]},"node-0":{"ids":["start-node"]},"node-1":{"ids":["node-0"]},"node-2":{"ids":["node-1"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"c":{"type":{"simple":"STRING"},"description":"c"},"t1_int_output":{"type":{"simple":"INTEGER"},"description":"t1_int_output"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"STRING"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "project", + "domain": "domain", + "name": "test_serialization.my_wf", + "version": "version" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + }, + "b": { + "type": { + "simple": "STRING" + }, + "description": "b" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + }, + "out_1": { + "type": { + "simple": "STRING" + }, + "description": "out_1" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "t1_int_output" + } + } + }, + { + "var": "out_1", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + { + "id": "node-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t1", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + } + } + }, + { + "id": "node-1", + "metadata": { + "name": "test1", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "node-0.t1_int_output", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "t1_int_output" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.t1_int_output" + }, + "rightValue": { + "primitive": { + "integer": "4" + } + } + } + }, + "thenNode": { + "id": "node-1-branchnode-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t2", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "b" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + } + } + } + }, + "other": [ + { + "condition": { + "comparison": { + "operator": "GTE", + "leftValue": { + "var": "node-0.t1_int_output" + }, + "rightValue": { + "primitive": { + "integer": "5" + } + } + } + }, + "thenNode": { + "id": "node-1-branchnode-1", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t2", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "c" + } + } + } + ], + "upstreamNodeIds": [ + "node-0" + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + } + } + } + } + ], + "error": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + } + } + }, + { + "id": "node-2", + "metadata": { + "name": "test2", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "node-1.out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "upstreamNodeIds": [ + "node-1" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-1.out_0" + }, + "rightValue": { + "primitive": { + "stringValue": "hello " + } + } + } + }, + "thenNode": { + "id": "node-2-branchnode-0", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t2", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "scalar": { + "primitive": { + "stringValue": "It is hello" + } + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + } + } + } + }, + "elseNode": { + "id": "node-2-branchnode-1", + "metadata": { + "name": "flytekit.annotated.task.test_serialization.t2", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "scalar": { + "primitive": { + "stringValue": "Not Hello!" + } + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + } + } + } + } + } + } + ], + "outputs": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "t1_int_output" + } + } + }, + { + "var": "out_1", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "node-0": { + "ids": [ + "end-node", + "node-1", + "node-1-branchnode-1" + ] + }, + "node-1": { + "ids": [ + "node-2" + ] + }, + "node-2": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "node-0" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "node-0", + "node-2" + ] + }, + "node-0": { + "ids": [ + "start-node" + ] + }, + "node-1": { + "ids": [ + "node-0" + ] + }, + "node-1-branchnode-0": { + "ids": [ + "start-node" + ] + }, + "node-1-branchnode-1": { + "ids": [ + "node-0" + ] + }, + "node-2": { + "ids": [ + "node-1" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "c": { + "type": { + "simple": "STRING" + }, + "description": "c" + }, + "t1_int_output": { + "type": { + "simple": "INTEGER" + }, + "description": "t1_int_output" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "STRING" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_6.json b/pkg/compiler/test/testdata/branch/compiled/success_6.json index fd7e99c8c2..84e6f4a242 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_6.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_6.json @@ -1 +1,382 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.multiplier","version":"abc"},"metadata":{},"interface":{"inputs":{"variables":{"my_input":{"type":{"simple":"FLOAT"},"description":"my_input"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"o0","binding":{"promise":{"nodeId":"node-0","var":"o0"}}}]},{"id":"node-0","metadata":{"name":"fractions","retries":{},"interruptible":false},"inputs":[{"var":".my_input","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"branchNode":{"ifElse":{"case":{"condition":{"conjunction":{"leftExpression":{"comparison":{"operator":"GTE","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":0.1}}}},"rightExpression":{"comparison":{"operator":"LTE","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":1}}}}}},"thenNode":{"id":"node-0-branchn0","metadata":{"name":"flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.double","retries":{},"interruptible":false},"inputs":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.double","version":"abc"}}}},"elseNode":{"id":"node-0-branchn1","metadata":{"name":"flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.square","retries":{},"interruptible":false},"inputs":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.square","version":"abc"}}}}}}],"outputs":[{"var":"o0","binding":{"promise":{"nodeId":"node-0","var":"o0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"node-0":{"ids":["end-node"]},"start-node":{"ids":["node-0"]}},"upstream":{"branchn0":{"ids":["start-node"]},"branchn1":{"ids":["start-node"]},"end-node":{"ids":["node-0"]},"node-0":{"ids":["start-node"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.double","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","recipes.02_intermediate.run_conditions","--task-name","double","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.square","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","recipes.02_intermediate.run_conditions","--task-name","square","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.multiplier", + "version": "abc" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "my_input": { + "type": { + "simple": "FLOAT" + }, + "description": "my_input" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "o0" + } + } + } + ] + }, + { + "id": "node-0", + "metadata": { + "name": "fractions", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GTE", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LTE", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "thenNode": { + "id": "node-0-branchn0", + "metadata": { + "name": "flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.double", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.double", + "version": "abc" + } + } + } + }, + "elseNode": { + "id": "node-0-branchn1", + "metadata": { + "name": "flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.square", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.square", + "version": "abc" + } + } + } + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "node-0": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "node-0" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "node-0" + ] + }, + "node-0": { + "ids": [ + "start-node" + ] + }, + "node-0-branchn0": { + "ids": [ + "start-node" + ] + }, + "node-0-branchn1": { + "ids": [ + "start-node" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "recipes.02_intermediate.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "recipes.02_intermediate.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_7_nested.json b/pkg/compiler/test/testdata/branch/compiled/success_7_nested.json index 25844a542b..ff3768e94a 100755 --- a/pkg/compiler/test/testdata/branch/compiled/success_7_nested.json +++ b/pkg/compiler/test/testdata/branch/compiled/success_7_nested.json @@ -1 +1,469 @@ -{"primary":{"template":{"id":{"resourceType":"WORKFLOW","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.so_nested","version":"abc"},"metadata":{},"interface":{"inputs":{"variables":{"my_input":{"type":{"simple":"FLOAT"},"description":"my_input"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"nodes":[{"id":"start-node"},{"id":"end-node","inputs":[{"var":"o0","binding":{"promise":{"nodeId":"branchnode-2","var":"o0"}}}]},{"id":"branchnode-2","metadata":{"name":"fractions","retries":{},"interruptible":false},"inputs":[{"var":".my_input","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"branchNode":{"ifElse":{"case":{"condition":{"conjunction":{"leftExpression":{"comparison":{"operator":"GT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":0.1}}}},"rightExpression":{"comparison":{"operator":"LT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":1}}}}}},"thenNode":{"id":"branchnode-2-branchbranchnode-1","metadata":{"name":"inner_fractions","retries":{},"interruptible":false},"inputs":[{"var":".my_input","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"branchNode":{"ifElse":{"case":{"condition":{"comparison":{"operator":"LT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":0.5}}}},"thenNode":{"id":"branchnode-2-branchbranchnode-1-branchbranchnode-1-branchbranchn0","metadata":{"name":"flytekit.core.python_function_task.core.control_flow.run_conditions.double","retries":{},"interruptible":false},"inputs":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.double","version":"abc"}}}},"error":{"failedNodeId":"inner_fractions","message":"Only \u003c0.5 allowed"}}}}},"other":[{"condition":{"conjunction":{"leftExpression":{"comparison":{"operator":"GT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":1}}}},"rightExpression":{"comparison":{"operator":"LT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":10}}}}}},"thenNode":{"id":"branchnode-2-branchn1","metadata":{"name":"flytekit.core.python_function_task.core.control_flow.run_conditions.square","retries":{},"interruptible":false},"inputs":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"taskNode":{"referenceId":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.square","version":"abc"}}}}],"error":{"failedNodeId":"fractions","message":"The input must be between 0 and 10"}}}}],"outputs":[{"var":"o0","binding":{"promise":{"nodeId":"branchnode-2","var":"o0"}}}],"metadataDefaults":{}},"connections":{"downstream":{"branchnode-2":{"ids":["end-node"]},"start-node":{"ids":["branchnode-2"]}},"upstream":{"branchbranchn0":{"ids":["start-node"]},"branchbranchnode-1":{"ids":["start-node"]},"branchbranchnode-1-branchbranchn0":{"ids":["start-node"]},"branchn1":{"ids":["start-node"]},"branchnode-2":{"ids":["start-node"]},"branchnode-2-branchbranchnode-1":{"ids":["start-node"]},"end-node":{"ids":["branchnode-2"]}}}},"tasks":[{"template":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.double","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","core.control_flow.run_conditions","--task-name","double","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},{"template":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.square","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","core.control_flow.run_conditions","--task-name","square","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}}]} \ No newline at end of file +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.so_nested", + "version": "abc" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "my_input": { + "type": { + "simple": "FLOAT" + }, + "description": "my_input" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "branchnode-2", + "var": "o0" + } + } + } + ] + }, + { + "id": "branchnode-2", + "metadata": { + "name": "fractions", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "thenNode": { + "id": "branchnode-2-branchbranchnode-1", + "metadata": { + "name": "inner_fractions", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "thenNode": { + "id": "branchnode-2-branchbranchnode-1-branchbranchn0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + }, + "error": { + "failedNodeId": "inner_fractions", + "message": "Only \u003c0.5 allowed" + } + } + } + } + }, + "other": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 10 + } + } + } + } + } + }, + "thenNode": { + "id": "branchnode-2-branchn1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + } + ], + "error": { + "failedNodeId": "fractions", + "message": "The input must be between 0 and 10" + } + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "branchnode-2", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "branchnode-2": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "branchnode-2" + ] + } + }, + "upstream": { + "branchnode-2": { + "ids": [ + "start-node" + ] + }, + "branchnode-2-branchbranchnode-1": { + "ids": [ + "start-node" + ] + }, + "branchnode-2-branchbranchnode-1-branchbranchn0": { + "ids": [ + "start-node" + ] + }, + "branchnode-2-branchn1": { + "ids": [ + "start-node" + ] + }, + "end-node": { + "ids": [ + "branchnode-2" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_8_nested.json b/pkg/compiler/test/testdata/branch/compiled/success_8_nested.json new file mode 100755 index 0000000000..e828c65a6e --- /dev/null +++ b/pkg/compiler/test/testdata/branch/compiled/success_8_nested.json @@ -0,0 +1,569 @@ +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.so_nested", + "version": "abc" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "my_input": { + "type": { + "simple": "FLOAT" + }, + "description": "my_input" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ] + }, + { + "id": "n0", + "metadata": { + "name": "fractions", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "thenNode": { + "id": "n0-n0", + "metadata": { + "name": "inner_fractions", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "thenNode": { + "id": "n0-n0-n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + }, + "other": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.7 + } + } + } + } + } + }, + "thenNode": { + "id": "n0-n0-n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + } + ], + "error": { + "failedNodeId": "inner_fractions", + "message": "Only \u003c0.7 allowed" + } + } + } + } + }, + "other": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 10 + } + } + } + } + } + }, + "thenNode": { + "id": "n0-n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + } + ], + "elseNode": { + "id": "n0-n2", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "n0": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "n0" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "n0" + ] + }, + "n0": { + "ids": [ + "start-node" + ] + }, + "n0-n0": { + "ids": [ + "start-node" + ] + }, + "n0-n0-n0": { + "ids": [ + "start-node" + ] + }, + "n0-n0-n1": { + "ids": [ + "start-node" + ] + }, + "n0-n1": { + "ids": [ + "start-node" + ] + }, + "n0-n2": { + "ids": [ + "start-node" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/compiled/success_9_nested.json b/pkg/compiler/test/testdata/branch/compiled/success_9_nested.json new file mode 100755 index 0000000000..1ae442f02f --- /dev/null +++ b/pkg/compiler/test/testdata/branch/compiled/success_9_nested.json @@ -0,0 +1,609 @@ +{ + "primary": { + "template": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.consume_outputs", + "version": "abc" + }, + "metadata": { + + }, + "interface": { + "inputs": { + "variables": { + "my_input": { + "type": { + "simple": "FLOAT" + }, + "description": "my_input" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "start-node" + }, + { + "id": "end-node", + "inputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n2", + "var": "o0" + } + } + } + ] + }, + { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.coin_toss", + "retries": { + + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + } + } + }, + { + "id": "n1", + "metadata": { + "name": "double_or_square", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n0.o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "upstreamNodeIds": [ + "n0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "n0.o0" + }, + "rightValue": { + "primitive": { + "boolean": true + } + } + } + }, + "thenNode": { + "id": "n1-n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + }, + "elseNode": { + "id": "n1-n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.sum_diff", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + }, + { + "var": "b", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + } + } + } + } + } + }, + { + "id": "n2", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": { + + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ], + "upstreamNodeIds": [ + "n1" + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n2", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + + } + }, + "connections": { + "downstream": { + "n0": { + "ids": [ + "n1" + ] + }, + "n1": { + "ids": [ + "n2" + ] + }, + "n2": { + "ids": [ + "end-node" + ] + }, + "start-node": { + "ids": [ + "n0" + ] + } + }, + "upstream": { + "end-node": { + "ids": [ + "n2" + ] + }, + "n0": { + "ids": [ + "start-node" + ] + }, + "n1": { + "ids": [ + "n0" + ] + }, + "n1-n0": { + "ids": [ + "start-node" + ] + }, + "n1-n1": { + "ids": [ + "start-node" + ] + }, + "n2": { + "ids": [ + "n1" + ] + } + } + } + }, + "tasks": [ + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + }, + "b": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + }, + "o1": { + "type": { + "simple": "FLOAT" + }, + "description": "o1" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "BOOLEAN" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + { + "template": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + + }, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_1.json b/pkg/compiler/test/testdata/branch/k8s/success_1.json index 183a121e00..44452b2dcb 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_1.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_1.json @@ -1 +1,392 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"test-serialization-my-wf"}},"spec":{"id":"project:domain:test_serialization.my_wf","nodes":{"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}]},"node-0":{"id":"node-0","name":"test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1":{"id":"node-1","name":"test1","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"out_0"},"rightValue":{"primitive":{"integer":"1"}}}},"then":"node-1-branchnode-0"},"elseFail":{"failedNodeId":"test1","message":"Unable to choose branch"}},"inputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1-branchnode-0":{"id":"node-1-branchnode-0","name":"test_serialization.t2","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ","retry":{"minAttempts":1},"interruptible":false},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"node-0":["node-1"],"node-1":["end-node"],"start-node":["node-0"]},"edges":{"downstream":{"node-0":["node-1"],"node-1":["end-node"],"start-node":["node-0"]},"upstream":{"end-node":["node-1"],"node-0":["start-node"],"node-1":["node-0"]}},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}},"outputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}]},"inputs":{"literals":{"a":{"scalar":{"primitive":{"integer":"0"}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "test-serialization-my-wf" + } + }, + "spec": { + "id": "project:domain:test_serialization.my_wf", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ] + }, + "node-0": { + "id": "node-0", + "name": "test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1": { + "id": "node-1", + "name": "test1", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "out_0" + }, + "rightValue": { + "primitive": { + "integer": "1" + } + } + } + }, + "then": "node-1-branchnode-0" + }, + "elseFail": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + }, + "inputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1-branchnode-0": { + "id": "node-1-branchnode-0", + "name": "test_serialization.t2", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ", + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "node-0": [ + "node-1" + ], + "node-1": [ + "end-node" + ], + "start-node": [ + "node-0" + ] + }, + "edges": { + "downstream": { + "node-0": [ + "node-1" + ], + "node-1": [ + "end-node" + ], + "start-node": [ + "node-0" + ] + }, + "upstream": { + "end-node": [ + "node-1" + ], + "node-0": [ + "start-node" + ], + "node-1": [ + "node-0" + ] + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + }, + "outputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ] + }, + "inputs": { + "literals": { + "a": { + "scalar": { + "primitive": { + "integer": "0" + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_10_simple.json b/pkg/compiler/test/testdata/branch/k8s/success_10_simple.json new file mode 100755 index 0000000000..5515aad3e0 --- /dev/null +++ b/pkg/compiler/test/testdata/branch/k8s/success_10_simple.json @@ -0,0 +1,598 @@ +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "core-control-flow-run-conditions-basic-boolean-wf" + } + }, + "spec": { + "id": "test_proj:test_domain:core.control_flow.run_conditions.basic_boolean_wf", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ] + }, + "n0": { + "id": "n0", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.coin_toss", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.coin_toss\" version:\"abc\" ", + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n1": { + "id": "n1", + "name": "test", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "n0.o0" + }, + "rightValue": { + "primitive": { + "boolean": true + } + } + } + }, + "then": "n1-n0" + }, + "else": "n1-n1" + }, + "inputBindings": [ + { + "var": "n0.o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n1-n0": { + "id": "n1-n0", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.success", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.success\" version:\"abc\" ", + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n1-n1": { + "id": "n1-n1", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.failed", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.failed\" version:\"abc\" ", + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "n0": [ + "n1" + ], + "n1": [ + "end-node" + ], + "start-node": [ + "n0" + ] + }, + "edges": { + "downstream": { + "n0": [ + "n1" + ], + "n1": [ + "end-node" + ], + "start-node": [ + "n0" + ] + }, + "upstream": { + "end-node": [ + "n1" + ], + "n0": [ + "start-node" + ], + "n1": [ + "n0" + ] + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + }, + "outputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ] + }, + "inputs": {}, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.coin_toss\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "BOOLEAN" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.failed\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.failed", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.success\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.success", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.sum_diff\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + }, + "b": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + }, + "o1": { + "type": { + "simple": "FLOAT" + }, + "description": "o1" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_2.json b/pkg/compiler/test/testdata/branch/k8s/success_2.json index 44afd3822f..c27c891e12 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_2.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_2.json @@ -1 +1,433 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"test-serialization-my-wf"}},"spec":{"id":"project:domain:test_serialization.my_wf","nodes":{"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},"node-0":{"id":"node-0","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1":{"id":"node-1","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2":{"id":"node-2","name":"test1","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"node-0.out_0"},"rightValue":{"var":"node-1.out_0"}}},"then":"node-2-branchnode-0"},"elseFail":{"failedNodeId":"test1","message":"Unable to choose branch"}},"inputBindings":[{"var":"node-0.out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}},{"var":"node-1.out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2-branchnode-0":{"id":"node-2-branchnode-0","name":"flytekit.annotated.task.test_serialization.t2","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ","retry":{"minAttempts":1},"interruptible":false},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"node-0":["node-2"],"node-1":["node-2"],"node-2":["end-node"],"start-node":["node-0","node-1"]},"edges":{"downstream":{"node-0":["node-2"],"node-1":["node-2"],"node-2":["end-node"],"start-node":["node-0","node-1"]},"upstream":{"end-node":["node-2"],"node-0":["start-node"],"node-1":["start-node"],"node-2":["node-0","node-1"]}},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}},"outputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},"inputs":{"literals":{"a":{"scalar":{"primitive":{"integer":"0"}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "test-serialization-my-wf" + } + }, + "spec": { + "id": "project:domain:test_serialization.my_wf", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + "node-0": { + "id": "node-0", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1": { + "id": "node-1", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2": { + "id": "node-2", + "name": "test1", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.out_0" + }, + "rightValue": { + "var": "node-1.out_0" + } + } + }, + "then": "node-2-branchnode-0" + }, + "elseFail": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + }, + "inputBindings": [ + { + "var": "node-0.out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + }, + { + "var": "node-1.out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2-branchnode-0": { + "id": "node-2-branchnode-0", + "name": "flytekit.annotated.task.test_serialization.t2", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ", + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "node-0": [ + "node-2" + ], + "node-1": [ + "node-2" + ], + "node-2": [ + "end-node" + ], + "start-node": [ + "node-0", + "node-1" + ] + }, + "edges": { + "downstream": { + "node-0": [ + "node-2" + ], + "node-1": [ + "node-2" + ], + "node-2": [ + "end-node" + ], + "start-node": [ + "node-0", + "node-1" + ] + }, + "upstream": { + "end-node": [ + "node-2" + ], + "node-0": [ + "start-node" + ], + "node-1": [ + "start-node" + ], + "node-2": [ + "node-0", + "node-1" + ] + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + }, + "outputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + "inputs": { + "literals": { + "a": { + "scalar": { + "primitive": { + "integer": "0" + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_3.json b/pkg/compiler/test/testdata/branch/k8s/success_3.json index f66f7260b8..bffd2c5f72 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_3.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_3.json @@ -1 +1,418 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"test-serialization-my-wf"}},"spec":{"id":"project:domain:test_serialization.my_wf","nodes":{"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}]},"node-0":{"id":"node-0","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1":{"id":"node-1","name":"test1","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"node-0.out_0"},"rightValue":{"var":".a"}}},"then":"node-1-branchnode-0"},"elseFail":{"failedNodeId":"test1","message":"Unable to choose branch"}},"inputBindings":[{"var":".a","binding":{"promise":{"nodeId":"start-node","var":"a"}}},{"var":"node-0.out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1-branchnode-0":{"id":"node-1-branchnode-0","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"node-0":["node-1"],"node-1":["end-node"],"start-node":["node-0","node-1"]},"edges":{"downstream":{"node-0":["node-1"],"node-1":["end-node"],"start-node":["node-0","node-1"]},"upstream":{"branchnode-0":["node-0"],"end-node":["node-1"],"node-0":["start-node"],"node-1":["node-0","start-node"]}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}},"outputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}]},"inputs":{"literals":{"a":{"scalar":{"primitive":{"integer":"0"}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "test-serialization-my-wf" + } + }, + "spec": { + "id": "project:domain:test_serialization.my_wf", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ] + }, + "node-0": { + "id": "node-0", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1": { + "id": "node-1", + "name": "test1", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.out_0" + }, + "rightValue": { + "var": ".a" + } + } + }, + "then": "node-1-branchnode-0" + }, + "elseFail": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + }, + "inputBindings": [ + { + "var": ".a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + }, + { + "var": "node-0.out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1-branchnode-0": { + "id": "node-1-branchnode-0", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "node-0": [ + "node-1", + "node-1-branchnode-0" + ], + "node-1": [ + "end-node" + ], + "start-node": [ + "node-0", + "node-1" + ] + }, + "edges": { + "downstream": { + "node-0": [ + "node-1", + "node-1-branchnode-0" + ], + "node-1": [ + "end-node" + ], + "start-node": [ + "node-0", + "node-1" + ] + }, + "upstream": { + "end-node": [ + "node-1" + ], + "node-0": [ + "start-node" + ], + "node-1": [ + "node-0", + "start-node" + ], + "node-1-branchnode-0": [ + "node-0" + ] + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + }, + "outputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ] + }, + "inputs": { + "literals": { + "a": { + "scalar": { + "primitive": { + "integer": "0" + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_4.json b/pkg/compiler/test/testdata/branch/k8s/success_4.json index 1be4946c2a..3a0fe4aed0 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_4.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_4.json @@ -1 +1,506 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"test-serialization-my-wf"}},"spec":{"id":"project:domain:test_serialization.my_wf","nodes":{"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},"node-0":{"id":"node-0","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1":{"id":"node-1","name":"test1","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"node-0.out_0"},"rightValue":{"var":".a"}}},"then":"node-1-branchnode-0"},"elseFail":{"failedNodeId":"test1","message":"Unable to choose branch"}},"inputBindings":[{"var":".a","binding":{"promise":{"nodeId":"start-node","var":"a"}}},{"var":"node-0.out_0","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1-branchnode-0":{"id":"node-1-branchnode-0","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"node-0","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2":{"id":"node-2","name":"test2","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"node-1.out_0"},"rightValue":{"var":".a"}}},"then":"node-2-branchnode-0"},"elseFail":{"failedNodeId":"test2","message":"Unable to choose a branch"}},"inputBindings":[{"var":".a","binding":{"promise":{"nodeId":"start-node","var":"a"}}},{"var":"node-1.out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2-branchnode-0":{"id":"node-2-branchnode-0","name":"flytekit.annotated.task.test_serialization.t3","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"node-0":["node-1"],"node-1":["node-2"],"node-2":["end-node"],"start-node":["node-0","node-1","node-2"]},"edges":{"downstream":{"node-0":["node-1"],"node-1":["node-2"],"node-2":["end-node"],"start-node":["node-0","node-1","node-2"]},"upstream":{"branchnode-0":["node-0","node-1"],"end-node":["node-2"],"node-0":["start-node"],"node-1":["node-0","start-node"],"node-2":["node-1","start-node"]}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}},"outputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},"inputs":{"literals":{"a":{"scalar":{"primitive":{"integer":"0"}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t3","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t3","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "test-serialization-my-wf" + } + }, + "spec": { + "id": "project:domain:test_serialization.my_wf", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + "node-0": { + "id": "node-0", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1": { + "id": "node-1", + "name": "test1", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.out_0" + }, + "rightValue": { + "var": ".a" + } + } + }, + "then": "node-1-branchnode-0" + }, + "elseFail": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + }, + "inputBindings": [ + { + "var": ".a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + }, + { + "var": "node-0.out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1-branchnode-0": { + "id": "node-1-branchnode-0", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2": { + "id": "node-2", + "name": "test2", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-1.out_0" + }, + "rightValue": { + "var": ".a" + } + } + }, + "then": "node-2-branchnode-0" + }, + "elseFail": { + "failedNodeId": "test2", + "message": "Unable to choose a branch" + } + }, + "inputBindings": [ + { + "var": ".a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + }, + { + "var": "node-1.out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2-branchnode-0": { + "id": "node-2-branchnode-0", + "name": "flytekit.annotated.task.test_serialization.t3", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "node-0": [ + "node-1", + "node-1-branchnode-0" + ], + "node-1": [ + "node-2", + "node-2-branchnode-0" + ], + "node-2": [ + "end-node" + ], + "start-node": [ + "node-0", + "node-1", + "node-2" + ] + }, + "edges": { + "downstream": { + "node-0": [ + "node-1", + "node-1-branchnode-0" + ], + "node-1": [ + "node-2", + "node-2-branchnode-0" + ], + "node-2": [ + "end-node" + ], + "start-node": [ + "node-0", + "node-1", + "node-2" + ] + }, + "upstream": { + "end-node": [ + "node-2" + ], + "node-0": [ + "start-node" + ], + "node-1": [ + "node-0", + "start-node" + ], + "node-1-branchnode-0": [ + "node-0" + ], + "node-2": [ + "node-1", + "start-node" + ], + "node-2-branchnode-0": [ + "node-1" + ] + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + }, + "outputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + "inputs": { + "literals": { + "a": { + "scalar": { + "primitive": { + "integer": "0" + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t3\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t3", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t3", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_5.json b/pkg/compiler/test/testdata/branch/k8s/success_5.json index 281d01a276..fd0c0fe55c 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_5.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_5.json @@ -1 +1,531 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"test-serialization-my-wf"}},"spec":{"id":"project:domain:test_serialization.my_wf","nodes":{"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-0","var":"t1_int_output"}}},{"var":"out_1","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},"node-0":{"id":"node-0","name":"flytekit.annotated.task.test_serialization.t1","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"a"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1":{"id":"node-1","name":"test1","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"node-0.t1_int_output"},"rightValue":{"primitive":{"integer":"4"}}}},"then":"node-1-branchnode-0"},"elseIf":[{"condition":{"comparison":{"operator":"GTE","leftValue":{"var":"node-0.t1_int_output"},"rightValue":{"primitive":{"integer":"5"}}}},"then":"node-1-branchnode-1"}],"elseFail":{"failedNodeId":"test1","message":"Unable to choose branch"}},"inputBindings":[{"var":"node-0.t1_int_output","binding":{"promise":{"nodeId":"node-0","var":"t1_int_output"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1-branchnode-0":{"id":"node-1-branchnode-0","name":"flytekit.annotated.task.test_serialization.t2","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"start-node","var":"b"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-1-branchnode-1":{"id":"node-1-branchnode-1","name":"flytekit.annotated.task.test_serialization.t2","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"promise":{"nodeId":"node-0","var":"c"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2":{"id":"node-2","name":"test2","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"leftValue":{"var":"node-1.out_0"},"rightValue":{"primitive":{"stringValue":"hello "}}}},"then":"node-2-branchnode-0"},"else":"node-2-branchnode-1"},"inputBindings":[{"var":"node-1.out_0","binding":{"promise":{"nodeId":"node-1","var":"out_0"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2-branchnode-0":{"id":"node-2-branchnode-0","name":"flytekit.annotated.task.test_serialization.t2","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"scalar":{"primitive":{"stringValue":"It is hello"}}}}],"retry":{"minAttempts":1},"interruptible":false},"node-2-branchnode-1":{"id":"node-2-branchnode-1","name":"flytekit.annotated.task.test_serialization.t2","resources":{},"kind":"task","task":"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ","inputBindings":[{"var":"a","binding":{"scalar":{"primitive":{"stringValue":"Not Hello!"}}}}],"retry":{"minAttempts":1},"interruptible":false},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"node-0":["end-node","node-1"],"node-1":["node-2"],"node-2":["end-node"],"start-node":["node-0"]},"edges":{"downstream":{"node-0":["end-node","node-1"],"node-1":["node-2"],"node-2":["end-node"],"start-node":["node-0"]},"upstream":{"branchnode-0":["start-node"],"branchnode-1":["node-0"],"end-node":["node-0","node-2"],"node-0":["start-node"],"node-1":["node-0"],"node-2":["node-1"]}},"outputs":{"variables":{"out_0":{"type":{"simple":"INTEGER"},"description":"out_0"},"out_1":{"type":{"simple":"STRING"},"description":"out_1"}}},"outputBindings":[{"var":"out_0","binding":{"promise":{"nodeId":"node-0","var":"t1_int_output"}}},{"var":"out_1","binding":{"promise":{"nodeId":"node-2","var":"out_0"}}}]},"inputs":{"literals":{"a":{"scalar":{"primitive":{"integer":"0"}}},"b":{"scalar":{"primitive":{"stringValue":""}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t1","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"INTEGER"},"description":"a"}}},"outputs":{"variables":{"c":{"type":{"simple":"STRING"},"description":"c"},"t1_int_output":{"type":{"simple":"INTEGER"},"description":"t1_int_output"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t1","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ":{"id":{"resourceType":"TASK","project":"project","domain":"domain","name":"test_serialization.t2","version":"version"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"1.2.3","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"a":{"type":{"simple":"STRING"},"description":"a"}}},"outputs":{"variables":{"out_0":{"type":{"simple":"STRING"},"description":"out_0"}}}},"container":{"image":"image","args":["pyflyte-execute","--task-module","test_serialization","--task-name","t2","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "test-serialization-my-wf" + } + }, + "spec": { + "id": "project:domain:test_serialization.my_wf", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "t1_int_output" + } + } + }, + { + "var": "out_1", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + "node-0": { + "id": "node-0", + "name": "flytekit.annotated.task.test_serialization.t1", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "a" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1": { + "id": "node-1", + "name": "test1", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-0.t1_int_output" + }, + "rightValue": { + "primitive": { + "integer": "4" + } + } + } + }, + "then": "node-1-branchnode-0" + }, + "elseIf": [ + { + "condition": { + "comparison": { + "operator": "GTE", + "leftValue": { + "var": "node-0.t1_int_output" + }, + "rightValue": { + "primitive": { + "integer": "5" + } + } + } + }, + "then": "node-1-branchnode-1" + } + ], + "elseFail": { + "failedNodeId": "test1", + "message": "Unable to choose branch" + } + }, + "inputBindings": [ + { + "var": "node-0.t1_int_output", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "t1_int_output" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1-branchnode-0": { + "id": "node-1-branchnode-0", + "name": "flytekit.annotated.task.test_serialization.t2", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "b" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-1-branchnode-1": { + "id": "node-1-branchnode-1", + "name": "flytekit.annotated.task.test_serialization.t2", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "c" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2": { + "id": "node-2", + "name": "test2", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "node-1.out_0" + }, + "rightValue": { + "primitive": { + "stringValue": "hello " + } + } + } + }, + "then": "node-2-branchnode-0" + }, + "else": "node-2-branchnode-1" + }, + "inputBindings": [ + { + "var": "node-1.out_0", + "binding": { + "promise": { + "nodeId": "node-1", + "var": "out_0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2-branchnode-0": { + "id": "node-2-branchnode-0", + "name": "flytekit.annotated.task.test_serialization.t2", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "scalar": { + "primitive": { + "stringValue": "It is hello" + } + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-2-branchnode-1": { + "id": "node-2-branchnode-1", + "name": "flytekit.annotated.task.test_serialization.t2", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "scalar": { + "primitive": { + "stringValue": "Not Hello!" + } + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "node-0": [ + "end-node", + "node-1", + "node-1-branchnode-1" + ], + "node-1": [ + "node-2" + ], + "node-2": [ + "end-node" + ], + "start-node": [ + "node-0" + ] + }, + "edges": { + "downstream": { + "node-0": [ + "end-node", + "node-1", + "node-1-branchnode-1" + ], + "node-1": [ + "node-2" + ], + "node-2": [ + "end-node" + ], + "start-node": [ + "node-0" + ] + }, + "upstream": { + "end-node": [ + "node-0", + "node-2" + ], + "node-0": [ + "start-node" + ], + "node-1": [ + "node-0" + ], + "node-1-branchnode-0": [ + "start-node" + ], + "node-1-branchnode-1": [ + "node-0" + ], + "node-2": [ + "node-1" + ] + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "INTEGER" + }, + "description": "out_0" + }, + "out_1": { + "type": { + "simple": "STRING" + }, + "description": "out_1" + } + } + }, + "outputBindings": [ + { + "var": "out_0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "t1_int_output" + } + } + }, + { + "var": "out_1", + "binding": { + "promise": { + "nodeId": "node-2", + "var": "out_0" + } + } + } + ] + }, + "inputs": { + "literals": { + "a": { + "scalar": { + "primitive": { + "integer": "0" + } + } + }, + "b": { + "scalar": { + "primitive": { + "stringValue": "" + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t1\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t1", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "INTEGER" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "c": { + "type": { + "simple": "STRING" + }, + "description": "c" + }, + "t1_int_output": { + "type": { + "simple": "INTEGER" + }, + "description": "t1_int_output" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t1", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"project\" domain:\"domain\" name:\"test_serialization.t2\" version:\"version\" ": { + "id": { + "resourceType": "TASK", + "project": "project", + "domain": "domain", + "name": "test_serialization.t2", + "version": "version" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "1.2.3", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "STRING" + }, + "description": "a" + } + } + }, + "outputs": { + "variables": { + "out_0": { + "type": { + "simple": "STRING" + }, + "description": "out_0" + } + } + } + }, + "container": { + "image": "image", + "args": [ + "pyflyte-execute", + "--task-module", + "test_serialization", + "--task-name", + "t2", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_6.json b/pkg/compiler/test/testdata/branch/k8s/success_6.json index 961211bcb3..0553ae0d4e 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_6.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_6.json @@ -1 +1,361 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"recipes-02-intermediate-run-conditions-multiplier"}},"spec":{"id":"test_proj:test_domain:recipes.02_intermediate.run_conditions.multiplier","nodes":{"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"o0","binding":{"promise":{"nodeId":"node-0","var":"o0"}}}]},"node-0":{"id":"node-0","name":"fractions","resources":{},"kind":"branch","branch":{"if":{"condition":{"conjunction":{"leftExpression":{"comparison":{"operator":"GTE","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":0.1}}}},"rightExpression":{"comparison":{"operator":"LTE","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":1}}}}}},"then":"node-0-branchn0"},"else":"node-0-branchn1"},"inputBindings":[{"var":".my_input","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-0-branchn0":{"id":"node-0-branchn0","name":"flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.double","resources":{},"kind":"task","task":"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.double\" version:\"abc\" ","inputBindings":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"node-0-branchn1":{"id":"node-0-branchn1","name":"flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.square","resources":{},"kind":"task","task":"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.square\" version:\"abc\" ","inputBindings":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"node-0":["end-node"],"start-node":["node-0"]},"edges":{"downstream":{"node-0":["end-node"],"start-node":["node-0"]},"upstream":{"branchn0":["start-node"],"branchn1":["start-node"],"end-node":["node-0"],"node-0":["start-node"]}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}},"outputBindings":[{"var":"o0","binding":{"promise":{"nodeId":"node-0","var":"o0"}}}]},"inputs":{"literals":{"my_input":{"scalar":{"primitive":{"floatValue":0}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.double\" version:\"abc\" ":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.double","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","recipes.02_intermediate.run_conditions","--task-name","double","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.square\" version:\"abc\" ":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"recipes.02_intermediate.run_conditions.square","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","recipes.02_intermediate.run_conditions","--task-name","square","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "recipes-02-intermediate-run-conditions-multiplier" + } + }, + "spec": { + "id": "test_proj:test_domain:recipes.02_intermediate.run_conditions.multiplier", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "o0" + } + } + } + ] + }, + "node-0": { + "id": "node-0", + "name": "fractions", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GTE", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LTE", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "then": "node-0-branchn0" + }, + "else": "node-0-branchn1" + }, + "inputBindings": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-0-branchn0": { + "id": "node-0-branchn0", + "name": "flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.double", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.double\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "node-0-branchn1": { + "id": "node-0-branchn1", + "name": "flytekit.annotated.python_function_task.recipes.02_intermediate.run_conditions.square", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.square\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "node-0": [ + "end-node" + ], + "start-node": [ + "node-0" + ] + }, + "edges": { + "downstream": { + "node-0": [ + "end-node" + ], + "start-node": [ + "node-0" + ] + }, + "upstream": { + "end-node": [ + "node-0" + ], + "node-0": [ + "start-node" + ], + "node-0-branchn0": [ + "start-node" + ], + "node-0-branchn1": [ + "start-node" + ] + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + }, + "outputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "node-0", + "var": "o0" + } + } + } + ] + }, + "inputs": { + "literals": { + "my_input": { + "scalar": { + "primitive": { + "floatValue": 0 + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.double\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "recipes.02_intermediate.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"recipes.02_intermediate.run_conditions.square\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "recipes.02_intermediate.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "recipes.02_intermediate.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_7_nested.json b/pkg/compiler/test/testdata/branch/k8s/success_7_nested.json index 4dc8500dd9..57fefb0cce 100755 --- a/pkg/compiler/test/testdata/branch/k8s/success_7_nested.json +++ b/pkg/compiler/test/testdata/branch/k8s/success_7_nested.json @@ -1 +1,445 @@ -{"kind":"flyteworkflow","apiVersion":"flyte.lyft.com/v1alpha1","metadata":{"name":"name","namespace":"namespace","creationTimestamp":null,"labels":{"execution-id":"name","workflow-name":"core-control-flow-run-conditions-so-nested"}},"spec":{"id":"test_proj:test_domain:core.control_flow.run_conditions.so_nested","nodes":{"branchnode-2":{"id":"branchnode-2","name":"fractions","resources":{},"kind":"branch","branch":{"if":{"condition":{"conjunction":{"leftExpression":{"comparison":{"operator":"GT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":0.1}}}},"rightExpression":{"comparison":{"operator":"LT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":1}}}}}},"then":"branchnode-2-branchbranchnode-1"},"elseIf":[{"condition":{"conjunction":{"leftExpression":{"comparison":{"operator":"GT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":1}}}},"rightExpression":{"comparison":{"operator":"LT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":10}}}}}},"then":"branchnode-2-branchn1"}],"elseFail":{"failedNodeId":"fractions","message":"The input must be between 0 and 10"}},"inputBindings":[{"var":".my_input","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"branchnode-2-branchbranchnode-1":{"id":"branchnode-2-branchbranchnode-1","name":"inner_fractions","resources":{},"kind":"branch","branch":{"if":{"condition":{"comparison":{"operator":"LT","leftValue":{"var":".my_input"},"rightValue":{"primitive":{"floatValue":0.5}}}},"then":"branchnode-2-branchbranchnode-1-branchbranchnode-1-branchbranchn0"},"elseFail":{"failedNodeId":"inner_fractions","message":"Only \u003c0.5 allowed"}},"inputBindings":[{"var":".my_input","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"branchnode-2-branchbranchnode-1-branchbranchnode-1-branchbranchn0":{"id":"branchnode-2-branchbranchnode-1-branchbranchnode-1-branchbranchn0","name":"flytekit.core.python_function_task.core.control_flow.run_conditions.double","resources":{},"kind":"task","task":"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ","inputBindings":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"branchnode-2-branchn1":{"id":"branchnode-2-branchn1","name":"flytekit.core.python_function_task.core.control_flow.run_conditions.square","resources":{},"kind":"task","task":"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ","inputBindings":[{"var":"n","binding":{"promise":{"nodeId":"start-node","var":"my_input"}}}],"retry":{"minAttempts":1},"interruptible":false},"end-node":{"id":"end-node","resources":{},"kind":"end","inputBindings":[{"var":"o0","binding":{"promise":{"nodeId":"branchnode-2","var":"o0"}}}]},"start-node":{"id":"start-node","resources":{},"kind":"start"}},"connections":{"branchnode-2":["end-node"],"start-node":["branchnode-2"]},"edges":{"downstream":{"branchnode-2":["end-node"],"start-node":["branchnode-2"]},"upstream":{"branchbranchn0":["start-node"],"branchbranchnode-1":["start-node"],"branchbranchnode-1-branchbranchn0":["start-node"],"branchn1":["start-node"],"branchnode-2":["start-node"],"branchnode-2-branchbranchnode-1":["start-node"],"end-node":["branchnode-2"]}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}},"outputBindings":[{"var":"o0","binding":{"promise":{"nodeId":"branchnode-2","var":"o0"}}}]},"inputs":{"literals":{"my_input":{"scalar":{"primitive":{"floatValue":0}}}}},"executionId":{},"tasks":{"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.double","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","core.control_flow.run_conditions","--task-name","double","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}},"resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ":{"id":{"resourceType":"TASK","project":"test_proj","domain":"test_domain","name":"core.control_flow.run_conditions.square","version":"abc"},"type":"python-task","metadata":{"runtime":{"type":"FLYTE_SDK","version":"0.16.0","flavor":"python"},"retries":{},"interruptible":false},"interface":{"inputs":{"variables":{"n":{"type":{"simple":"FLOAT"},"description":"n"}}},"outputs":{"variables":{"o0":{"type":{"simple":"FLOAT"},"description":"o0"}}}},"container":{"image":"image:name","args":["pyflyte-execute","--task-module","core.control_flow.run_conditions","--task-name","square","--inputs","{{.input}}","--output-prefix","{{.outputPrefix}}","--raw-output-data-prefix","{{.rawOutputDataPrefix}}"],"resources":{},"config":[{"key":"testKey1","value":"testValue1"},{"key":"testKey2","value":"testValue2"},{"key":"testKey3","value":"testValue3"}]}}},"node-defaults":{},"securityContext":{},"status":{"phase":0},"rawOutputDataConfig":{},"executionConfig":{"TaskPluginImpls":null,"MaxParallelism":0}} \ No newline at end of file +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "core-control-flow-run-conditions-so-nested" + } + }, + "spec": { + "id": "test_proj:test_domain:core.control_flow.run_conditions.so_nested", + "nodes": { + "branchnode-2": { + "id": "branchnode-2", + "name": "fractions", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "then": "branchnode-2-branchbranchnode-1" + }, + "elseIf": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 10 + } + } + } + } + } + }, + "then": "branchnode-2-branchn1" + } + ], + "elseFail": { + "failedNodeId": "fractions", + "message": "The input must be between 0 and 10" + } + }, + "inputBindings": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "branchnode-2-branchbranchnode-1": { + "id": "branchnode-2-branchbranchnode-1", + "name": "inner_fractions", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "then": "branchnode-2-branchbranchnode-1-branchbranchn0" + }, + "elseFail": { + "failedNodeId": "inner_fractions", + "message": "Only \u003c0.5 allowed" + } + }, + "inputBindings": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "branchnode-2-branchbranchnode-1-branchbranchn0": { + "id": "branchnode-2-branchbranchnode-1-branchbranchn0", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "branchnode-2-branchn1": { + "id": "branchnode-2-branchn1", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "branchnode-2", + "var": "o0" + } + } + } + ] + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "branchnode-2": [ + "end-node" + ], + "start-node": [ + "branchnode-2" + ] + }, + "edges": { + "downstream": { + "branchnode-2": [ + "end-node" + ], + "start-node": [ + "branchnode-2" + ] + }, + "upstream": { + "branchnode-2": [ + "start-node" + ], + "branchnode-2-branchbranchnode-1": [ + "start-node" + ], + "branchnode-2-branchbranchnode-1-branchbranchn0": [ + "start-node" + ], + "branchnode-2-branchn1": [ + "start-node" + ], + "end-node": [ + "branchnode-2" + ] + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + }, + "outputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "branchnode-2", + "var": "o0" + } + } + } + ] + }, + "inputs": { + "literals": { + "my_input": { + "scalar": { + "primitive": { + "floatValue": 0 + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_8_nested.json b/pkg/compiler/test/testdata/branch/k8s/success_8_nested.json new file mode 100755 index 0000000000..9290bf2c34 --- /dev/null +++ b/pkg/compiler/test/testdata/branch/k8s/success_8_nested.json @@ -0,0 +1,527 @@ +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "core-control-flow-run-conditions-so-nested" + } + }, + "spec": { + "id": "test_proj:test_domain:core.control_flow.run_conditions.so_nested", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ] + }, + "n0": { + "id": "n0", + "name": "fractions", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "then": "n0-n0" + }, + "elseIf": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 10 + } + } + } + } + } + }, + "then": "n0-n1" + } + ], + "else": "n0-n2" + }, + "inputBindings": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n0-n0": { + "id": "n0-n0", + "name": "inner_fractions", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "then": "n0-n0-n0" + }, + "elseIf": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.7 + } + } + } + } + } + }, + "then": "n0-n0-n1" + } + ], + "elseFail": { + "failedNodeId": "inner_fractions", + "message": "Only \u003c0.7 allowed" + } + }, + "inputBindings": [ + { + "var": ".my_input", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n0-n0-n0": { + "id": "n0-n0-n0", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n0-n0-n1": { + "id": "n0-n0-n1", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n0-n1": { + "id": "n0-n1", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n0-n2": { + "id": "n0-n2", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "n0": [ + "end-node" + ], + "start-node": [ + "n0" + ] + }, + "edges": { + "downstream": { + "n0": [ + "end-node" + ], + "start-node": [ + "n0" + ] + }, + "upstream": { + "end-node": [ + "n0" + ], + "n0": [ + "start-node" + ], + "n0-n0": [ + "start-node" + ], + "n0-n0-n0": [ + "start-node" + ], + "n0-n0-n1": [ + "start-node" + ], + "n0-n1": [ + "start-node" + ], + "n0-n2": [ + "start-node" + ] + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + }, + "outputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ] + }, + "inputs": { + "literals": { + "my_input": { + "scalar": { + "primitive": { + "floatValue": 0 + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/k8s/success_9_nested.json b/pkg/compiler/test/testdata/branch/k8s/success_9_nested.json new file mode 100755 index 0000000000..d88b954812 --- /dev/null +++ b/pkg/compiler/test/testdata/branch/k8s/success_9_nested.json @@ -0,0 +1,550 @@ +{ + "kind": "flyteworkflow", + "apiVersion": "flyte.lyft.com/v1alpha1", + "metadata": { + "name": "name", + "namespace": "namespace", + "creationTimestamp": null, + "labels": { + "execution-id": "name", + "workflow-name": "core-control-flow-run-conditions-consume-outputs" + } + }, + "spec": { + "id": "test_proj:test_domain:core.control_flow.run_conditions.consume_outputs", + "nodes": { + "end-node": { + "id": "end-node", + "resources": {}, + "kind": "end", + "inputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n2", + "var": "o0" + } + } + } + ] + }, + "n0": { + "id": "n0", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.coin_toss", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.coin_toss\" version:\"abc\" ", + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n1": { + "id": "n1", + "name": "double_or_square", + "resources": {}, + "kind": "branch", + "branch": { + "if": { + "condition": { + "comparison": { + "leftValue": { + "var": "n0.o0" + }, + "rightValue": { + "primitive": { + "boolean": true + } + } + } + }, + "then": "n1-n0" + }, + "else": "n1-n1" + }, + "inputBindings": [ + { + "var": "n0.o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n1-n0": { + "id": "n1-n0", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n1-n1": { + "id": "n1-n1", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.sum_diff", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.sum_diff\" version:\"abc\" ", + "inputBindings": [ + { + "var": "a", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + }, + { + "var": "b", + "binding": { + "promise": { + "nodeId": "start-node", + "var": "my_input" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "n2": { + "id": "n2", + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "resources": {}, + "kind": "task", + "task": "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ", + "inputBindings": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ], + "retry": { + "minAttempts": 1 + }, + "interruptible": false + }, + "start-node": { + "id": "start-node", + "resources": {}, + "kind": "start" + } + }, + "connections": { + "n0": [ + "n1" + ], + "n1": [ + "n2" + ], + "n2": [ + "end-node" + ], + "start-node": [ + "n0" + ] + }, + "edges": { + "downstream": { + "n0": [ + "n1" + ], + "n1": [ + "n2" + ], + "n2": [ + "end-node" + ], + "start-node": [ + "n0" + ] + }, + "upstream": { + "end-node": [ + "n2" + ], + "n0": [ + "start-node" + ], + "n1": [ + "n0" + ], + "n1-n0": [ + "start-node" + ], + "n1-n1": [ + "start-node" + ], + "n2": [ + "n1" + ] + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + }, + "outputBindings": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n2", + "var": "o0" + } + } + } + ] + }, + "inputs": { + "literals": { + "my_input": { + "scalar": { + "primitive": { + "floatValue": 0 + } + } + } + } + }, + "executionId": {}, + "tasks": { + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.coin_toss\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": {}, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "BOOLEAN" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.double\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.square\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + }, + "resource_type:TASK project:\"test_proj\" domain:\"test_domain\" name:\"core.control_flow.run_conditions.sum_diff\" version:\"abc\" ": { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": {}, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + }, + "b": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + }, + "o1": { + "type": { + "simple": "FLOAT" + }, + "description": "o1" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": {}, + "config": [ + { + "key": "testKey1", + "value": "testValue1" + }, + { + "key": "testKey2", + "value": "testValue2" + }, + { + "key": "testKey3", + "value": "testValue3" + } + ] + } + } + }, + "node-defaults": {}, + "securityContext": {}, + "status": { + "phase": 0 + }, + "rawOutputDataConfig": {}, + "executionConfig": { + "TaskPluginImpls": null, + "MaxParallelism": 0 + } +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/success_10_simple.json b/pkg/compiler/test/testdata/branch/success_10_simple.json new file mode 100755 index 0000000000..edda01a1e2 --- /dev/null +++ b/pkg/compiler/test/testdata/branch/success_10_simple.json @@ -0,0 +1,489 @@ +{ + "workflow": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.basic_boolean_wf", + "version": "abc" + }, + "metadata": { + }, + "interface": { + "inputs": { + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.coin_toss", + "retries": { + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + } + } + }, + { + "id": "n1", + "metadata": { + "name": "test", + "retries": { + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n0.o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "upstreamNodeIds": [ + "n0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "n0.o0" + }, + "rightValue": { + "primitive": { + "boolean": true + } + } + } + }, + "thenNode": { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.success", + "retries": { + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.success", + "version": "abc" + } + } + } + }, + "elseNode": { + "id": "n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.failed", + "retries": { + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.failed", + "version": "abc" + } + } + } + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + } + }, + "tasks": [ + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.success", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.failed", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "INTEGER" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + }, + "b": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + }, + "o1": { + "type": { + "simple": "FLOAT" + }, + "description": "o1" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "BOOLEAN" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/success_8_nested.json b/pkg/compiler/test/testdata/branch/success_8_nested.json new file mode 100755 index 0000000000..d9d8af2617 --- /dev/null +++ b/pkg/compiler/test/testdata/branch/success_8_nested.json @@ -0,0 +1,441 @@ +{ + "workflow": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.so_nested", + "version": "abc" + }, + "metadata": {}, + "interface": { + "inputs": { + "variables": { + "my_input": { + "type": { + "simple": "FLOAT" + }, + "description": "my_input" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "n0", + "metadata": { + "name": "fractions", + "retries": {}, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + } + } + }, + "thenNode": { + "id": "n0", + "metadata": { + "name": "inner_fractions", + "retries": {}, + "interruptible": false + }, + "inputs": [ + { + "var": ".my_input", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "thenNode": { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": {}, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + }, + "other": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.5 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 0.7 + } + } + } + } + } + }, + "thenNode": { + "id": "n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": {}, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + } + ], + "error": { + "failedNodeId": "inner_fractions", + "message": "Only \u003c0.7 allowed" + } + } + } + } + }, + "other": [ + { + "condition": { + "conjunction": { + "leftExpression": { + "comparison": { + "operator": "GT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 1 + } + } + } + }, + "rightExpression": { + "comparison": { + "operator": "LT", + "leftValue": { + "var": ".my_input" + }, + "rightValue": { + "primitive": { + "floatValue": 10 + } + } + } + } + } + }, + "thenNode": { + "id": "n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": {}, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + } + ], + "elseNode": { + "id": "n2", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": {}, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "metadataDefaults": {} + }, + "tasks": [ + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/test/testdata/branch/success_9_nested.json b/pkg/compiler/test/testdata/branch/success_9_nested.json new file mode 100755 index 0000000000..7b6a35b16b --- /dev/null +++ b/pkg/compiler/test/testdata/branch/success_9_nested.json @@ -0,0 +1,453 @@ +{ + "workflow": { + "id": { + "resourceType": "WORKFLOW", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.consume_outputs", + "version": "abc" + }, + "metadata": { + }, + "interface": { + "inputs": { + "variables": { + "my_input": { + "type": { + "simple": "FLOAT" + }, + "description": "my_input" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "nodes": [ + { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.coin_toss", + "retries": { + }, + "interruptible": false + }, + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + } + } + }, + { + "id": "n1", + "metadata": { + "name": "double_or_square", + "retries": { + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n0.o0", + "binding": { + "promise": { + "nodeId": "n0", + "var": "o0" + } + } + } + ], + "upstreamNodeIds": [ + "n0" + ], + "branchNode": { + "ifElse": { + "case": { + "condition": { + "comparison": { + "leftValue": { + "var": "n0.o0" + }, + "rightValue": { + "primitive": { + "boolean": true + } + } + } + }, + "thenNode": { + "id": "n0", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.square", + "retries": { + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + } + } + } + }, + "elseNode": { + "id": "n1", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.sum_diff", + "retries": { + }, + "interruptible": false + }, + "inputs": [ + { + "var": "a", + "binding": { + "promise": { + "var": "my_input" + } + } + }, + { + "var": "b", + "binding": { + "promise": { + "var": "my_input" + } + } + } + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + } + } + } + } + } + }, + { + "id": "n2", + "metadata": { + "name": "flytekit.core.python_function_task.core.control_flow.run_conditions.double", + "retries": { + }, + "interruptible": false + }, + "inputs": [ + { + "var": "n", + "binding": { + "promise": { + "nodeId": "n1", + "var": "o0" + } + } + } + ], + "upstreamNodeIds": [ + "n1" + ], + "taskNode": { + "referenceId": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + } + } + } + ], + "outputs": [ + { + "var": "o0", + "binding": { + "promise": { + "nodeId": "n2", + "var": "o0" + } + } + } + ], + "metadataDefaults": { + } + }, + "tasks": [ + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.double", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.sum_diff", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "a": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + }, + "b": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + }, + "o1": { + "type": { + "simple": "FLOAT" + }, + "description": "o1" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.coin_toss", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "BOOLEAN" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "double", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + }, + { + "id": { + "resourceType": "TASK", + "project": "test_proj", + "domain": "test_domain", + "name": "core.control_flow.run_conditions.square", + "version": "abc" + }, + "type": "python-task", + "metadata": { + "runtime": { + "type": "FLYTE_SDK", + "version": "0.16.0", + "flavor": "python" + }, + "retries": { + }, + "interruptible": false + }, + "interface": { + "inputs": { + "variables": { + "n": { + "type": { + "simple": "FLOAT" + }, + "description": "n" + } + } + }, + "outputs": { + "variables": { + "o0": { + "type": { + "simple": "FLOAT" + }, + "description": "o0" + } + } + } + }, + "container": { + "image": "image:name", + "args": [ + "pyflyte-execute", + "--task-module", + "core.control_flow.run_conditions", + "--task-name", + "square", + "--inputs", + "{{.input}}", + "--output-prefix", + "{{.outputPrefix}}", + "--raw-output-data-prefix", + "{{.rawOutputDataPrefix}}" + ], + "resources": { + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/compiler/transformers/k8s/node.go b/pkg/compiler/transformers/k8s/node.go index 3f5ef5312a..6449be5528 100644 --- a/pkg/compiler/transformers/k8s/node.go +++ b/pkg/compiler/transformers/k8s/node.go @@ -1,11 +1,14 @@ package k8s import ( + "strings" + "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flytepropeller/pkg/apis/flyteworkflow/v1alpha1" "github.com/flyteorg/flytepropeller/pkg/compiler/common" "github.com/flyteorg/flytepropeller/pkg/compiler/errors" "github.com/flyteorg/flytepropeller/pkg/utils" + "github.com/go-test/deep" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -187,8 +190,10 @@ func buildNodes(nodes []*core.Node, tasks []*core.CompiledTask, errs errors.Comp for _, nref := range nodeSpecs { n := nref - if _, exists := res[n.ID]; exists { - errs.Collect(errors.NewValueCollisionError(nodeBuilder.GetId(), "Id", n.ID)) + if existingNode, exists := res[n.ID]; exists { + if diff := deep.Equal(existingNode, n); diff != nil { + errs.Collect(errors.NewValueCollisionError(nodeBuilder.GetId(), strings.Join(diff, "\r\n"), n.ID)) + } } res[n.ID] = n diff --git a/pkg/compiler/validators/bindings.go b/pkg/compiler/validators/bindings.go index 3016838b93..c7cac69424 100644 --- a/pkg/compiler/validators/bindings.go +++ b/pkg/compiler/validators/bindings.go @@ -99,16 +99,8 @@ func validateBinding(w c.WorkflowBuilder, nodeID c.NodeID, nodeParam string, bin return nil, nil, !errs.HasErrors() } -type EdgeDirection uint8 - -const ( - EdgeDirectionBidirectional EdgeDirection = iota - EdgeDirectionDownstream - EdgeDirectionUpstream -) - func ValidateBindings(w c.WorkflowBuilder, node c.Node, bindings []*flyte.Binding, params *flyte.VariableMap, - validateParamTypes bool, edgeDirection EdgeDirection, errs errors.CompileErrors) (resolved *flyte.VariableMap, ok bool) { + validateParamTypes bool, edgeDirection c.EdgeDirection, errs errors.CompileErrors) (resolved *flyte.VariableMap, ok bool) { resolved = &flyte.VariableMap{ Variables: make(map[string]*flyte.Variable, len(bindings)), @@ -136,11 +128,11 @@ func ValidateBindings(w c.WorkflowBuilder, node c.Node, bindings []*flyte.Bindin for _, upNode := range upstreamNodes { // Add implicit Edges switch edgeDirection { - case EdgeDirectionBidirectional: + case c.EdgeDirectionBidirectional: w.AddExecutionEdge(upNode, node.GetId()) - case EdgeDirectionDownstream: + case c.EdgeDirectionDownstream: w.AddDownstreamEdge(upNode, node.GetId()) - case EdgeDirectionUpstream: + case c.EdgeDirectionUpstream: w.AddUpstreamEdge(upNode, node.GetId()) } } diff --git a/pkg/compiler/validators/bindings_test.go b/pkg/compiler/validators/bindings_test.go index 9c5f2bc742..181062d5eb 100644 --- a/pkg/compiler/validators/bindings_test.go +++ b/pkg/compiler/validators/bindings_test.go @@ -3,6 +3,8 @@ package validators import ( "testing" + c "github.com/flyteorg/flytepropeller/pkg/compiler/common" + "github.com/flyteorg/flyteidl/clients/go/coreutils" "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flytepropeller/pkg/compiler/common/mocks" @@ -19,7 +21,7 @@ func TestValidateBindings(t *testing.T) { bindings := []*core.Binding{} vars := &core.VariableMap{} compileErrors := compilerErrors.NewCompileErrors() - resolved, ok := ValidateBindings(wf, n, bindings, vars, true, EdgeDirectionBidirectional, compileErrors) + resolved, ok := ValidateBindings(wf, n, bindings, vars, true, c.EdgeDirectionBidirectional, compileErrors) assert.True(t, ok) assert.Empty(t, resolved.Variables) }) @@ -35,7 +37,7 @@ func TestValidateBindings(t *testing.T) { } vars := &core.VariableMap{} compileErrors := compilerErrors.NewCompileErrors() - _, ok := ValidateBindings(wf, n, bindings, vars, true, EdgeDirectionBidirectional, compileErrors) + _, ok := ValidateBindings(wf, n, bindings, vars, true, c.EdgeDirectionBidirectional, compileErrors) assert.False(t, ok) if !compileErrors.HasErrors() { assert.Error(t, compileErrors) @@ -67,7 +69,7 @@ func TestValidateBindings(t *testing.T) { } compileErrors := compilerErrors.NewCompileErrors() - _, ok := ValidateBindings(wf, n, bindings, vars, true, EdgeDirectionBidirectional, compileErrors) + _, ok := ValidateBindings(wf, n, bindings, vars, true, c.EdgeDirectionBidirectional, compileErrors) assert.False(t, ok) if !compileErrors.HasErrors() { assert.Error(t, compileErrors) @@ -96,7 +98,7 @@ func TestValidateBindings(t *testing.T) { } compileErrors := compilerErrors.NewCompileErrors() - _, ok := ValidateBindings(wf, n, bindings, vars, true, EdgeDirectionBidirectional, compileErrors) + _, ok := ValidateBindings(wf, n, bindings, vars, true, c.EdgeDirectionBidirectional, compileErrors) assert.True(t, ok) if compileErrors.HasErrors() { assert.NoError(t, compileErrors) @@ -130,7 +132,7 @@ func TestValidateBindings(t *testing.T) { } compileErrors := compilerErrors.NewCompileErrors() - _, ok := ValidateBindings(wf, n, bindings, vars, true, EdgeDirectionBidirectional, compileErrors) + _, ok := ValidateBindings(wf, n, bindings, vars, true, c.EdgeDirectionBidirectional, compileErrors) assert.True(t, ok) if compileErrors.HasErrors() { assert.NoError(t, compileErrors) @@ -192,7 +194,7 @@ func TestValidateBindings(t *testing.T) { } compileErrors := compilerErrors.NewCompileErrors() - _, ok := ValidateBindings(wf, n, bindings, vars, true, EdgeDirectionBidirectional, compileErrors) + _, ok := ValidateBindings(wf, n, bindings, vars, true, c.EdgeDirectionBidirectional, compileErrors) assert.True(t, ok) if compileErrors.HasErrors() { assert.NoError(t, compileErrors) diff --git a/pkg/compiler/validators/branch.go b/pkg/compiler/validators/branch.go index 66084b556b..5d3849d8aa 100644 --- a/pkg/compiler/validators/branch.go +++ b/pkg/compiler/validators/branch.go @@ -8,6 +8,10 @@ import ( ) func validateBranchInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs errors.CompileErrors) (iface *flyte.TypedInterface, ok bool) { + if node.GetInterface() != nil { + return node.GetInterface(), true + } + if branch := node.GetBranchNode(); branch == nil { errs.Collect(errors.NewValueRequiredErr(node.GetId(), "Branch")) return @@ -28,15 +32,18 @@ func validateBranchInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs error return } - finalOutputParameterNames := sets.NewString() - var outputs map[string]*flyte.Variable - outputsSet := sets.NewString() + finalOutputParameterNames := sets.NewString() validateIfaceMatch := func(nodeId string, iface2 *flyte.TypedInterface, errsScope errors.CompileErrors) (match bool) { outputs2, outputs2Set := buildVariablesIndex(iface2.Outputs) - validateVarsSetMatch(nodeId, outputs, outputs2, outputsSet, outputs2Set, errsScope.NewScope()) + // Validate that parameters that exist in both interfaces have compatible types. finalOutputParameterNames = finalOutputParameterNames.Intersection(outputs2Set) + for paramName := range finalOutputParameterNames { + if validateVarType(nodeId, paramName, outputs[paramName], outputs2[paramName].Type, errs.NewScope()) { + validateVarType(nodeId, paramName, outputs2[paramName], outputs[paramName].Type, errs.NewScope()) + } + } return !errsScope.HasErrors() } @@ -60,16 +67,13 @@ func validateBranchInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs error } for _, block := range cases { - n := w.NewNodeBuilder(block) + n := w.GetOrCreateNodeBuilder(block) + n.SetID(branchNodeIDFormatter(node.GetId(), n.GetId())) iface2, ok := ValidateUnderlyingInterface(w, n, errs.NewScope()) - if !ok { continue } - ValidateBindings(w, n, n.GetInputs(), &flyte.VariableMap{Variables: map[string]*flyte.Variable{}}, - false, EdgeDirectionUpstream, errs.NewScope()) - // Clear out the Inputs. We do not care if the inputs of each of the underlying nodes // match. We will pull the inputs needed for the underlying branch node at runtime. iface2 = &flyte.TypedInterface{ @@ -79,8 +83,7 @@ func validateBranchInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs error if iface == nil { iface = iface2 - outputs, outputsSet = buildVariablesIndex(iface.Outputs) - finalOutputParameterNames = finalOutputParameterNames.Union(outputsSet) + outputs, finalOutputParameterNames = buildVariablesIndex(iface.Outputs) } else { validateIfaceMatch(n.GetId(), iface2, errs.NewScope()) } @@ -90,7 +93,7 @@ func validateBranchInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs error // When we come to validate the conditions themselves, we will look up these variables and fail if a variable is used // in a condition but doesn't have a node input binding. inputVarsFromBindings, _ := ValidateBindings(w, node, node.GetInputs(), &flyte.VariableMap{Variables: map[string]*flyte.Variable{}}, - false, EdgeDirectionUpstream, errs.NewScope()) + false, c.EdgeDirectionUpstream, errs.NewScope()) if !errs.HasErrors() && iface != nil { iface = &flyte.TypedInterface{ diff --git a/pkg/compiler/validators/branch_test.go b/pkg/compiler/validators/branch_test.go index 2c04aa110e..4c28e3fd3a 100644 --- a/pkg/compiler/validators/branch_test.go +++ b/pkg/compiler/validators/branch_test.go @@ -49,6 +49,8 @@ func Test_validateBranchInterface(t *testing.T) { n2.OnGetTaskNode().Return(taskNode) n2.On("SetInterface", mock.Anything) n2.OnGetInputs().Return([]*core.Binding{}) + n2.On("SetID", mock.Anything).Return() + n2.OnGetInterface().Return(nil) task := &mocks.Task{} task.OnGetInterface().Return(&core.TypedInterface{}) @@ -57,10 +59,12 @@ func Test_validateBranchInterface(t *testing.T) { wf.OnGetTask(identifier).Return(task, true) errs := compilerErrors.NewCompileErrors() - wf.OnNewNodeBuilder(coreN2).Return(n2) + wf.OnGetOrCreateNodeBuilder(coreN2).Return(n2) t.Run("single branch", func(t *testing.T) { n := &mocks.NodeBuilder{} + n.OnGetInterface().Return(nil) + n.On("SetID", mock.Anything).Return() n.OnGetId().Return("n1") n.OnGetBranchNode().Return(&core.BranchNode{ IfElse: &core.IfElseBlock{ @@ -90,6 +94,7 @@ func Test_validateBranchInterface(t *testing.T) { t.Run("two conditions", func(t *testing.T) { n := &mocks.NodeBuilder{} n.OnGetId().Return("n1") + n.OnGetInterface().Return(nil) n.OnGetInputs().Return([]*core.Binding{}) n.OnGetBranchNode().Return(&core.BranchNode{ IfElse: &core.IfElseBlock{ diff --git a/pkg/compiler/validators/interface.go b/pkg/compiler/validators/interface.go index c82511d6b5..aa0524319c 100644 --- a/pkg/compiler/validators/interface.go +++ b/pkg/compiler/validators/interface.go @@ -34,6 +34,10 @@ func ValidateInterface(nodeID c.NodeID, iface *core.TypedInterface, errs errors. // Validates underlying interface of a node and returns the effective Typed Interface. func ValidateUnderlyingInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs errors.CompileErrors) (iface *core.TypedInterface, ok bool) { + if node.GetInterface() != nil { + return node.GetInterface(), true + } + switch node.GetCoreNode().GetTarget().(type) { case *core.Node_TaskNode: if node.GetTaskNode().GetReferenceId() == nil { diff --git a/pkg/compiler/validators/interface_test.go b/pkg/compiler/validators/interface_test.go index 70bef98328..2d4742f0fe 100644 --- a/pkg/compiler/validators/interface_test.go +++ b/pkg/compiler/validators/interface_test.go @@ -72,8 +72,9 @@ func TestValidateUnderlyingInterface(t *testing.T) { t.Run("Invalid empty node", func(t *testing.T) { wfBuilder := mocks.WorkflowBuilder{} nodeBuilder := mocks.NodeBuilder{} - nodeBuilder.On("GetCoreNode").Return(&core.Node{}) - nodeBuilder.On("GetId").Return("node_1") + nodeBuilder.OnGetCoreNode().Return(&core.Node{}) + nodeBuilder.OnGetId().Return("node_1") + nodeBuilder.OnGetInterface().Return(nil) errs := errors.NewCompileErrors() iface, ifaceOk := ValidateUnderlyingInterface(&wfBuilder, &nodeBuilder, errs.NewScope()) assert.False(t, ifaceOk) @@ -106,6 +107,7 @@ func TestValidateUnderlyingInterface(t *testing.T) { TaskNode: taskNode, }, }) + nodeBuilder.OnGetInterface().Return(nil) nodeBuilder.On("GetTaskNode").Return(taskNode) nodeBuilder.On("GetId").Return("node_1") @@ -144,6 +146,7 @@ func TestValidateUnderlyingInterface(t *testing.T) { nodeBuilder.On("GetId").Return("node_1") nodeBuilder.On("SetInterface", mock.Anything).Return() nodeBuilder.On("GetInputs").Return([]*core.Binding{}) + nodeBuilder.OnGetInterface().Return(nil) t.Run("Self", func(t *testing.T) { errs := errors.NewCompileErrors() diff --git a/pkg/compiler/validators/node.go b/pkg/compiler/validators/node.go index 14d4e7aa54..e9a81f0a01 100644 --- a/pkg/compiler/validators/node.go +++ b/pkg/compiler/validators/node.go @@ -73,13 +73,13 @@ func ValidateBranchNode(w c.WorkflowBuilder, n c.NodeBuilder, requireParamType b if block.GetThenNode() == nil { errs.Collect(errors.NewBranchNodeNotSpecified(n.GetId())) } else { - wrapperNode := w.NewNodeBuilder(block.GetThenNode()) + wrapperNode := w.GetOrCreateNodeBuilder(block.GetThenNode()) subNodes = append(subNodes, wrapperNode) } } if elseNode := n.GetBranchNode().IfElse.GetElseNode(); elseNode != nil { - wrapperNode := w.NewNodeBuilder(elseNode) + wrapperNode := w.GetOrCreateNodeBuilder(elseNode) subNodes = append(subNodes, wrapperNode) } else if defaultElse := n.GetBranchNode().IfElse.GetDefault(); defaultElse == nil { errs.Collect(errors.NewBranchNodeHasNoDefault(n.GetId())) @@ -123,11 +123,8 @@ func ValidateNode(w c.WorkflowBuilder, n c.NodeBuilder, validateConditionTypes b // Validate branch node conditions and inner nodes. if n.GetBranchNode() != nil { if nodes, ok := ValidateBranchNode(w, n, validateConditionTypes, errs.NewScope()); ok { - renamedNodes := make(map[c.NodeID]c.NodeID, len(nodes)) for _, subNode := range nodes { - oldID := subNode.GetId() - subNode.SetID(branchNodeIDFormatter(n.GetId(), subNode.GetId())) - renamedNodes[oldID] = subNode.GetId() + w.AddEdges(subNode, c.EdgeDirectionUpstream, errs.NewScope()) } } } else if workflowN := n.GetWorkflowNode(); workflowN != nil && workflowN.GetSubWorkflowRef() != nil { diff --git a/pkg/compiler/validators/vars.go b/pkg/compiler/validators/vars.go index a3f2ca61d4..a01ab062cf 100644 --- a/pkg/compiler/validators/vars.go +++ b/pkg/compiler/validators/vars.go @@ -4,7 +4,6 @@ import ( flyte "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" c "github.com/flyteorg/flytepropeller/pkg/compiler/common" "github.com/flyteorg/flytepropeller/pkg/compiler/errors" - "k8s.io/apimachinery/pkg/util/sets" ) func validateOutputVar(n c.NodeBuilder, paramName string, errs errors.CompileErrors) ( @@ -47,28 +46,6 @@ func validateVarType(nodeID c.NodeID, paramName string, param *flyte.Variable, return !errs.HasErrors() } -func validateVarsSetMatch(nodeID string, params1, params2 map[string]*flyte.Variable, - params1Set, params2Set sets.String, errs errors.CompileErrors) { - // Validate that parameters that exist in both interfaces have compatible types. - inBoth := params1Set.Intersection(params2Set) - for paramName := range inBoth { - if validateVarType(nodeID, paramName, params1[paramName], params2[paramName].Type, errs.NewScope()) { - validateVarType(nodeID, paramName, params2[paramName], params1[paramName].Type, errs.NewScope()) - } - } - - // All remaining params on either sides indicate errors - inLeftSide := params1Set.Difference(params2Set) - for range inLeftSide { - errs.Collect(errors.NewMismatchingInterfacesErr(nodeID, nodeID)) - } - - inRightSide := params2Set.Difference(params1Set) - for range inRightSide { - errs.Collect(errors.NewMismatchingInterfacesErr(nodeID, nodeID)) - } -} - // Validate parameters have their required attributes set func validateVariables(nodeID c.NodeID, params *flyte.VariableMap, errs errors.CompileErrors) { for paramName, param := range params.Variables { diff --git a/pkg/compiler/workflow_compiler.go b/pkg/compiler/workflow_compiler.go index 68c1e98aa9..f0828a40ce 100755 --- a/pkg/compiler/workflow_compiler.go +++ b/pkg/compiler/workflow_compiler.go @@ -143,7 +143,7 @@ func (w workflowBuilder) AddExecutionEdge(nodeFrom, nodeTo c.NodeID) { w.AddUpstreamEdge(nodeFrom, nodeTo) } -func (w workflowBuilder) AddEdges(n c.NodeBuilder, errs errors.CompileErrors) (ok bool) { +func (w workflowBuilder) AddEdges(n c.NodeBuilder, edgeDirection c.EdgeDirection, errs errors.CompileErrors) (ok bool) { if n.GetInterface() == nil { // If there were errors computing node's interface, don't add any edges and just bail. return @@ -158,7 +158,7 @@ func (w workflowBuilder) AddEdges(n c.NodeBuilder, errs errors.CompileErrors) (o // Add implicit Edges _, ok = v.ValidateBindings(&w, n, n.GetInputs(), n.GetInterface().GetInputs(), - true /* validateParamTypes */, v.EdgeDirectionBidirectional, errs.NewScope()) + true /* validateParamTypes */, edgeDirection, errs.NewScope()) return } @@ -192,11 +192,11 @@ func (w workflowBuilder) ValidateWorkflow(fg *flyteWorkflow, errs errors.Compile Upstream: make(map[string]*core.ConnectionSet_IdList), } - globalInputNode, _ := wf.AddNode(wf.NewNodeBuilder(startNode), errs) + globalInputNode, _ := wf.AddNode(wf.GetOrCreateNodeBuilder(startNode), errs) globalInputNode.SetInterface(&core.TypedInterface{Outputs: wf.CoreWorkflow.Template.Interface.Inputs}) endNode := &core.Node{Id: c.EndNodeID} - globalOutputNode, _ := wf.AddNode(wf.NewNodeBuilder(endNode), errs) + globalOutputNode, _ := wf.AddNode(wf.GetOrCreateNodeBuilder(endNode), errs) globalOutputNode.SetInterface(&core.TypedInterface{Inputs: wf.CoreWorkflow.Template.Interface.Outputs}) globalOutputNode.SetInputs(wf.CoreWorkflow.Template.Outputs) @@ -208,40 +208,18 @@ func (w workflowBuilder) ValidateWorkflow(fg *flyteWorkflow, errs errors.Compile // Add and validate all other nodes for _, n := range checkpoint { topLevelNodes.Insert(n.Id) - if node, addOk := wf.AddNode(wf.NewNodeBuilder(n), errs.NewScope()); addOk { + if node, addOk := wf.AddNode(wf.GetOrCreateNodeBuilder(n), errs.NewScope()); addOk { v.ValidateNode(&wf, node, false /* validateConditionTypes */, errs.NewScope()) } } - // At this point, all nodes except branch nodes have populated all their input and output interfaces, - // Because conditions in branch nodes do not carry type information with them for the variables involved (e.g. - // if x == y), we need to wait till all nodes have populated their interfaces before we can resolve x and y to their - // original types and then validate whether they are compatible for comparison. - if !errs.HasErrors() { - for _, n := range wf.Nodes { - if n.GetBranchNode() != nil { - if inputVars, ok := v.ValidateBindings(&wf, n, n.GetInputs(), n.GetInterface().GetInputs(), - false /* validateParamTypes */, v.EdgeDirectionUpstream, errs.NewScope()); ok { - merge, err := v.UnionDistinctVariableMaps(n.GetInterface().Inputs.Variables, inputVars.Variables) - if err != nil { - errs.Collect(errors.NewWorkflowBuildError(err)) - } - - n.GetInterface().Inputs = &core.VariableMap{Variables: merge} - - v.ValidateBranchNode(&wf, n, true /* validateConditionTypes */, errs.NewScope()) - } - } - } - } - // Add explicitly and implicitly declared edges for nodeID, n := range wf.Nodes { if nodeID == c.StartNodeID { continue } - wf.AddEdges(n, errs.NewScope()) + wf.AddEdges(n, c.EdgeDirectionBidirectional, errs.NewScope()) } // Add execution edges for orphan nodes that don't have any inward/outward edges. @@ -274,7 +252,7 @@ func (w workflowBuilder) ValidateWorkflow(fg *flyteWorkflow, errs errors.Compile if _, wfIfaceOk := v.ValidateInterface(globalOutputNode.GetId(), globalOutputNode.GetInterface(), errs.NewScope()); wfIfaceOk { v.ValidateBindings(&wf, globalOutputNode, globalOutputNode.GetInputs(), globalOutputNode.GetInterface().GetInputs(), true, /* validateParamTypes */ - v.EdgeDirectionBidirectional, errs.NewScope()) + c.EdgeDirectionBidirectional, errs.NewScope()) } // Validate no cycles are detected. @@ -383,6 +361,7 @@ func newWorkflowBuilder(fg *flyteWorkflow, wfIndex c.WorkflowIndex, tasks c.Task CoreWorkflow: fg, LaunchPlans: map[string]c.InterfaceProvider{}, Nodes: c.NewNodeIndex(), + NodeBuilderIndex: c.NewNodeIndex(), Tasks: c.NewTaskIndex(), downstreamNodes: c.StringAdjacencyList{}, upstreamNodes: c.StringAdjacencyList{}, diff --git a/pkg/compiler/workflow_compiler_test.go b/pkg/compiler/workflow_compiler_test.go index 3b4617fc2c..272bba3cdc 100755 --- a/pkg/compiler/workflow_compiler_test.go +++ b/pkg/compiler/workflow_compiler_test.go @@ -390,7 +390,10 @@ func newNodeIDSet(nodeIDs ...common.NodeID) sets.String { } func TestValidateReachable(t *testing.T) { - graph := &workflowBuilder{} + graph := &workflowBuilder{ + NodeBuilderIndex: common.NewNodeIndex(), + } + graph.downstreamNodes = map[string]sets.String{ v1alpha1.StartNodeID: newNodeIDSet("1"), "1": newNodeIDSet("5", "2"), @@ -400,7 +403,7 @@ func TestValidateReachable(t *testing.T) { } for range graph.downstreamNodes { - graph.Nodes = common.NewNodeIndex(graph.NewNodeBuilder(nil)) + graph.Nodes = common.NewNodeIndex(graph.GetOrCreateNodeBuilder(nil)) } errs := errors.NewCompileErrors()