Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Create new boundary to run onExit nodes #5478

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cmd/argo/commands/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,14 @@ func convertToRenderTrees(wf *wfv1.Workflow) map[string]renderNode {
// Used to store children of a boundary node that has not been parsed yet
// Maps boundary Node name -> array of render Children
parentBoundaryMap := make(map[string][]renderNode)

// Used to store Non Boundary Parent nodes so render children can attach
// Maps non Boundary Parent Node name -> *nonBoundaryParentNode
nonBoundaryParentMap := make(map[string]*nonBoundaryParentNode)
// Used to store children which have a Non Boundary Parent from rendering perspective
// Maps non Boundary render Children name -> *nonBoundaryParentNode
nonBoundaryParentChildrenMap := make(map[string]*nonBoundaryParentNode)
// A node is a boundary node if any other node references it in its own node.boundaryID field.
isBoundaryNodeMap := make(map[string]bool)

// We have to do a 2 pass approach because anything that is a child
// of a nonBoundaryParent and also has a boundaryID we may not know which
Expand All @@ -371,6 +372,9 @@ func convertToRenderTrees(wf *wfv1.Workflow) map[string]renderNode {
log.Fatal("Missing node type in status node. Cannot get workflows created with Argo <= 2.0 using the default or wide output option.")
return nil
}

isBoundaryNodeMap[status.BoundaryID] = true

if isNonBoundaryParentNode(status.Type) {
n := nonBoundaryParentNode{nodeInfo: nodeInfo{id: id}}
nonBoundaryParentMap[id] = &n
Expand All @@ -384,7 +388,7 @@ func convertToRenderTrees(wf *wfv1.Workflow) map[string]renderNode {
// 2nd Pass process everything
for id, status := range wf.Status.Nodes {
switch {
case isBoundaryNode(status.Type):
case isBoundaryNode(status.Type) || isBoundaryNodeMap[status.ID]:
n := boundaryNode{nodeInfo: nodeInfo{id: id}}
boundaryNodeMap[id] = &n
// Attach to my parent if needed
Expand Down
4 changes: 2 additions & 2 deletions workflow/controller/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (woc *wfOperationCtx) executeDAG(ctx context.Context, nodeName string, tmpl
if taskNode.Completed() {
// Run the node's onExit node, if any. Since this is a target task, we don't need to consider the status
// of the onExit node before continuing. That will be done in assesDAGPhase
_, _, err := woc.runOnExitNode(ctx, dagCtx.GetTask(taskName).OnExit, taskName, taskNode.Name, dagCtx.boundaryID, dagCtx.tmplCtx)
_, _, err := woc.runOnExitNode(ctx, dagCtx.GetTask(taskName).OnExit, taskName, taskNode.Name, taskNode.ID, dagCtx.tmplCtx)
if err != nil {
return node, err
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func (woc *wfOperationCtx) executeDAGTask(ctx context.Context, dagCtx *dagContex

if node.Completed() {
// Run the node's onExit node, if any.
hasOnExitNode, onExitNode, err := woc.runOnExitNode(ctx, task.OnExit, task.Name, node.Name, dagCtx.boundaryID, dagCtx.tmplCtx)
hasOnExitNode, onExitNode, err := woc.runOnExitNode(ctx, task.OnExit, task.Name, node.Name, node.ID, dagCtx.tmplCtx)
if hasOnExitNode && (onExitNode == nil || !onExitNode.Fulfilled() || err != nil) {
// The onExit node is either not complete or has errored out, return.
return
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (woc *wfOperationCtx) executeStepGroup(ctx context.Context, stepGroup []wfv
if !childNode.Fulfilled() {
completed = false
} else if childNode.Completed() {
hasOnExitNode, onExitNode, err := woc.runOnExitNode(ctx, step.OnExit, step.Name, childNode.Name, stepsCtx.boundaryID, stepsCtx.tmplCtx)
hasOnExitNode, onExitNode, err := woc.runOnExitNode(ctx, step.OnExit, step.Name, childNode.Name, childNodeID, stepsCtx.tmplCtx)
if hasOnExitNode && (onExitNode == nil || !onExitNode.Fulfilled() || err != nil) {
// The onExit node is either not complete or has errored out, return.
completed = false
Expand Down