-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: cache configmap don't create with workflow has retrystrategy. Fixes: #12490 #10426 #12491
fix: cache configmap don't create with workflow has retrystrategy. Fixes: #12490 #10426 #12491
Conversation
Would also fix the second part of #10426 |
I'm going to have a build and test of this tomorrow, but the code looks like it does the right thing. Thanks @shuangkun. |
Thanks for your review! |
This breaks the workflow example from #10426. Without this change the workflow doesn't correctly memoize but does run correctly to completion. With this change you get
That's how it comes out in the logs, sorry it's horridly formatted. Could you look into this? |
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.
This causes the workflow given as an example in #10426 to crash the controller.
Thanks, I will test it tommorow! |
44f0ce3
to
a8cc3d0
Compare
…argoproj#12490 Signed-off-by: shuangkun <tsk2013uestc@163.com>
7248c81
to
e745202
Compare
Thanks for your good find. I test it and find the root cause is when the node hit the memoize, it won't has children even though it is a retry type node. So i think we should change node output from children when it didn't hit memoize. |
e745202
to
6f98655
Compare
workflow/controller/exit_handler.go
Outdated
@@ -15,7 +15,7 @@ import ( | |||
|
|||
func (woc *wfOperationCtx) runOnExitNode(ctx context.Context, exitHook *wfv1.LifecycleHook, parentNode *wfv1.NodeStatus, boundaryID string, tmplCtx *templateresolution.Context, prefix string, scope *wfScope) (bool, *wfv1.NodeStatus, error) { | |||
outputs := parentNode.Outputs | |||
if parentNode.Type == wfv1.NodeTypeRetry { | |||
if parentNode.Type == wfv1.NodeTypeRetry && !(parentNode.MemoizationStatus != nil && parentNode.MemoizationStatus.Hit) { |
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.
This is a complex thing to get your head around (not that it wasn't before your change). I agree it does the right thing, but I'd like to wrap up this if and the subsequent getChildNodeIndex()
call into a single helper function.
It feels like it may result in breakage in the future unless we do this.
// Check if we have a retry node which wasn't memoized and return that if we do
func (woc *wfOperationCtx) possiblyGetRetryChildNode(node *wfv1.NodeStatus) *wfv1.NodeStatus {
if node.Type == wfv1.NodeTypeRetry && !(node.MemoizationStatus != nil && node.MemoizationStatus.Hit) {
return getChildNodeIndex(node, woc.wf.Status.Nodes, -1)
}
return nil
}
and then this becomes
if lastChildNode := possiblyGetRetryChildNode(node); lastChildNode != nil {
outputs = lastChildNode.Outputs
}
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.
Thanks! I agree with you! I have changed all.
workflow/controller/hooks.go
Outdated
@@ -75,7 +75,7 @@ func (woc *wfOperationCtx) executeTmplLifeCycleHook(ctx context.Context, scope * | |||
// executeTemplated should be invoked when hookedNode != nil, because we should reexecute the function to check mutex condition, etc. | |||
if execute || hookedNode != nil { | |||
outputs := parentNode.Outputs | |||
if parentNode.Type == wfv1.NodeTypeRetry { | |||
if parentNode.Type == wfv1.NodeTypeRetry && !(parentNode.MemoizationStatus != nil && parentNode.MemoizationStatus.Hit) { |
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.
And we can use that here
workflow/controller/operator.go
Outdated
@@ -2978,7 +2988,7 @@ func (woc *wfOperationCtx) requeueIfTransientErr(err error, nodeName string) (*w | |||
func (woc *wfOperationCtx) buildLocalScope(scope *wfScope, prefix string, node *wfv1.NodeStatus) { | |||
// It may be that the node is a retry node, in which case we want to get the outputs of the last node | |||
// in the retry group instead of the retry node itself. | |||
if node.Type == wfv1.NodeTypeRetry { | |||
if node.Type == wfv1.NodeTypeRetry && !(node.MemoizationStatus != nil && node.MemoizationStatus.Hit) { |
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.
And here.
6f98655
to
20d5acc
Compare
Signed-off-by: shuangkun <tsk2013uestc@163.com>
20d5acc
to
bca2466
Compare
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.
Nice, thank you.
LGTM, @terrytangyuan could you take a look please.
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.
Can you fix the PR title?
Yes,Is this okay? |
: argoproj#12490 argoproj#10426 (argoproj#12491) Signed-off-by: Isitha Subasinghe <isubasinghe@student.unimelb.edu.au>
I think MemoizationStatus should like inputs, if the executeTmpl has Memoize, the node should have MemoizationStatus.
I test it and if i Set the MemoizationStatus, the ut pass. If did't,the ut will failed.
Fixes #12490
Fixes #10426
Motivation
Modifications
Verification