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

feat: Retry pending nodes #2385

Merged
merged 21 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Bug fix and make it work
  • Loading branch information
jamhed committed Mar 12, 2020
commit 56c03fdc034358b5f991e0e6c0d873ecd27d2952
6 changes: 3 additions & 3 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,14 +870,14 @@ type RetryStrategy struct {
// Limit is the maximum number of attempts when retrying a container
Limit *int32 `json:"limit,omitempty" protobuf:"varint,1,opt,name=limit"`

// Resubmit is set to enable Pending pod resubmission
Resubmit *bool `json:"resubmit,omitempty" protobuf:"varint,1,opt,name=resubmit"`

// RetryPolicy is a policy of NodePhase statuses that will be retried
RetryPolicy RetryPolicy `json:"retryPolicy,omitempty" protobuf:"bytes,2,opt,name=retryPolicy,casttype=RetryPolicy"`

// Backoff is a backoff strategy
Backoff *Backoff `json:"backoff,omitempty" protobuf:"bytes,3,opt,name=backoff,casttype=Backoff"`

// Resubmit is set to enable Pending pod resubmission
Resubmit *bool `json:"resubmit,omitempty" protobuf:"varint,4,opt,name=resubmit"`
}

// NodeStatus contains status information about an individual node in the workflow
Expand Down
10 changes: 6 additions & 4 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,7 @@ func isResubmitAllowed(tmpl *wfv1.Template) bool {
if tmpl.RetryStrategy == nil {
return false
}
fmt.Printf("FLAG: %v", *tmpl.RetryStrategy.Resubmit)
if tmpl.RetryStrategy.Resubmit == nil {
return false
}
Expand Down Expand Up @@ -1401,13 +1402,14 @@ func (woc *wfOperationCtx) executeTemplate(nodeName string, orgTmpl wfv1.Templat
err = errors.Errorf(errors.CodeBadRequest, "Template '%s' missing specification", processedTmpl.Name)
return woc.initializeNode(nodeName, wfv1.NodeTypeSkipped, templateScope, orgTmpl, boundaryID, wfv1.NodeError, err.Error()), err
}
if isResubmitAllowed(processedTmpl) {
if apierr.IsForbidden(err) {
if apierr.IsForbidden(err) {
jamhed marked this conversation as resolved.
Show resolved Hide resolved
if isResubmitAllowed(processedTmpl) {
return woc.markNodePending(node.Name, err), nil
} else {
return nil, errors.InternalWrapError(err)
}
} else {
return nil, errors.InternalWrapError(err)
}

if err != nil {
node = woc.markNodeError(node.Name, err)
// If retry policy is not set, or if it is not set to Always or OnError, we won't attempt to retry an errored container
Expand Down