-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backend): support yaml with platform-specific specs (#8983)
* support yaml with platform-specific info * run go mod tidy and fix comments * license, test and small fixes * fix integration test and add test * address comments * address comments
- Loading branch information
Showing
8 changed files
with
449 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# this is a comment | ||
components: | ||
comp-hello-world: | ||
executorLabel: exec-hello-world | ||
inputDefinitions: | ||
parameters: | ||
text: | ||
type: STRING | ||
deploymentSpec: | ||
executors: | ||
exec-hello-world: | ||
container: | ||
args: | ||
- "--text" | ||
- "{{$.inputs.parameters['text']}}" | ||
command: | ||
- sh | ||
- "-ec" | ||
- | | ||
program_path=$(mktemp) | ||
printf "%s" "$0" > "$program_path" | ||
python3 -u "$program_path" "$@" | ||
- | | ||
def hello_world(text): | ||
print(text) | ||
return text | ||
import argparse | ||
_parser = argparse.ArgumentParser(prog='Hello world', description='') | ||
_parser.add_argument("--text", dest="text", type=str, required=True, default=argparse.SUPPRESS) | ||
_parsed_args = vars(_parser.parse_args()) | ||
_outputs = hello_world(**_parsed_args) | ||
image: python:3.7 | ||
pipelineInfo: | ||
name: namespace/n1/pipeline/hello-world | ||
root: | ||
dag: | ||
tasks: | ||
hello-world: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-hello-world | ||
inputs: | ||
parameters: | ||
text: | ||
componentInputParameter: text | ||
taskInfo: | ||
name: hello-world | ||
inputDefinitions: | ||
parameters: | ||
text: | ||
type: STRING | ||
schemaVersion: 2.0.0 | ||
sdkVersion: kfp-1.6.5 |
218 changes: 218 additions & 0 deletions
218
backend/src/apiserver/template/testdata/pipeline_with_volume.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
# PIPELINE DEFINITION | ||
# Name: my-pipeline | ||
components: | ||
comp-comp: | ||
executorLabel: exec-comp | ||
comp-comp-2: | ||
executorLabel: exec-comp-2 | ||
comp-comp-3: | ||
executorLabel: exec-comp-3 | ||
comp-createpvc: | ||
executorLabel: exec-createpvc | ||
inputDefinitions: | ||
parameters: | ||
access_modes: | ||
parameterType: LIST | ||
annotations: | ||
isOptional: true | ||
parameterType: STRUCT | ||
pvc_name: | ||
isOptional: true | ||
parameterType: STRING | ||
pvc_name_suffix: | ||
isOptional: true | ||
parameterType: STRING | ||
size: | ||
parameterType: STRING | ||
storage_class: | ||
defaultValue: '' | ||
isOptional: true | ||
parameterType: STRING | ||
volume_name: | ||
isOptional: true | ||
parameterType: STRING | ||
outputDefinitions: | ||
parameters: | ||
name: | ||
parameterType: STRING | ||
comp-deletepvc: | ||
executorLabel: exec-deletepvc | ||
inputDefinitions: | ||
parameters: | ||
pvc_name: | ||
parameterType: STRING | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
container: | ||
args: | ||
- --executor_input | ||
- '{{$}}' | ||
- --function_to_execute | ||
- comp | ||
command: | ||
- sh | ||
- -c | ||
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ | ||
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ | ||
\ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0-beta.13'\ | ||
\ && \"$0\" \"$@\"\n" | ||
- sh | ||
- -ec | ||
- 'program_path=$(mktemp -d) | ||
printf "%s" "$0" > "$program_path/ephemeral_component.py" | ||
python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" | ||
' | ||
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ | ||
\ *\n\ndef comp():\n pass\n\n" | ||
image: python:3.7 | ||
exec-comp-2: | ||
container: | ||
args: | ||
- --executor_input | ||
- '{{$}}' | ||
- --function_to_execute | ||
- comp | ||
command: | ||
- sh | ||
- -c | ||
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ | ||
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ | ||
\ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0-beta.13'\ | ||
\ && \"$0\" \"$@\"\n" | ||
- sh | ||
- -ec | ||
- 'program_path=$(mktemp -d) | ||
printf "%s" "$0" > "$program_path/ephemeral_component.py" | ||
python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" | ||
' | ||
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ | ||
\ *\n\ndef comp():\n pass\n\n" | ||
image: python:3.7 | ||
exec-comp-3: | ||
container: | ||
args: | ||
- --executor_input | ||
- '{{$}}' | ||
- --function_to_execute | ||
- comp | ||
command: | ||
- sh | ||
- -c | ||
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ | ||
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ | ||
\ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0-beta.13'\ | ||
\ && \"$0\" \"$@\"\n" | ||
- sh | ||
- -ec | ||
- 'program_path=$(mktemp -d) | ||
printf "%s" "$0" > "$program_path/ephemeral_component.py" | ||
python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" | ||
' | ||
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ | ||
\ *\n\ndef comp():\n pass\n\n" | ||
image: python:3.7 | ||
exec-createpvc: | ||
container: | ||
image: argostub/createpvc | ||
exec-deletepvc: | ||
container: | ||
image: argostub/deletepvc | ||
pipelineInfo: | ||
name: my-pipeline | ||
root: | ||
dag: | ||
tasks: | ||
comp: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-comp | ||
taskInfo: | ||
name: comp | ||
comp-2: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-comp-2 | ||
dependentTasks: | ||
- comp | ||
taskInfo: | ||
name: comp-2 | ||
comp-3: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-comp-3 | ||
taskInfo: | ||
name: comp-3 | ||
createpvc: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-createpvc | ||
inputs: | ||
parameters: | ||
access_modes: | ||
runtimeValue: | ||
constant: | ||
- ReadWriteMany | ||
pvc_name_suffix: | ||
runtimeValue: | ||
constant: -my-pvc | ||
size: | ||
runtimeValue: | ||
constant: 5Gi | ||
storage_class: | ||
runtimeValue: | ||
constant: standard | ||
taskInfo: | ||
name: createpvc | ||
deletepvc: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-deletepvc | ||
dependentTasks: | ||
- comp-2 | ||
- createpvc | ||
inputs: | ||
parameters: | ||
pvc_name: | ||
taskOutputParameter: | ||
outputParameterKey: name | ||
producerTask: createpvc | ||
taskInfo: | ||
name: deletepvc | ||
schemaVersion: 2.1.0 | ||
sdkVersion: kfp-2.0.0-beta.13 | ||
--- | ||
platforms: | ||
kubernetes: | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
pvcMount: | ||
- mountPath: /data | ||
taskOutputParameter: | ||
outputParameterKey: name | ||
producerTask: createpvc | ||
exec-comp-2: | ||
pvcMount: | ||
- mountPath: /reused_data | ||
taskOutputParameter: | ||
outputParameterKey: name | ||
producerTask: createpvc | ||
exec-comp-3: | ||
pvcMount: | ||
- constant: my-existing-pvc | ||
mountPath: /data |
Oops, something went wrong.