Skip to content

Commit

Permalink
Add ability to timeout a container/script using activeDeadlineSeconds
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesuen committed Dec 20, 2017
1 parent b5b16e5 commit 133a23c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/workflow/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ type Template struct {
// artifact repository location configured in the controller, appended with the
// <workflowname>/<nodename> in the key.
ArchiveLocation *ArtifactLocation `json:"archiveLocation,omitempty"`

// Optional duration in seconds relative to the StartTime that the pod may be active on a node
// before the system actively tries to terminate the pod; value must be positive integer
// This field is only applicable to container and script templates.
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
}

// Inputs are the mechanism for passing parameters, artifacts, volumes from one template to another
Expand Down
17 changes: 17 additions & 0 deletions examples/timeouts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To enforce a timeout to a template, specify a value for activeDeadlineSeconds.
# This value represents the duration in seconds relative to the pod StartTime
# that the pod may be active on a node before the system actively tries to
# terminate it. This field is only applicable to container and script templates.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: timeouts-
spec:
entrypoint: sleep
templates:
- name: sleep
container:
image: alpine:latest
command: [sh, -c]
args: ["echo sleeping for 1m; sleep 60; echo done"]
activeDeadlineSeconds: 10
1 change: 1 addition & 0 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (woc *wfOperationCtx) createWorkflowPod(nodeName string, tmpl *wfv1.Templat
volumeDockerLib,
volumeDockerSock,
},
ActiveDeadlineSeconds: tmpl.ActiveDeadlineSeconds,
},
}

Expand Down

0 comments on commit 133a23c

Please sign in to comment.