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

Handle operation level errors #1762

Merged
merged 2 commits into from
Dec 5, 2019
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
16 changes: 16 additions & 0 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (woc *wfOperationCtx) operate() {
} else {
woc.log.Errorf("Failed to load artifact repository configMap: %+v", err)
woc.markWorkflowError(err, true)
return
}
}

Expand Down Expand Up @@ -1075,6 +1076,11 @@ func (woc *wfOperationCtx) createPVCs() error {
}

func (woc *wfOperationCtx) deletePVCs() error {
if woc.wf.Status.Phase != wfv1.NodeSucceeded {
// Skip deleting PVCs to reuse them for retried failed/error workflows.
// PVCs are automatically deleted when corresponded owner workflows get deleted.
return nil
}
totalPVCs := len(woc.wf.Status.PersistentVolumeClaims)
if totalPVCs == 0 {
// PVC list already empty. nothing to do
Expand Down Expand Up @@ -1286,6 +1292,16 @@ func (woc *wfOperationCtx) markWorkflowPhase(phase wfv1.NodePhase, markCompleted
woc.wf.Status.Message = message[0]
}

if phase == wfv1.NodeError {
entryNode, ok := woc.wf.Status.Nodes[woc.wf.ObjectMeta.Name]
if ok && entryNode.Phase == wfv1.NodeRunning {
entryNode.Phase = wfv1.NodeError
entryNode.Message = "Workflow operation error"
woc.wf.Status.Nodes[woc.wf.ObjectMeta.Name] = entryNode
woc.updated = true
}
}

switch phase {
case wfv1.NodeSucceeded, wfv1.NodeFailed, wfv1.NodeError:
// wait for all daemon nodes to get terminated before marking workflow completed
Expand Down