Class: Google::Apis::MlV1::GoogleCloudMlV1ContainerSpec

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/ml_v1/classes.rb,
generated/google/apis/ml_v1/representations.rb,
generated/google/apis/ml_v1/representations.rb

Overview

Specification of a custom container for serving predictions. This message is a subset of the Kubernetes Container v1 core specification.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudMlV1ContainerSpec

Returns a new instance of GoogleCloudMlV1ContainerSpec.



950
951
952
# File 'generated/google/apis/ml_v1/classes.rb', line 950

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#argsArray<String>

Immutable. Specifies arguments for the command that runs when the container starts. This overrides the container's CMD. Specify this field as an array of executable and arguments, similar to a Docker CMD's "default parameters" form. If you don't specify this field but do specify the command field, then the command from the command field runs without any additional arguments. See the Kubernetes documentation about how the command and args fields interact with a container's ENTRYPOINT and CMD. If you don't specify this field and don't specify the commmand field, then the container' s ENTRYPOINT and CMD determine what runs based on their default behavior. See the Docker documentation about how CMD and ENTRYPOINT interact. In this field, you can reference environment variables set by AI Platform Prediction and environment variables set in the env field. You cannot reference environment variables set in the Docker image. In order for environment variables to be expanded, reference them by using the following syntax: $( VARIABLE_NAME) Note that this differs from Bash variable expansion, which does not use parentheses. If a variable cannot be resolved, the reference in the input string is used unchanged. To avoid variable expansion, you can escape this syntax with $$; for example: $$(VARIABLE_NAME) This field corresponds to the args field of the Kubernetes Containers v1 core API. Corresponds to the JSON property args

Returns:

  • (Array<String>)


863
864
865
# File 'generated/google/apis/ml_v1/classes.rb', line 863

def args
  @args
end

#commandArray<String>

Immutable. Specifies the command that runs when the container starts. This overrides the container's ENTRYPOINT. Specify this field as an array of executable and arguments, similar to a Docker ENTRYPOINT's "exec" form, not its "shell" form. If you do not specify this field, then the container's ENTRYPOINT runs, in conjunction with the args field or the container's CMD, if either exists. If this field is not specified and the container does not have an ENTRYPOINT, then refer to the Docker documentation about how CMD and ENTRYPOINT interact. If you specify this field, then you can also specify the args field to provide additional arguments for this command. However, if you specify this field, then the container's CMD is ignored. See the Kubernetes documentation about how the command and args fields interact with a container's ENTRYPOINT and CMD. In this field, you can reference environment variables set by AI Platform Prediction and environment variables set in the env field. You cannot reference environment variables set in the Docker image. In order for environment variables to be expanded, reference them by using the following syntax: $( VARIABLE_NAME) Note that this differs from Bash variable expansion, which does not use parentheses. If a variable cannot be resolved, the reference in the input string is used unchanged. To avoid variable expansion, you can escape this syntax with $$; for example: $$(VARIABLE_NAME) This field corresponds to the command field of the Kubernetes Containers v1 core API. Corresponds to the JSON property command

Returns:

  • (Array<String>)


894
895
896
# File 'generated/google/apis/ml_v1/classes.rb', line 894

def command
  @command
end

#envArray<Google::Apis::MlV1::GoogleCloudMlV1EnvVar>

Immutable. List of environment variables to set in the container. After the container starts running, code running in the container can read these environment variables. Additionally, the command and args fields can reference these variables. Later entries in this list can also reference earlier entries. For example, the following example sets the variable VAR_2 to have the value foo bar: json [ ` "name": "VAR_1", "value": "foo" `, ` "name": " VAR_2", "value": "$(VAR_1) bar" ` ] If you switch the order of the variables in the example, then the expansion does not occur. This field corresponds to the env field of the Kubernetes Containers v1 core API. Corresponds to the JSON property env



909
910
911
# File 'generated/google/apis/ml_v1/classes.rb', line 909

def env
  @env
end

#imageString

URI of the Docker image to be used as the custom container for serving predictions. This URI must identify an image in Artifact Registry and begin with the hostname REGION`-docker.pkg.dev`, whereREGION`is replaced by the region that matches AI Platform Prediction [regional endpoint](/ai-platform/prediction/docs/regional-endpoints) that you are using. For example, if you are using theus-central1-ml.googleapis.com endpoint, then this URI must begin withus-central1-docker.pkg.dev. To use a custom container, the [AI Platform Google-managed service account](/ai- platform/prediction/docs/custom-service-account#default) must have permission to pull (read) the Docker image at this URI. The AI Platform Google-managed service account has the following format:service-PROJECT_NUMBER@cloud-ml. google.com.iam.gserviceaccount.comPROJECT_NUMBERis replaced by your Google Cloud project number. By default, this service account has necessary permissions to pull an Artifact Registry image in the same Google Cloud project where you are using AI Platform Prediction. In this case, no configuration is necessary. If you want to use an image from a different Google Cloud project, learn how to [grant the Artifact Registry Reader (roles/ artifactregistry.reader) role for a repository](/artifact-registry/docs/access- control#grant-repo) to your projet's AI Platform Google-managed service account. To learn about the requirements for the Docker image itself, read [ Custom container requirements](/ai-platform/prediction/docs/custom-container- requirements). Corresponds to the JSON propertyimage`

Returns:

  • (String)


935
936
937
# File 'generated/google/apis/ml_v1/classes.rb', line 935

def image
  @image
end

#portsArray<Google::Apis::MlV1::GoogleCloudMlV1ContainerPort>

Immutable. List of ports to expose from the container. AI Platform Prediction sends any prediction requests that it receives to the first port on this list. AI Platform Prediction also sends liveness and health checks to this port. If you do not specify this field, it defaults to following value: json [ ` " containerPort": 8080 ` ] AI Platform Prediction does not use ports other than the first one listed. This field corresponds to the ports field of the Kubernetes Containers v1 core API. Corresponds to the JSON property ports



948
949
950
# File 'generated/google/apis/ml_v1/classes.rb', line 948

def ports
  @ports
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



955
956
957
958
959
960
961
# File 'generated/google/apis/ml_v1/classes.rb', line 955

def update!(**args)
  @args = args[:args] if args.key?(:args)
  @command = args[:command] if args.key?(:command)
  @env = args[:env] if args.key?(:env)
  @image = args[:image] if args.key?(:image)
  @ports = args[:ports] if args.key?(:ports)
end