From d7f0c1e39955ed97cb7fb92374fc3eea655dd636 Mon Sep 17 00:00:00 2001 From: Ning Date: Thu, 10 Oct 2019 11:50:52 +0800 Subject: [PATCH] Add sample test for multiple output (#2328) * add sample test for multiple output * adjust the output path * rename config file * fix param * remove the python_component decorator --- ... - basics.ipynb => multiple_outputs.ipynb} | 34 ++++++++++--------- .../configs/multiple_outputs.config.yaml | 19 +++++++++++ test/sample_test.yaml | 1 + 3 files changed, 38 insertions(+), 16 deletions(-) rename samples/core/multiple_outputs/{Multiple outputs - basics.ipynb => multiple_outputs.ipynb} (87%) create mode 100644 test/sample-test/configs/multiple_outputs.config.yaml diff --git a/samples/core/multiple_outputs/Multiple outputs - basics.ipynb b/samples/core/multiple_outputs/multiple_outputs.ipynb similarity index 87% rename from samples/core/multiple_outputs/Multiple outputs - basics.ipynb rename to samples/core/multiple_outputs/multiple_outputs.ipynb index 33c96800c6..61a7dd0b52 100644 --- a/samples/core/multiple_outputs/Multiple outputs - basics.ipynb +++ b/samples/core/multiple_outputs/multiple_outputs.ipynb @@ -50,14 +50,21 @@ }, "outputs": [], "source": [ - "GCS_BUCKET = 'gs://[BUCKET-NAME]' # GCS bucket name\n", - "PROJECT_NAME = '[PROJECT-NAME]' # GCP project name\n", - "\n", - "STAGING_GCS_PATH = GCS_BUCKET + '/multiple-output-sample'\n", - "TARGET_IMAGE = 'gcr.io/%s/multi-output:latest' % PROJECT_NAME\n", - "\n", - "BASE_IMAGE = 'tensorflow/tensorflow:1.11.0-py3'\n", - "EXPERIMENT_NAME = 'Multiple Outputs Sample'" + "output = 'gs://[BUCKET-NAME]' # GCS bucket name\n", + "project_id = '[PROJECT-NAME]' # GCP project name\n", + "experiment_name = 'Multiple Outputs Sample'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "STAGING_GCS_PATH = os.path.join(output, 'multiple-output-sample')\n", + "TARGET_IMAGE = 'gcr.io/%s/multi-output:latest' % project_id\n", + "BASE_IMAGE = 'tensorflow/tensorflow:1.11.0-py3'" ] }, { @@ -86,12 +93,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Returns a*b and a+b\n", - "@dsl.python_component(\n", - " name='product_sum',\n", - " description='Calculates the product and the sum',\n", - " base_image=BASE_IMAGE\n", - ")\n", "def product_sum(a: float, b: float) -> NamedTuple(\n", " 'output', [('product', float), ('sum', float)]):\n", " '''Returns the product and sum of two numbers'''\n", @@ -160,11 +161,12 @@ " 'b': 2.5,\n", " 'c': 3.0,\n", "}\n", - "run_result = kfp.Client().create_run_from_pipeline_func(pipeline, arguments=arguments, experiment_name=EXPERIMENT_NAME)" + "run_result = kfp.Client().create_run_from_pipeline_func(pipeline, arguments=arguments, experiment_name=experiment_name)" ] } ], "metadata": { + "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", @@ -180,7 +182,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.6.4" } }, "nbformat": 4, diff --git a/test/sample-test/configs/multiple_outputs.config.yaml b/test/sample-test/configs/multiple_outputs.config.yaml new file mode 100644 index 0000000000..00f400f68e --- /dev/null +++ b/test/sample-test/configs/multiple_outputs.config.yaml @@ -0,0 +1,19 @@ +# Copyright 2019 Google LLC +# +# 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. + +test_name: multiple_outputs +notebook_params: + output: + project_id: ml-pipeline-test + experiment_name: multiple_outputs-test \ No newline at end of file diff --git a/test/sample_test.yaml b/test/sample_test.yaml index 1ba5bc595d..111de79eab 100644 --- a/test/sample_test.yaml +++ b/test/sample_test.yaml @@ -86,6 +86,7 @@ spec: - loop_parameter - loop_static - resource_ops + - multiple_outputs - ai_platform - parameterized_tfx_oss # Build and push image