Skip to content

Commit

Permalink
[Compiler] When multiple nodes call the same workflow, the compiler a…
Browse files Browse the repository at this point in the history
…ttempts to validate an already compiled WF (flyteorg#210)
  • Loading branch information
EngHabu authored Dec 3, 2020
1 parent b787e89 commit be093b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/compiler/validators/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ func ValidateNode(w c.WorkflowBuilder, n c.NodeBuilder, validateConditionTypes b
errs.Collect(errors.NewValueRequiredErr("<node>", "Id"))
}

if n.GetId() == c.StartNodeID || n.GetId() == c.EndNodeID {
return true
}

if _, ifaceOk := ValidateUnderlyingInterface(w, n, errs.NewScope()); ifaceOk {
// Validate node output aliases
validateEffectiveOutputParameters(n, errs.NewScope())
Expand Down
14 changes: 14 additions & 0 deletions pkg/compiler/validators/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package validators
import (
"testing"

"github.com/lyft/flytepropeller/pkg/compiler/common"

"github.com/lyft/flyteidl/gen/pb-go/flyteidl/core"

"github.com/lyft/flytepropeller/pkg/compiler/common/mocks"
Expand Down Expand Up @@ -33,3 +35,15 @@ func TestValidateBranchNode(t *testing.T) {
}
})
}

func TestValidateNode(t *testing.T) {
n := &mocks.NodeBuilder{}
n.OnGetId().Return(common.StartNodeID)

wf := &mocks.WorkflowBuilder{}
errs := errors.NewCompileErrors()
ValidateNode(wf, n, true, errs)
if errs.HasErrors() {
assert.NoError(t, errs)
}
}

0 comments on commit be093b9

Please sign in to comment.