Skip to content

Commit

Permalink
Add refKey to taks and rename nodeKey in reference
Browse files Browse the repository at this point in the history
  • Loading branch information
krhubert committed Dec 12, 2019
1 parent f6b105e commit 43d89e3
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 94 deletions.
4 changes: 2 additions & 2 deletions e2e/orchestrator_event_map_task_map_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func testOrchestratorEventMapTaskMapTask(executionStream pb.Execution_StreamClie
"msg": {
Value: &process.Process_Node_Map_Output_Ref{
Ref: &process.Process_Node_Map_Output_Reference{
NodeKey: "n0",
Key: "msg",
RefKey: "n0",
Key: "msg",
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/orchestrator_result_map_task_map_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func testOrchestratorResultMapTaskMapTask(executionStream pb.Execution_StreamCli
"msg": {
Value: &process.Process_Node_Map_Output_Ref{
Ref: &process.Process_Node_Map_Output_Reference{
NodeKey: "n0",
Key: "msg",
RefKey: "n0",
Key: "msg",
},
},
},
Expand Down
14 changes: 7 additions & 7 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ func (s *Orchestrator) outputToValue(output *process.Process_Node_Map_Output, wf
},
}, nil
case *process.Process_Node_Map_Output_Ref:
node, err := wf.FindNode(v.Ref.NodeKey)
if err != nil {
return nil, err
}
if node.GetTask() != nil {
return s.resolveInput(wf.Hash, exec, v.Ref.NodeKey, v.Ref.Key)
nodes := wf.FindNodes(func(n *process.Process_Node) bool {
task := n.GetTask()
return task != nil && task.RefKey == v.Ref.RefKey
})
if len(nodes) != 1 {
return nil, fmt.Errorf("reference's key not found")
}
return data.Fields[v.Ref.Key], nil
return s.resolveInput(wf.Hash, exec, v.Ref.RefKey, v.Ref.Key)
default:
return nil, errors.New("unknown output")
}
Expand Down
2 changes: 1 addition & 1 deletion process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (w *Process) Validate() error {
if mapNode != nil {
for _, output := range mapNode.Outputs {
if ref := output.GetRef(); ref != nil {
if _, err := w.FindNode(ref.NodeKey); err != nil {
if _, err := w.FindNode(ref.RefKey); err != nil {
return err
}
}
Expand Down
150 changes: 78 additions & 72 deletions process/process.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 43d89e3

Please sign in to comment.