diff --git a/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline.yaml b/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline.yaml index ea11ec0f440..9dc7dc8f79d 100644 --- a/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline.yaml +++ b/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline.yaml @@ -101,7 +101,7 @@ spec: "INT"}, "uri": {"type": "STRING"}}, "inputArtifacts": {}, "outputParameters": {"output_parameter_one": {"type": "INT", "path": "/tmp/outputs/output_parameter_one/data"}}, "outputArtifacts": {"output_dataset_one": {"schemaTitle": "system.Dataset", - "instanceSchema": "", "metadataPath": "/tmp/outputs/output_dataset_one/data"}}}'} + "instanceSchema": "", "schemaVersion": "0.0.1", "metadataPath": "/tmp/outputs/output_dataset_one/data"}}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: python:3.7 @@ -200,9 +200,9 @@ spec: - {name: KFP_V2_IMAGE, value: 'python:3.7'} - {name: KFP_V2_RUNTIME_INFO, value: '{"inputParameters": {"num_steps": {"type": "INT"}}, "inputArtifacts": {"dataset": {"metadataPath": "/tmp/inputs/dataset/data", - "schemaTitle": "system.Dataset", "instanceSchema": ""}}, "outputParameters": + "schemaTitle": "system.Dataset", "instanceSchema": "", "schemaVersion": "0.0.1"}}, "outputParameters": {}, "outputArtifacts": {"model": {"schemaTitle": "system.Model", "instanceSchema": - "", "metadataPath": "/tmp/outputs/model/data"}}}'} + "", "schemaVersion": "0.0.1", "metadataPath": "/tmp/outputs/model/data"}}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: python:3.7 diff --git a/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml b/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml index 8f1e7837785..8aae4a008db 100644 --- a/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml +++ b/sdk/python/kfp/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml @@ -101,7 +101,7 @@ spec: "INT"}, "uri": {"type": "STRING"}}, "inputArtifacts": {}, "outputParameters": {"output_parameter_one": {"type": "INT", "path": "/tmp/outputs/output_parameter_one/data"}}, "outputArtifacts": {"output_dataset_one": {"schemaTitle": "system.Dataset", - "instanceSchema": "", "metadataPath": "/tmp/outputs/output_dataset_one/data"}}}'} + "instanceSchema": "", "schemaVersion": "0.0.1", "metadataPath": "/tmp/outputs/output_dataset_one/data"}}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: python:3.7 @@ -200,9 +200,9 @@ spec: - {name: KFP_V2_IMAGE, value: 'python:3.7'} - {name: KFP_V2_RUNTIME_INFO, value: '{"inputParameters": {"num_steps": {"type": "INT"}}, "inputArtifacts": {"dataset": {"metadataPath": "/tmp/inputs/dataset/data", - "schemaTitle": "system.Dataset", "instanceSchema": ""}}, "outputParameters": + "schemaTitle": "system.Dataset", "instanceSchema": "", "schemaVersion": "0.0.1"}}, "outputParameters": {}, "outputArtifacts": {"model": {"schemaTitle": "system.Model", "instanceSchema": - "", "metadataPath": "/tmp/outputs/model/data"}}}'} + "", "schemaVersion": "0.0.1", "metadataPath": "/tmp/outputs/model/data"}}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: python:3.7 diff --git a/sdk/python/tests/compiler/compiler_tests.py b/sdk/python/tests/compiler/compiler_tests.py index 2854ae7ed59..e4fa0b696d0 100644 --- a/sdk/python/tests/compiler/compiler_tests.py +++ b/sdk/python/tests/compiler/compiler_tests.py @@ -487,33 +487,33 @@ def my_pipeline(memory: str, cpu: str): template = name_to_template[main_dag_tasks[0]['template']] self.assertEqual(template['podSpecPatch'], '{"containers": [{"name": "main", "resources": {"requests": {"cpu": "{{inputs.parameters.memory}}"}}}]}') - + def test_py_runtime_gpu_request(self): """Test GPU request.""" def my_pipeline(nbr_gpus: int, gpu_vendor: str): some_op().set_gpu_limit(nbr_gpus, gpu_vendor) - + workflow = kfp.compiler.Compiler()._create_workflow(my_pipeline) name_to_template = {template['name']: template for template in workflow['spec']['templates']} main_dag_tasks = name_to_template[workflow['spec']['entrypoint']]['dag']['tasks'] template = name_to_template[main_dag_tasks[0]['template']] self.assertEqual(template['podSpecPatch'], '{"containers": [{"name": "main", "resources": {"limits": {"{{inputs.parameters.gpu_vendor}}": "{{inputs.parameters.nbr_gpus}}"}}}]}') - + def test_py_runtime_node_selection(self): """Test node selection request.""" def my_pipeline(constrain_type: str, constrain_value: str): some_op().add_node_selector_constraint(constrain_type, constrain_value) - + workflow = kfp.compiler.Compiler()._create_workflow(my_pipeline) name_to_template = {template['name']: template for template in workflow['spec']['templates']} main_dag_tasks = name_to_template[workflow['spec']['entrypoint']]['dag']['tasks'] template = name_to_template[main_dag_tasks[0]['template']] self.assertEqual(template['podSpecPatch'], '{"nodeSelector": [{"{{inputs.parameters.constrain_type}}": "{{inputs.parameters.constrain_value}}"}]}') - + def test_py_retry_policy_invalid(self): def my_pipeline(): diff --git a/sdk/python/tests/compiler/testdata/uri_artifacts.yaml b/sdk/python/tests/compiler/testdata/uri_artifacts.yaml index f3a7ea1cf9c..229978c8824 100644 --- a/sdk/python/tests/compiler/testdata/uri_artifacts.yaml +++ b/sdk/python/tests/compiler/testdata/uri_artifacts.yaml @@ -7,8 +7,8 @@ metadata: pipelines.kubeflow.org/pipeline_compilation_time: '2021-08-07T00:27:52.329848' pipelines.kubeflow.org/pipeline_spec: '{"inputs": [{"default": "Hello world!", "name": "text", "optional": true, "type": "String"}, {"default": "gs://my-bucket/my-output-dir", - "name": "pipeline-root"}, {"default": "pipeline/uri-artifact-pipeline", - "name": "pipeline-name"}], "name": "uri-artifact-pipeline"}' + "name": "pipeline-root"}, {"default": "pipeline/uri-artifact-pipeline", "name": + "pipeline-name"}], "name": "uri-artifact-pipeline"}' pipelines.kubeflow.org/v2_pipeline: "true" labels: pipelines.kubeflow.org/v2_pipeline: "true" @@ -154,8 +154,8 @@ spec: - {name: KFP_V2_IMAGE, value: 'google/cloud-sdk:slim'} - {name: KFP_V2_RUNTIME_INFO, value: '{"inputParameters": {}, "inputArtifacts": {"input_gcs_path": {"metadataPath": "/tmp/inputs/input_gcs_path/data", "schemaTitle": - "system.Artifact", "instanceSchema": ""}}, "outputParameters": {}, "outputArtifacts": - {}}'} + "system.Artifact", "instanceSchema": "", "schemaVersion": "0.0.1"}}, "outputParameters": + {}, "outputArtifacts": {}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: google/cloud-sdk:slim @@ -221,8 +221,8 @@ spec: - {name: KFP_V2_IMAGE, value: 'google/cloud-sdk:slim'} - {name: KFP_V2_RUNTIME_INFO, value: '{"inputParameters": {}, "inputArtifacts": {"input_gcs_path": {"metadataPath": "/tmp/inputs/input_gcs_path/data", "schemaTitle": - "system.Artifact", "instanceSchema": ""}}, "outputParameters": {}, "outputArtifacts": - {}}'} + "system.Artifact", "instanceSchema": "", "schemaVersion": "0.0.1"}}, "outputParameters": + {}, "outputArtifacts": {}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: google/cloud-sdk:slim @@ -288,8 +288,8 @@ spec: - {name: KFP_V2_IMAGE, value: 'google/cloud-sdk:slim'} - {name: KFP_V2_RUNTIME_INFO, value: '{"inputParameters": {}, "inputArtifacts": {"input_gcs_path": {"metadataPath": "/tmp/inputs/input_gcs_path/data", "schemaTitle": - "system.Artifact", "instanceSchema": ""}}, "outputParameters": {}, "outputArtifacts": - {}}'} + "system.Artifact", "instanceSchema": "", "schemaVersion": "0.0.1"}}, "outputParameters": + {}, "outputArtifacts": {}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: google/cloud-sdk:slim @@ -408,7 +408,7 @@ spec: - {name: KFP_V2_RUNTIME_INFO, value: '{"inputParameters": {"text": {"type": "STRING"}}, "inputArtifacts": {}, "outputParameters": {}, "outputArtifacts": {"output_gcs_path": {"schemaTitle": "system.Artifact", "instanceSchema": - "", "metadataPath": "/tmp/outputs/output_gcs_path/data"}}}'} + "", "schemaVersion": "0.0.1", "metadataPath": "/tmp/outputs/output_gcs_path/data"}}}'} envFrom: - configMapRef: {name: metadata-grpc-configmap, optional: true} image: google/cloud-sdk:slim