MCPcopy
hub / github.com/argoproj/argo-workflows / updateOutboundNodes

Method updateOutboundNodes

workflow/controller/steps.go:200–230  ·  view source on GitHub ↗

updateOutboundNodes set the outbound nodes from the last step group

(ctx context.Context, nodeName string, tmpl *wfv1.Template)

Source from the content-addressed store, hash-verified

198
199// updateOutboundNodes set the outbound nodes from the last step group
200func (woc *wfOperationCtx) updateOutboundNodes(ctx context.Context, nodeName string, tmpl *wfv1.Template) error {
201 outbound := make([]string, 0)
202 // Find the last, initialized stepgroup node
203 var lastSGNode *wfv1.NodeStatus
204 var err error
205 for i := len(tmpl.Steps) - 1; i >= 0; i-- {
206 var sgNode *wfv1.NodeStatus
207 sgNode, err = woc.wf.GetNodeByName(fmt.Sprintf("%s[%d]", nodeName, i))
208 if err == nil {
209 lastSGNode = sgNode
210 break
211 }
212 }
213 if lastSGNode == nil {
214 woc.log.WithField("name", nodeName).Warn(ctx, "node had no initialized StepGroup nodes")
215 return err
216 }
217 for _, childID := range lastSGNode.Children {
218 outboundNodeIDs := woc.getOutboundNodes(ctx, childID)
219 woc.log.WithFields(logging.Fields{"childID": childID, "outboundNodeIDs": outboundNodeIDs}).Info(ctx, "Outbound nodes")
220 outbound = append(outbound, outboundNodeIDs...)
221 }
222 node, err := woc.wf.GetNodeByName(nodeName)
223 if err != nil {
224 return err
225 }
226 woc.log.WithFields(logging.Fields{"nodeID": node.ID, "outbound": outbound}).Info(ctx, "Outbound nodes")
227 node.OutboundNodes = outbound
228 woc.wf.Status.Nodes.Set(ctx, node.ID, *node)
229 return nil
230}
231
232// executeStepGroup examines a list of parallel steps and executes them in parallel.
233// Handles referencing of variables in scope, expands `withItem` clauses, and evaluates `when` expressions

Callers 1

executeStepsMethod · 0.95

Calls 7

getOutboundNodesMethod · 0.95
GetNodeByNameMethod · 0.80
WarnMethod · 0.65
WithFieldMethod · 0.65
InfoMethod · 0.65
WithFieldsMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected