Skip to content

Commit

Permalink
Update pipelinerun timeout format to timeouts (kubeflow#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomcli authored Aug 22, 2022
1 parent 5f2e4a3 commit aa3366f
Show file tree
Hide file tree
Showing 135 changed files with 410 additions and 138 deletions.
14 changes: 10 additions & 4 deletions sdk/python/kfp_tekton/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@
TEKTON_GLOBAL_DEFAULT_TIMEOUT = strtobool(env.get('TEKTON_GLOBAL_DEFAULT_TIMEOUT', 'false'))
# DISABLE_CEL_CONDITION should be True until CEL is officially merged into Tekton main API.
DISABLE_CEL_CONDITION = True
# Default timeout is one year
# Default tasks timeout is one year
DEFAULT_TIMEOUT_MINUTES = "525600m"
# Default whole pipeline timeout is two year
DEFAULT_TIMEOUT_WITH_FINALLY_MINUTES = "1051200m"
# Default finally extension is 5 minutes
DEFAULT_FINALLY_SECONDS = 300


def _get_super_condition_template():
Expand Down Expand Up @@ -1391,11 +1395,13 @@ def get_when_task(input_task_when, depended_conditions):

# add workflow level timeout to pipeline run
if not TEKTON_GLOBAL_DEFAULT_TIMEOUT or pipeline.conf.timeout:
pipeline_run['spec']['timeouts'] = {'pipeline': '0s', 'tasks': '0s'}
if pipeline.conf.timeout > 0:
pipeline_run['spec']['timeout'] = '%ds' % pipeline.conf.timeout
pipeline_run['spec']['timeouts']['tasks'] = '%ds' % pipeline.conf.timeout
pipeline_run['spec']['timeouts']['pipeline'] = '%ds' % (pipeline.conf.timeout + DEFAULT_FINALLY_SECONDS)
else:
pipeline_run['spec']['timeout'] = DEFAULT_TIMEOUT_MINUTES

pipeline_run['spec']['timeouts']['tasks'] = DEFAULT_TIMEOUT_MINUTES
pipeline_run['spec']['timeouts']['pipeline'] = DEFAULT_TIMEOUT_WITH_FINALLY_MINUTES
# generate the Tekton podTemplate for image pull secret
if len(pipeline.conf.image_pull_secrets) > 0:
pipeline_run['spec']['podTemplate'] = pipeline_run['spec'].get('podTemplate', {})
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/affinity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ spec:
operator: In
values:
- linux
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/any_sequencer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,6 @@ spec:
value: $(context.pipelineRun.name)
- name: pipelineRun-namespace
value: $(context.pipelineRun.namespace)
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/any_sequencer_looped.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,6 @@ spec:
metadata:
labels:
pipelines.kubeflow.org/cache_enabled: "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,6 @@ spec:
params:
- name: param-loop-item
value: $(params.param)
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/artifact_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ spec:
workspace: artifact-out-pipeline
workspaces:
- name: artifact-out-pipeline
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
workspaces:
- name: artifact-out-pipeline
volumeClaimTemplate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ spec:
timeout: 525600m
workspaces:
- name: artifact-passing-pipeline
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
workspaces:
- name: artifact-passing-pipeline
persistentVolumeClaim:
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/basic_no_decorator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,6 @@ spec:
taskPodTemplate:
nodeSelector:
kubernetes.io/os: linux
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,6 @@ spec:
- name: input-text
mountPath: /tmp/inputs/input_text
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,6 @@ spec:
- name: input-text-1
mountPath: /tmp/inputs/input_text_1
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/big_data_passing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@ spec:
pipelines.kubeflow.org/cache_enabled: "true"
workspaces:
- name: big-data-passing
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
workspaces:
- name: big-data-passing
volumeClaimTemplate:
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/break_task_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,6 @@ spec:
metadata:
labels:
pipelines.kubeflow.org/cache_enabled: "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ spec:
value: '[1, 2]'
- name: param
value: $(params.param)
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ spec:
"outputs": [{"name": "out", "type": "String"}], "version": "cache-disabled@sha256=c6b73e13a48ba7dfacb66ebd9987eda874087ace7615130da8180b2b46dd53c9"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,6 @@ spec:
[], "version": "save@sha256=6cf2594d27161c1ef289acc82ec53fc038580a22405354932ed32ce46df91687"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/cond_recur.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,6 @@ spec:
operator: in
values:
- "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@ spec:
operator: in
values:
- "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/condition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,6 @@ spec:
- $(inputs.params.operand1)
- $(inputs.params.operand2)
image: python:alpine3.6
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,6 @@ spec:
values:
- "true"
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/condition_depend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,6 @@ spec:
- $(inputs.params.operand1)
- $(inputs.params.operand2)
image: python:alpine3.6
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/condition_dependency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,6 @@ spec:
- $(inputs.params.operand1)
- $(inputs.params.operand2)
image: python:alpine3.6
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/conditions_and_loops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,4 +466,6 @@ spec:
metadata:
labels:
pipelines.kubeflow.org/cache_enabled: "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,6 @@ spec:
value: $(tasks.produce-numbers.results.Output)
- name: threshold
value: $(params.threshold)
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,6 @@ spec:
- $(inputs.params.operand1)
- $(inputs.params.operand2)
image: python:alpine3.6
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ spec:
- produce-dir-with-files-python-op
workspaces:
- name: create-component-from-function
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
workspaces:
- name: create-component-from-function
volumeClaimTemplate:
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/custom_task_exit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ spec:
pipelines.kubeflow.org/cache_enabled: "false"
annotations:
ws-pipelines.ibm.com/pipeline-cache-enabled: "false"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ spec:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/custom_task_output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,6 @@ spec:
"outputs": [{"name": "stdout", "type": "String"}], "version": "artifact-printer-1@sha256=37dc967f8576ece2bc91e571dbaccd7f77043711a66b411d02aa952bd47191bf"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ spec:
apiVersion: custom.tekton.dev/v1alpha1
kind: custom-task
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ spec:
valid_container: "false"
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ spec:
operator: in
values:
- "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ spec:
operator: in
values:
- "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/custom_task_ref.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ spec:
runAfter:
- any-name
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ spec:
runAfter:
- any-name
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/custom_task_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ spec:
runAfter:
- any-name
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,9 @@ spec:
- produce-string
workspaces:
- name: data-passing-pipeline
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
workspaces:
- name: data-passing-pipeline
volumeClaimTemplate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ spec:
workspace: data-passing-pipeline
workspaces:
- name: data-passing-pipeline
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
workspaces:
- name: data-passing-pipeline
volumeClaimTemplate:
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/exception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,6 @@ spec:
metadata:
labels:
pipelines.kubeflow.org/cache_enabled: "true"
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/exit_handler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,6 @@ spec:
[], "version": "echo@sha256=4307d04e3d8d097b882bcd9cba02f5ae7d2433c3a6e5968af9f6bf1e17582984"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/hidden_output_file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,6 @@ spec:
[], "version": "echo@sha256=441c647e86107abf53108718d190a2c25c8285e42c62289e3b049dbc2a0425af"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/imagepullsecrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ spec:
"outputs": [{"name": "word", "type": "String"}], "version": "get-frequent@sha256=6ee1acb749583ceffd098100e3e83c4c369aa6b5f295c8bda202b32c853ca5db"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
podTemplate:
imagePullSecrets:
- name: secretA
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ spec:
"outputs": [{"name": "word", "type": "String"}], "version": "get-frequent@sha256=6ee1acb749583ceffd098100e3e83c4c369aa6b5f295c8bda202b32c853ca5db"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
podTemplate:
imagePullSecrets:
- name: secretA
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/tests/compiler/testdata/init_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ spec:
[], "version": "hello@sha256=df9647340a6623fa5aa8ac28fc99358101f4ca72dab416287eb949b5dbd543ad"}'
tekton.dev/template: ''
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,6 @@ spec:
- name: text
emptyDir: {}
timeout: 525600m
timeout: 525600m
timeouts:
pipeline: 1051200m
tasks: 525600m
Loading

0 comments on commit aa3366f

Please sign in to comment.