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: Use a unique queue to visit nodes #3418
Conversation
workflow/controller/dag.go
Outdated
@@ -127,6 +127,42 @@ func generatePhaseNodes(children []string, branchPhase wfv1.NodePhase) []phaseNo | |||
return out | |||
} | |||
|
|||
type uniqueQueue struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
own file and tests obvs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on it as we speak
// If a phaseNode has already existed, it will not be added silently | ||
func (uq *uniquePhaseNodeQueue) add(nodes ...phaseNode) { | ||
for _, node := range nodes { | ||
key := fmt.Sprintf("%s-%s", node.nodeId, node.phase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick explanation: if an omitted node is reached first from a step that succeeded, we consider the omitted node succeeded. However, it may be subsequently reached from another step that did not succeed. In that case we want to update the deduced status of the omitted node, and we may only do so by adding it to the queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I added this explanation as a comment as well)
workflow/controller/phase_node.go
Outdated
} | ||
|
||
func (uq *uniquePhaseNodeQueue) pop() phaseNode { | ||
var toPop phaseNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you call this head
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, much better name
No description provided.