Skip to content

Commit

Permalink
fix(sdk): fix resource spec test (kubeflow#6979)
Browse files Browse the repository at this point in the history
* fix(sdk): fix load_test

* concat placeholder

* release notes

* fix(sdk): fix resource spec test

* release notes

* test for ontology
  • Loading branch information
ji-yaqi authored and abaland committed May 29, 2022
1 parent 067b554 commit e53711c
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 299 deletions.
4 changes: 2 additions & 2 deletions sdk/python/kfp/v2/compiler/pipeline_spec_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ def build_container_spec_for_task(
))

if task.container_spec.resources is not None:
container_spec.reources.cpu_limit = (
container_spec.resources.cpu_limit = (
task.container_spec.resources.cpu_limit)
container_spec.reources.memory_limit = (
container_spec.resources.memory_limit = (
task.container_spec.resources.memory_limit)
if task.container_spec.resources.accelerator_count is not None:
container_spec.resources.accelerator.CopyFrom(
Expand Down
10 changes: 4 additions & 6 deletions sdk/python/kfp/v2/compiler_cli_tests/compiler_cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,17 @@ def test_two_step_pipeline(self):
def test_pipeline_with_importer(self):
self._test_compile_py_to_json('pipeline_with_importer')

# TODO: re-enable the test, debug load_component_from_file error
# def test_pipeline_with_ontology(self):
# self._test_compile_py_to_json('pipeline_with_ontology')
def test_pipeline_with_ontology(self):
self._test_compile_py_to_json('pipeline_with_ontology')

def test_pipeline_with_if_placeholder(self):
self._test_compile_py_to_json('pipeline_with_if_placeholder')

def test_pipeline_with_concat_placeholder(self):
self._test_compile_py_to_json('pipeline_with_concat_placeholder')

# TODO: re-enable the test, debug add_node_selector_constraint error
# def test_pipeline_with_resource_spec(self):
# self._test_compile_py_to_json('pipeline_with_resource_spec')
def test_pipeline_with_resource_spec(self):
self._test_compile_py_to_json('pipeline_with_resource_spec')

# TODO: re-enable the test, debug load_component_from_text error
# def test_pipeline_with_various_io_types(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,169 +1,163 @@
{
"pipelineSpec": {
"components": {
"comp-ingestion": {
"executorLabel": "exec-ingestion",
"inputDefinitions": {
"parameters": {
"input_location": {
"parameterType": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"examples": {
"artifactType": {
"schemaTitle": "system.Dataset",
"schemaVersion": "0.0.1"
}
}
"components": {
"comp-ingestion": {
"executorLabel": "exec-ingestion",
"inputDefinitions": {
"parameters": {
"input_location": {
"parameterType": "STRING"
}
}
},
"comp-trainer": {
"executorLabel": "exec-trainer",
"inputDefinitions": {
"artifacts": {
"examples": {
"artifactType": {
"schemaTitle": "system.Dataset",
"schemaVersion": "0.0.1"
}
}
},
"parameters": {
"n_epochs": {
"parameterType": "NUMBER_INTEGER"
},
"optimizer": {
"parameterType": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"model": {
"artifactType": {
"schemaTitle": "system.Model",
"schemaVersion": "0.0.1"
}
"outputDefinitions": {
"artifacts": {
"examples": {
"artifactType": {
"schemaTitle": "system.Dataset",
"schemaVersion": "0.0.1"
}
}
}
}
},
"deploymentSpec": {
"executors": {
"exec-ingestion": {
"container": {
"args": [
"--input-location",
"{{$.inputs.parameters['input_location']}}",
"--output-examples",
"{{$.outputs.artifacts['examples'].uri}}"
],
"image": "gcr.io/my-project/my-ingestor"
"comp-trainer": {
"executorLabel": "exec-trainer",
"inputDefinitions": {
"artifacts": {
"examples": {
"artifactType": {
"schemaTitle": "system.Dataset",
"schemaVersion": "0.0.1"
}
}
},
"exec-trainer": {
"container": {
"args": [
"--input-examples",
"{{$.inputs.artifacts['examples'].uri}}",
"--optimizer",
"{{$.inputs.parameters['optimizer']}}",
"--n_epochs",
"{{$.inputs.parameters['n_epochs']}}",
"--output-model",
"{{$.outputs.artifacts['model'].uri}}"
],
"image": "gcr.io/my-project/my-fancy-trainer"
"parameters": {
"n_epochs": {
"parameterType": "NUMBER_INTEGER"
},
"optimizer": {
"parameterType": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"model": {
"artifactType": {
"schemaTitle": "system.Model",
"schemaVersion": "0.0.1"
}
}
}
}
},
"pipelineInfo": {
"name": "two-step-pipeline-with-ontology"
},
"root": {
"dag": {
"tasks": {
"ingestion": {
"cachingOptions": {
"enableCache": true
},
"componentRef": {
"name": "comp-ingestion"
},
"inputs": {
"parameters": {
"input_location": {
"componentInputParameter": "input_location"
}
}
},
"defaultPipelineRoot": "dummy_root",
"deploymentSpec": {
"executors": {
"exec-ingestion": {
"container": {
"args": [
"--input-location",
"{{$.inputs.parameters['input_location']}}",
"--output-examples",
"{{$.outputs.artifacts['examples'].uri}}"
],
"image": "gcr.io/my-project/my-ingestor"
}
},
"exec-trainer": {
"container": {
"args": [
"--input-examples",
"{{$.inputs.artifacts['examples'].uri}}",
"--optimizer",
"{{$.inputs.parameters['optimizer']}}",
"--n_epochs",
"{{$.inputs.parameters['n_epochs']}}",
"--output-model",
"{{$.outputs.artifacts['model'].uri}}"
],
"image": "gcr.io/my-project/my-fancy-trainer"
}
}
}
},
"pipelineInfo": {
"name": "two-step-pipeline-with-ontology"
},
"root": {
"dag": {
"tasks": {
"ingestion": {
"cachingOptions": {
"enableCache": true
},
"componentRef": {
"name": "comp-ingestion"
},
"inputs": {
"parameters": {
"input_location": {
"componentInputParameter": "input_location"
}
},
"taskInfo": {
"name": "ingestion"
}
},
"trainer": {
"cachingOptions": {
"enableCache": true
},
"componentRef": {
"name": "comp-trainer"
},
"dependentTasks": [
"ingestion"
],
"inputs": {
"artifacts": {
"examples": {
"taskOutputArtifact": {
"outputArtifactKey": "examples",
"producerTask": "ingestion"
}
}
},
"parameters": {
"n_epochs": {
"componentInputParameter": "n_epochs"
},
"optimizer": {
"componentInputParameter": "optimizer"
"taskInfo": {
"name": "ingestion"
}
},
"trainer": {
"cachingOptions": {
"enableCache": true
},
"componentRef": {
"name": "comp-trainer"
},
"dependentTasks": [
"ingestion"
],
"inputs": {
"artifacts": {
"examples": {
"taskOutputArtifact": {
"outputArtifactKey": "examples",
"producerTask": "ingestion"
}
}
},
"taskInfo": {
"name": "trainer"
"parameters": {
"n_epochs": {
"componentInputParameter": "n_epochs"
},
"optimizer": {
"componentInputParameter": "optimizer"
}
}
}
}
},
"inputDefinitions": {
"parameters": {
"input_location": {
"parameterType": "STRING"
},
"n_epochs": {
"parameterType": "NUMBER_INTEGER"
},
"optimizer": {
"parameterType": "STRING"
"taskInfo": {
"name": "trainer"
}
}
}
},
"schemaVersion": "2.1.0",
"sdkVersion": "kfp-1.8.6"
},
"runtimeConfig": {
"gcsOutputDirectory": "dummy_root",
"parameterValues": {
"input_location": "gs://test-bucket/pipeline_root",
"n_epochs": 200.0,
"optimizer": "sgd"
"inputDefinitions": {
"parameters": {
"input_location": {
"defaultValue": "gs://test-bucket/pipeline_root",
"parameterType": "STRING"
},
"n_epochs": {
"defaultValue": 200.0,
"parameterType": "NUMBER_INTEGER"
},
"optimizer": {
"defaultValue": "sgd",
"parameterType": "STRING"
}
}
}
}
},
"schemaVersion": "2.1.0",
"sdkVersion": "kfp-1.8.9"
}
Loading

0 comments on commit e53711c

Please sign in to comment.