Skip to content

Commit

Permalink
Issue argoproj#1040 - Kill daemoned step if workflow consist of singl…
Browse files Browse the repository at this point in the history
…e daemoned step (argoproj#1144)
  • Loading branch information
alexmt authored Dec 28, 2018
1 parent e078032 commit 174eb20
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion workflow/controller/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (woc *wfOperationCtx) executeDAG(nodeName string, tmpl *wfv1.Template, boun
}
defer func() {
if node != nil && woc.wf.Status.Nodes[node.ID].Completed() {
_ = woc.killDeamonedChildren(node.ID)
_ = woc.killDaemonedChildren(node.ID)
}
}()

Expand Down
6 changes: 3 additions & 3 deletions workflow/controller/exec_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func (woc *wfOperationCtx) applyExecutionControl(pod *apiv1.Pod) error {
return woc.updateExecutionControl(pod.Name, desiredExecCtl)
}

// killDeamonedChildren kill any daemoned pods of a steps or DAG template node.
func (woc *wfOperationCtx) killDeamonedChildren(nodeID string) error {
woc.log.Infof("Checking deamoned children of %s", nodeID)
// killDaemonedChildren kill any daemoned pods of a steps or DAG template node.
func (woc *wfOperationCtx) killDaemonedChildren(nodeID string) error {
woc.log.Infof("Checking daemoned children of %s", nodeID)
var firstErr error
execCtl := common.ExecutionControl{
Deadline: &time.Time{},
Expand Down
7 changes: 6 additions & 1 deletion workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ func newWorkflowOperationCtx(wf *wfv1.Workflow, wfc *WorkflowController) *wfOper
// TODO: an error returned by this method should result in requeuing the workflow to be retried at a
// later time
func (woc *wfOperationCtx) operate() {
defer woc.persistUpdates()
defer func() {
if woc.wf.Status.Completed() {
_ = woc.killDaemonedChildren("")
}
woc.persistUpdates()
}()
defer func() {
if r := recover(); r != nil {
if rerr, ok := r.(error); ok {
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (woc *wfOperationCtx) executeSteps(nodeName string, tmpl *wfv1.Template, bo
}
defer func() {
if woc.wf.Status.Nodes[node.ID].Completed() {
_ = woc.killDeamonedChildren(node.ID)
_ = woc.killDaemonedChildren(node.ID)
}
}()
stepsCtx := stepsContext{
Expand Down

0 comments on commit 174eb20

Please sign in to comment.