Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pkg/payload/task_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ func RunGraph(ctx context.Context, graph *TaskGraph, maxParallelism int, fn func
incompleteCount := 0
for i, result := range results {
if result == nil {
if firstIncompleteNode == nil {
if firstIncompleteNode == nil && len(graph.Nodes[i].Tasks) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do this, the check on line 548 needs to consider the case where firstIncompleteNode is nil and the incompleteCount is greater than zero.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 548 already has a guard for firstIncompleteNode != nil. If incompleteCount is greater than zero, and firstIncompleteNode is nil, I'm not sure we care, since no meaningful work was left on the table. But I can check nextNode to make sure...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure why the Task i.e. .Tasks[0] is nil.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but you don't produce the error in that case

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure why the Task i.e. .Tasks[0] is nil.

We have empty placeholder nodes in the graph, like:

Screenshot 2021-02-01 at 15 11 34

But I can check nextNode to make sure...

I'm pretty sure we're fine with the change I'm proposing, without needing to involve nextNode. Cases:

  • All result-less nodes have no tasks. Then with my change I will never set firstIncompleteNode, and we will not inject an incomplete task nodes, beginning with... error. But there were no outstanding tasks, so not injecting that error is an improvement.
  • The first result-less node has at least one task. Then that matches my guard, and we get exactly the same non-panicky firstIncompleteNode handling as we have in master today.
  • The first result-less node has no tasks, but some later result-less node has at least one task. Then that later node will match my guard, and we'll mention it with a incomplete task nodes, beginning with... error instead of panicking (where we panic today).

firstIncompleteNode = graph.Nodes[i]
}
incompleteCount++
Expand Down