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
This commit is contained in:
parent
e89aa48b07
commit
d7f0c1e399
|
|
@ -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,
|
||||
|
|
@ -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
|
||||
|
|
@ -86,6 +86,7 @@ spec:
|
|||
- loop_parameter
|
||||
- loop_static
|
||||
- resource_ops
|
||||
- multiple_outputs
|
||||
- ai_platform
|
||||
- parameterized_tfx_oss
|
||||
# Build and push image
|
||||
|
|
|
|||
Loading…
Reference in New Issue