custom_job.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.aiplatform.v1beta1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/aiplatform/v1beta1/encryption_spec.proto";
  19. import "google/cloud/aiplatform/v1beta1/env_var.proto";
  20. import "google/cloud/aiplatform/v1beta1/io.proto";
  21. import "google/cloud/aiplatform/v1beta1/job_state.proto";
  22. import "google/cloud/aiplatform/v1beta1/machine_resources.proto";
  23. import "google/protobuf/duration.proto";
  24. import "google/protobuf/timestamp.proto";
  25. import "google/rpc/status.proto";
  26. import "google/api/annotations.proto";
  27. option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
  28. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1;aiplatform";
  29. option java_multiple_files = true;
  30. option java_outer_classname = "CustomJobProto";
  31. option java_package = "com.google.cloud.aiplatform.v1beta1";
  32. option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
  33. option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
  34. // Represents a job that runs custom workloads such as a Docker container or a
  35. // Python package. A CustomJob can have multiple worker pools and each worker
  36. // pool can have its own machine and input spec. A CustomJob will be cleaned up
  37. // once the job enters terminal state (failed or succeeded).
  38. message CustomJob {
  39. option (google.api.resource) = {
  40. type: "aiplatform.googleapis.com/CustomJob"
  41. pattern: "projects/{project}/locations/{location}/customJobs/{custom_job}"
  42. };
  43. // Output only. Resource name of a CustomJob.
  44. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  45. // Required. The display name of the CustomJob.
  46. // The name can be up to 128 characters long and can be consist of any UTF-8
  47. // characters.
  48. string display_name = 2 [(google.api.field_behavior) = REQUIRED];
  49. // Required. Job spec.
  50. CustomJobSpec job_spec = 4 [(google.api.field_behavior) = REQUIRED];
  51. // Output only. The detailed state of the job.
  52. JobState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  53. // Output only. Time when the CustomJob was created.
  54. google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  55. // Output only. Time when the CustomJob for the first time entered the
  56. // `JOB_STATE_RUNNING` state.
  57. google.protobuf.Timestamp start_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  58. // Output only. Time when the CustomJob entered any of the following states:
  59. // `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`.
  60. google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  61. // Output only. Time when the CustomJob was most recently updated.
  62. google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  63. // Output only. Only populated when job's state is `JOB_STATE_FAILED` or
  64. // `JOB_STATE_CANCELLED`.
  65. google.rpc.Status error = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  66. // The labels with user-defined metadata to organize CustomJobs.
  67. //
  68. // Label keys and values can be no longer than 64 characters
  69. // (Unicode codepoints), can only contain lowercase letters, numeric
  70. // characters, underscores and dashes. International characters are allowed.
  71. //
  72. // See https://goo.gl/xmQnxf for more information and examples of labels.
  73. map<string, string> labels = 11;
  74. // Customer-managed encryption key options for a CustomJob. If this is set,
  75. // then all resources created by the CustomJob will be encrypted with the
  76. // provided encryption key.
  77. EncryptionSpec encryption_spec = 12;
  78. // Output only. The web access URIs for the training job.
  79. // The keys are the node names in the training jobs, e.g. workerpool0-0.
  80. // The values are the URIs for each node's web portal in the job.
  81. map<string, string> web_access_uris = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
  82. }
  83. // Represents the spec of a CustomJob.
  84. message CustomJobSpec {
  85. // Required. The spec of the worker pools including machine type and Docker image.
  86. // All worker pools except the first one are optional and can be skipped by
  87. // providing an empty value.
  88. repeated WorkerPoolSpec worker_pool_specs = 1 [(google.api.field_behavior) = REQUIRED];
  89. // Scheduling options for a CustomJob.
  90. Scheduling scheduling = 3;
  91. // Specifies the service account for workload run-as account.
  92. // Users submitting jobs must have act-as permission on this run-as account.
  93. // If unspecified, the [AI Platform Custom Code Service
  94. // Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
  95. // for the CustomJob's project is used.
  96. string service_account = 4;
  97. // The full name of the Compute Engine
  98. // [network](/compute/docs/networks-and-firewalls#networks) to which the Job
  99. // should be peered. For example, `projects/12345/global/networks/myVPC`.
  100. // [Format](/compute/docs/reference/rest/v1/networks/insert)
  101. // is of the form `projects/{project}/global/networks/{network}`.
  102. // Where {project} is a project number, as in `12345`, and {network} is a
  103. // network name.
  104. //
  105. // Private services access must already be configured for the network. If left
  106. // unspecified, the job is not peered with any network.
  107. string network = 5 [(google.api.resource_reference) = {
  108. type: "compute.googleapis.com/Network"
  109. }];
  110. // The Cloud Storage location to store the output of this CustomJob or
  111. // HyperparameterTuningJob. For HyperparameterTuningJob,
  112. // the baseOutputDirectory of
  113. // each child CustomJob backing a Trial is set to a subdirectory of name
  114. // [id][google.cloud.aiplatform.v1beta1.Trial.id] under its parent HyperparameterTuningJob's
  115. // baseOutputDirectory.
  116. //
  117. // The following Vertex AI environment variables will be passed to
  118. // containers or python modules when this field is set:
  119. //
  120. // For CustomJob:
  121. //
  122. // * AIP_MODEL_DIR = `<base_output_directory>/model/`
  123. // * AIP_CHECKPOINT_DIR = `<base_output_directory>/checkpoints/`
  124. // * AIP_TENSORBOARD_LOG_DIR = `<base_output_directory>/logs/`
  125. //
  126. // For CustomJob backing a Trial of HyperparameterTuningJob:
  127. //
  128. // * AIP_MODEL_DIR = `<base_output_directory>/<trial_id>/model/`
  129. // * AIP_CHECKPOINT_DIR = `<base_output_directory>/<trial_id>/checkpoints/`
  130. // * AIP_TENSORBOARD_LOG_DIR = `<base_output_directory>/<trial_id>/logs/`
  131. GcsDestination base_output_directory = 6;
  132. // Optional. The name of a Vertex AI [Tensorboard][google.cloud.aiplatform.v1beta1.Tensorboard] resource to which this CustomJob
  133. // will upload Tensorboard logs.
  134. // Format:
  135. // `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
  136. string tensorboard = 7 [
  137. (google.api.field_behavior) = OPTIONAL,
  138. (google.api.resource_reference) = {
  139. type: "aiplatform.googleapis.com/Tensorboard"
  140. }
  141. ];
  142. // Optional. Vertex AI will enable web portal access to the containers. The portals
  143. // can be accessed on web via the URLs given by [web_access_uris][].
  144. bool enable_web_access = 10 [(google.api.field_behavior) = OPTIONAL];
  145. }
  146. // Represents the spec of a worker pool in a job.
  147. message WorkerPoolSpec {
  148. // The custom task to be executed in this worker pool.
  149. oneof task {
  150. // The custom container task.
  151. ContainerSpec container_spec = 6;
  152. // The Python packaged task.
  153. PythonPackageSpec python_package_spec = 7;
  154. }
  155. // Optional. Immutable. The specification of a single machine.
  156. MachineSpec machine_spec = 1 [
  157. (google.api.field_behavior) = OPTIONAL,
  158. (google.api.field_behavior) = IMMUTABLE
  159. ];
  160. // Optional. The number of worker replicas to use for this worker pool.
  161. int64 replica_count = 2 [(google.api.field_behavior) = OPTIONAL];
  162. // Disk spec.
  163. DiskSpec disk_spec = 5;
  164. }
  165. // The spec of a Container.
  166. message ContainerSpec {
  167. // Required. The URI of a container image in the Container Registry that is to be run on
  168. // each worker replica.
  169. string image_uri = 1 [(google.api.field_behavior) = REQUIRED];
  170. // The command to be invoked when the container is started.
  171. // It overrides the entrypoint instruction in Dockerfile when provided.
  172. repeated string command = 2;
  173. // The arguments to be passed when starting the container.
  174. repeated string args = 3;
  175. }
  176. // The spec of a Python packaged code.
  177. message PythonPackageSpec {
  178. // Required. The URI of a container image in Artifact Registry that will run the
  179. // provided Python package. Vertex AI provides a wide range of executor
  180. // images with pre-installed packages to meet users' various use cases. See
  181. // the list of [pre-built containers for
  182. // training](https://cloud.google.com/vertex-ai/docs/training/pre-built-containers).
  183. // You must use an image from this list.
  184. string executor_image_uri = 1 [(google.api.field_behavior) = REQUIRED];
  185. // Required. The Google Cloud Storage location of the Python package files which are
  186. // the training program and its dependent packages.
  187. // The maximum number of package URIs is 100.
  188. repeated string package_uris = 2 [(google.api.field_behavior) = REQUIRED];
  189. // Required. The Python module name to run after installing the packages.
  190. string python_module = 3 [(google.api.field_behavior) = REQUIRED];
  191. // Command line arguments to be passed to the Python task.
  192. repeated string args = 4;
  193. }
  194. // All parameters related to queuing and scheduling of custom jobs.
  195. message Scheduling {
  196. // The maximum job running time. The default is 7 days.
  197. google.protobuf.Duration timeout = 1;
  198. // Restarts the entire CustomJob if a worker gets restarted.
  199. // This feature can be used by distributed training jobs that are not
  200. // resilient to workers leaving and joining a job.
  201. bool restart_job_on_worker_restart = 3;
  202. }