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: Ensure task dependencies run after onExit handler is fulfilled #3435

Merged
merged 5 commits into from
Jul 9, 2020

Conversation

simster7
Copy link
Member

@simster7 simster7 commented Jul 9, 2020

Fixes: #3431
Fixes: #3432

Not ready for review.

Tests are not expected to pass Tests should now pass
Still need to write new tests Added tests

@@ -1764,6 +1760,12 @@ func TestOnExitNonLeaf(t *testing.T) {
if assert.NotNil(t, retryNode) {
assert.Equal(t, wfv1.NodePending, retryNode.Phase)
}

assert.Nil(t, woc.getNodeByName("exit-handler-bug-example.step-3"))
Copy link
Member Author

Choose a reason for hiding this comment

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

This modified test tests for the new expected behavior and in particular this line: step-3 should not run until the exit handler has finished

@simster7 simster7 marked this pull request as ready for review July 9, 2020 18:08
@simster7 simster7 requested a review from alexec July 9, 2020 18:14
return false, false, nil
}
}

Copy link
Member Author

@simster7 simster7 Jul 9, 2020

Choose a reason for hiding this comment

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

Note that this is not a regression of 2.9 or the DAG refactor, rather an already existing bug that hasn't been brought up before: in DAGs, the onExit handler of a task runs concurrently with the task's dependent steps, rather than waiting for the onExit handler to finish before running, as is done in steps

@simster7 simster7 changed the title fix: Race condition in determining DAG Phase when onExit nodes are present fix: Ensure task dependencies run after onExit handler is fulfilled Jul 9, 2020
return nil
}
return &node
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This function is just ported from the controller, this is not new code.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we call FindNodeByName as it return nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

Every instance where this is used there is a nil check done

Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

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

minor comments

return nil
}
return &node
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we call FindNodeByName as it return nil?

@@ -452,12 +452,7 @@ func (woc *wfOperationCtx) setGlobalParameters(executionParameters wfv1.Argument
}

func (woc *wfOperationCtx) getNodeByName(nodeName string) *wfv1.NodeStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

just inline?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants