|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 |
|
3 |
| -# Copyright 2022 Google LLC |
| 3 | +# Copyright 2023 Google LLC |
4 | 4 | #
|
5 | 5 | # Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 6 | # you may not use this file except in compliance with the License.
|
@@ -5827,7 +5827,7 @@ def __init__(
|
5827 | 5827 | self,
|
5828 | 5828 | # TODO(b/223262536): Make display_name parameter fully optional in next major release
|
5829 | 5829 | display_name: str,
|
5830 |
| - python_package_gcs_uri: str, |
| 5830 | + python_package_gcs_uri: Union[str, List[str]], |
5831 | 5831 | python_module_name: str,
|
5832 | 5832 | container_uri: str,
|
5833 | 5833 | model_serving_container_image_uri: Optional[str] = None,
|
@@ -5891,53 +5891,56 @@ def __init__(
|
5891 | 5891 | Args:
|
5892 | 5892 | display_name (str):
|
5893 | 5893 | Required. The user-defined name of this TrainingPipeline.
|
5894 |
| - python_package_gcs_uri (str): |
5895 |
| - Required: GCS location of the training python package. |
| 5894 | + python_package_gcs_uri (Union[str, List[str]]): |
| 5895 | + Required. GCS location of the training python package. |
| 5896 | + Could be a string for single package or a list of string for |
| 5897 | + multiple packages. |
5896 | 5898 | python_module_name (str):
|
5897 |
| - Required: The module name of the training python package. |
| 5899 | + Required. The module name of the training python package. |
5898 | 5900 | container_uri (str):
|
5899 |
| - Required: Uri of the training container image in the GCR. |
| 5901 | + Required. Uri of the training container image in the GCR. |
5900 | 5902 | model_serving_container_image_uri (str):
|
5901 |
| - If the training produces a managed Vertex AI Model, the URI of the |
5902 |
| - Model serving container suitable for serving the model produced by the |
5903 |
| - training script. |
| 5903 | + Optional. If the training produces a managed Vertex AI Model, |
| 5904 | + the URI of the model serving container suitable for serving the |
| 5905 | + model produced by the training script. |
5904 | 5906 | model_serving_container_predict_route (str):
|
5905 |
| - If the training produces a managed Vertex AI Model, An HTTP path to |
5906 |
| - send prediction requests to the container, and which must be supported |
5907 |
| - by it. If not specified a default HTTP path will be used by Vertex AI. |
| 5907 | + Optional. If the training produces a managed Vertex AI Model, |
| 5908 | + an HTTP path to send prediction requests to the container, |
| 5909 | + and which must be supported by it. If not specified a default |
| 5910 | + HTTP path will be used by Vertex AI. |
5908 | 5911 | model_serving_container_health_route (str):
|
5909 |
| - If the training produces a managed Vertex AI Model, an HTTP path to |
5910 |
| - send health check requests to the container, and which must be supported |
5911 |
| - by it. If not specified a standard HTTP path will be used by AI |
5912 |
| - Platform. |
| 5912 | + Optional. If the training produces a managed Vertex AI Model, |
| 5913 | + an HTTP path to send health check requests to the container, |
| 5914 | + and which must be supported by it. If not specified a standard |
| 5915 | + HTTP path will be used by AI Platform. |
5913 | 5916 | model_serving_container_command (Sequence[str]):
|
5914 |
| - The command with which the container is run. Not executed within a |
| 5917 | + Optional. The command with which the container is run. Not executed within a |
5915 | 5918 | shell. The Docker image's ENTRYPOINT is used if this is not provided.
|
5916 | 5919 | Variable references $(VAR_NAME) are expanded using the container's
|
5917 | 5920 | environment. If a variable cannot be resolved, the reference in the
|
5918 | 5921 | input string will be unchanged. The $(VAR_NAME) syntax can be escaped
|
5919 | 5922 | with a double $$, ie: $$(VAR_NAME). Escaped references will never be
|
5920 | 5923 | expanded, regardless of whether the variable exists or not.
|
5921 | 5924 | model_serving_container_args (Sequence[str]):
|
5922 |
| - The arguments to the command. The Docker image's CMD is used if this is |
5923 |
| - not provided. Variable references $(VAR_NAME) are expanded using the |
| 5925 | + Optional. The arguments to the command. The Docker image's CMD is used if this |
| 5926 | + is not provided. Variable references $(VAR_NAME) are expanded using the |
5924 | 5927 | container's environment. If a variable cannot be resolved, the reference
|
5925 | 5928 | in the input string will be unchanged. The $(VAR_NAME) syntax can be
|
5926 | 5929 | escaped with a double $$, ie: $$(VAR_NAME). Escaped references will
|
5927 | 5930 | never be expanded, regardless of whether the variable exists or not.
|
5928 | 5931 | model_serving_container_environment_variables (Dict[str, str]):
|
5929 |
| - The environment variables that are to be present in the container. |
| 5932 | + Optional. The environment variables that are to be present in the container. |
5930 | 5933 | Should be a dictionary where keys are environment variable names
|
5931 | 5934 | and values are environment variable values for those names.
|
5932 | 5935 | model_serving_container_ports (Sequence[int]):
|
5933 |
| - Declaration of ports that are exposed by the container. This field is |
5934 |
| - primarily informational, it gives Vertex AI information about the |
5935 |
| - network connections the container uses. Listing or not a port here has |
5936 |
| - no impact on whether the port is actually exposed, any port listening on |
5937 |
| - the default "0.0.0.0" address inside a container will be accessible from |
5938 |
| - the network. |
| 5936 | + Optional. Declaration of ports that are exposed by the container. |
| 5937 | + This field is primarily informational, it gives Vertex AI information |
| 5938 | + about the network connections the container uses. Listing or not |
| 5939 | + a port here has no impact on whether the port is actually exposed, |
| 5940 | + any port listening on the default "0.0.0.0" address inside a |
| 5941 | + container will be accessible from the network. |
5939 | 5942 | model_description (str):
|
5940 |
| - The description of the Model. |
| 5943 | + Optional. The description of the Model. |
5941 | 5944 | model_instance_schema_uri (str):
|
5942 | 5945 | Optional. Points to a YAML file stored on Google Cloud
|
5943 | 5946 | Storage describing the format of a single instance, which
|
@@ -6036,7 +6039,7 @@ def __init__(
|
6036 | 6039 |
|
6037 | 6040 | Overrides encryption_spec_key_name set in aiplatform.init.
|
6038 | 6041 | staging_bucket (str):
|
6039 |
| - Bucket used to stage source and training artifacts. Overrides |
| 6042 | + Optional. Bucket used to stage source and training artifacts. Overrides |
6040 | 6043 | staging_bucket set in aiplatform.init.
|
6041 | 6044 | """
|
6042 | 6045 | if not display_name:
|
@@ -6066,7 +6069,12 @@ def __init__(
|
6066 | 6069 | staging_bucket=staging_bucket,
|
6067 | 6070 | )
|
6068 | 6071 |
|
6069 |
| - self._package_gcs_uri = python_package_gcs_uri |
| 6072 | + if isinstance(python_package_gcs_uri, str): |
| 6073 | + self._package_gcs_uri = [python_package_gcs_uri] |
| 6074 | + elif isinstance(python_package_gcs_uri, list): |
| 6075 | + self._package_gcs_uri = python_package_gcs_uri |
| 6076 | + else: |
| 6077 | + raise ValueError("'python_package_gcs_uri' must be a string or list.") |
6070 | 6078 | self._python_module = python_module_name
|
6071 | 6079 |
|
6072 | 6080 | def run(
|
@@ -6668,7 +6676,7 @@ def _run(
|
6668 | 6676 | spec["python_package_spec"] = {
|
6669 | 6677 | "executor_image_uri": self._container_uri,
|
6670 | 6678 | "python_module": self._python_module,
|
6671 |
| - "package_uris": [self._package_gcs_uri], |
| 6679 | + "package_uris": self._package_gcs_uri, |
6672 | 6680 | }
|
6673 | 6681 |
|
6674 | 6682 | if args:
|
|
0 commit comments