Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sample test for multiple output #2328

Merged
merged 6 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -180,7 +182,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down
19 changes: 19 additions & 0 deletions test/sample-test/configs/multiple_outputs.config.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/sample_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ spec:
- loop_parameter
- loop_static
- resource_ops
- multiple_outputs
- ai_platform
- parameterized_tfx_oss
# Build and push image
Expand Down