kfp-tekton/sdk/python/tests/compiler/testdata/recur_nested_pipelineloop_c...

150 lines
4.6 KiB
YAML

# Copyright 2021 kubeflow.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: custom.tekton.dev/v1alpha1
kind: PipelineLoop
metadata:
name: nested-recursion-pipeline-ip-component-b-3
spec:
pipelineSpec:
params:
- name: flip-coin-output
type: string
- name: just_one_iteration
type: string
- name: maxVal
type: string
tasks:
- name: print
params:
- name: flip-coin-output
value: $(params.flip-coin-output)
taskSpec:
steps:
- name: main
command:
- echo
- $(inputs.params.flip-coin-output)
image: alpine:3.6
params:
- name: flip-coin-output
type: string
metadata:
labels:
pipelines.kubeflow.org/pipelinename: ''
pipelines.kubeflow.org/generation: ''
pipelines.kubeflow.org/cache_enabled: "true"
annotations:
pipelines.kubeflow.org/component_spec_digest: '{"name": "print", "outputs":
[], "version": "print@sha256=8232f0c48ead41f53f1c61e3c35a4d3440cdd0591ab17933736e5ed7c8390d5c"}'
tekton.dev/template: ''
when:
- input: $(tasks.condition-4.results.outcome)
operator: in
values:
- "true"
timeout: 525600m
- name: flip-coin-2
taskSpec:
steps:
- name: main
args:
- |
python -c "import random; result = 'heads' if random.randint(0,1) == 0 else 'tails'; print(result)" | tee $0
- $(results.output.path)
command:
- sh
- -c
image: python:alpine3.6
results:
- name: output
type: string
description: /tmp/outputs/output/data
metadata:
labels:
pipelines.kubeflow.org/pipelinename: ''
pipelines.kubeflow.org/generation: ''
pipelines.kubeflow.org/cache_enabled: "true"
annotations:
pipelines.kubeflow.org/component_spec_digest: '{"name": "flip-coin", "outputs":
[{"name": "output", "type": "String"}], "version": "flip-coin@sha256=1989ae83915edcd7253e495603317c1f99196f5ef2b0bacb31a0273d941e830d"}'
tekton.dev/template: ''
when:
- input: $(tasks.condition-4.results.outcome)
operator: in
values:
- "true"
runAfter:
- print
timeout: 525600m
- name: condition-4
params:
- name: operand1
value: $(params.flip-coin-output)
- name: operand2
value: heads
- name: operator
value: ==
taskSpec:
results:
- name: outcome
type: string
description: Conditional task outcome
params:
- name: operand1
type: string
- name: operand2
type: string
- name: operator
type: string
steps:
- script: |-
python -c 'import sys
input1=str.rstrip(sys.argv[1])
input2=str.rstrip(sys.argv[2])
try:
input1=int(input1)
input2=int(input2)
except:
input1=str(input1)
outcome="true" if (input1 $(inputs.params.operator) input2) else "false"
f = open("/tekton/results/outcome", "w")
f.write(outcome)
f.close()' '$(inputs.params.operand1)' '$(inputs.params.operand2)'
image: python:alpine3.6
metadata:
labels:
pipelines.kubeflow.org/pipelinename: ''
pipelines.kubeflow.org/generation: ''
pipelines.kubeflow.org/cache_enabled: "true"
- name: flip-component-b
taskRef:
apiVersion: custom.tekton.dev/v1alpha1
kind: PipelineLoop
name: nested-recursion-pipeline-ip-component-b-3
params:
- name: flip-coin-output
value: $(tasks.flip-coin-2.results.output)
- name: just_one_iteration
value:
- '1'
- name: maxVal
value: $(params.maxVal)
when:
- input: $(tasks.condition-4.results.outcome)
operator: in
values:
- "true"
iterateParam: just_one_iteration