diff --git a/test.yaml b/test.yaml new file mode 100644 index 0000000..b10f6af --- /dev/null +++ b/test.yaml @@ -0,0 +1,276 @@ +pipeline_spec: + components: + comp-condition-1: + dag: + tasks: + run2: + cachingOptions: + enableCache: true + componentRef: + name: comp-run2 + inputs: + artifacts: + input: + componentInputArtifact: pipelinechannel--run-output + taskInfo: + name: run2 + inputDefinitions: + artifacts: + pipelinechannel--run-output: + artifactType: + schemaTitle: system.Model + schemaVersion: 0.0.1 + parameters: + pipelinechannel--run-s: + parameterType: STRING + comp-run: + executorLabel: exec-run + inputDefinitions: + parameters: + message: + parameterType: STRING + outputDefinitions: + artifacts: + metrics: + artifactType: + schemaTitle: system.Metrics + schemaVersion: 0.0.1 + output: + artifactType: + schemaTitle: system.Model + schemaVersion: 0.0.1 + parameters: + s: + parameterType: STRING + comp-run2: + executorLabel: exec-run2 + inputDefinitions: + artifacts: + input: + artifactType: + schemaTitle: system.Model + schemaVersion: 0.0.1 + comp-simple: + executorLabel: exec-simple + inputDefinitions: + parameters: + msg: + parameterType: STRING + comp-simple-2: + executorLabel: exec-simple-2 + inputDefinitions: + parameters: + msg: + parameterType: STRING + deploymentSpec: + executors: + exec-run: + container: + args: + - "--executor_input" + - "{{$}}" + - "--function_to_execute" + - run + command: + - sh + - "-c" + - > + + if ! [ -x "$(command -v pip)" ]; then + python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip + fi + + + PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install + --no-warn-script-location 'kfp-leinao==2.4.0' '--no-deps' + 'typing-extensions>=3.7.4,<5; python_version<"3.9"' && "$0" "$@" + - sh + - "-ec" + - > + program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m + kfp.dsl.executor_main + --component_module_path + "$program_path/ephemeral_component.py" + "$@" + - >+ + + import kfp + + from kfp import dsl + + from kfp.dsl import * + + from typing import * + + from builtins import str + + + def run(message: str, s: Output[str], output: Output[Model], + metrics: Output[Metrics]): + + print("--------balabala---------") + print(output.path) + with open(output.path, "w") as f: + f.write(message) + + metrics.log_metric("ametrics", 1111) + + with open('/data/wangs/111.txt', 'w') as f: + f.write('aaaaaaaa') + + print(metrics.uri) + print(metrics.path) + + env: + - name: env_1 + value: dddddd + image: "registry.cnbita.com:5000/wangshi/python:3.10-leinao-1.0" + resources: + accelerator: + count: "1" + type: nvidia.com/gpu + cpuLimit: 2 + memoryRequest: 4 + exec-run2: + container: + args: + - "--executor_input" + - "{{$}}" + - "--function_to_execute" + - run2 + command: + - sh + - "-ec" + - > + program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m + kfp.dsl.executor_main + --component_module_path + "$program_path/ephemeral_component.py" + "$@" + - |+ + + import kfp + from kfp import dsl + from kfp.dsl import * + from typing import * + + def run2(input: Input[Model]): + print("input path: ", input.path) + print("input url: ", input.uri) + print("input:", input) + + print("-------bala") + + with open(input.path, "r") as f: + msg = f.read() + print(msg) + + image: "registry.cnbita.com:5000/wangshi/python:3.10-leinao-1.0" + exec-simple: + container: + args: + - "{{$.inputs.parameters['msg']}}" + command: + - echo + exec-simple-2: + container: + args: + - "{{$.inputs.parameters['msg']}}" + command: + - echo + pipelineInfo: + displayName: 没鸡儿用 + name: qqqq + root: + dag: + outputs: + artifacts: + run-metrics: + artifactSelectors: + - outputArtifactKey: metrics + producerSubtask: run + tasks: + condition-1: + componentRef: + name: comp-condition-1 + dependentTasks: + - run + inputs: + artifacts: + pipelinechannel--run-output: + taskOutputArtifact: + outputArtifactKey: output + producerTask: run + parameters: + pipelinechannel--run-s: + taskOutputParameter: + outputParameterKey: s + producerTask: run + taskInfo: + name: condition-1 + triggerPolicy: + condition: "inputs.parameter_values['pipelinechannel--run-s'] == 'heads'" + run: + cachingOptions: {} + componentRef: + name: comp-run + inputs: + parameters: + message: + componentInputParameter: message + taskInfo: + name: run + simple: + cachingOptions: + enableCache: true + componentRef: + name: comp-simple + dependentTasks: + - run + inputs: + parameters: + msg: + runtimeValue: + constant: "1" + taskInfo: + name: simple + simple-2: + cachingOptions: + enableCache: true + componentRef: + name: comp-simple-2 + dependentTasks: + - run + inputs: + parameters: + msg: + runtimeValue: + constant: "2" + taskInfo: + name: simple-2 + inputDefinitions: + parameters: + message: + parameterType: STRING + schemaVersion: 2.1.0 + sdkVersion: kfp-2.4.0 +platform_spec: + platforms: + kubernetes: + deploymentSpec: + executors: + exec-run: + pvcMount: + - constant: wangs-pvc + mountPath: /data/wangs + subPath: sub