xref: /aosp_15_r20/external/googleapis/google/cloud/notebooks/v1/execution.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.notebooks.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/timestamp.proto";
22
23option go_package = "cloud.google.com/go/notebooks/apiv1/notebookspb;notebookspb";
24option java_multiple_files = true;
25option java_outer_classname = "ExecutionProto";
26option java_package = "com.google.cloud.notebooks.v1";
27option (google.api.resource_definition) = {
28  type: "aiplatform.googleapis.com/Tensorboard"
29  pattern: "projects/{project}/locations/{location}/tensorboards/{tensorboard}"
30};
31
32// The description a notebook execution workload.
33message ExecutionTemplate {
34  // Required. Specifies the machine types, the number of replicas for workers
35  // and parameter servers.
36  enum ScaleTier {
37    // Unspecified Scale Tier.
38    SCALE_TIER_UNSPECIFIED = 0;
39
40    // A single worker instance. This tier is suitable for learning how to use
41    // Cloud ML, and for experimenting with new models using small datasets.
42    BASIC = 1;
43
44    // Many workers and a few parameter servers.
45    STANDARD_1 = 2;
46
47    // A large number of workers with many parameter servers.
48    PREMIUM_1 = 3;
49
50    // A single worker instance with a K80 GPU.
51    BASIC_GPU = 4;
52
53    // A single worker instance with a Cloud TPU.
54    BASIC_TPU = 5;
55
56    // The CUSTOM tier is not a set tier, but rather enables you to use your
57    // own cluster specification. When you use this tier, set values to
58    // configure your processing cluster according to these guidelines:
59    //
60    // *   You _must_ set `ExecutionTemplate.masterType` to specify the type
61    //     of machine to use for your master node. This is the only required
62    //     setting.
63    CUSTOM = 6;
64  }
65
66  // Hardware accelerator types for AI Platform Training jobs.
67  enum SchedulerAcceleratorType {
68    // Unspecified accelerator type. Default to no GPU.
69    SCHEDULER_ACCELERATOR_TYPE_UNSPECIFIED = 0;
70
71    // Nvidia Tesla K80 GPU.
72    NVIDIA_TESLA_K80 = 1;
73
74    // Nvidia Tesla P100 GPU.
75    NVIDIA_TESLA_P100 = 2;
76
77    // Nvidia Tesla V100 GPU.
78    NVIDIA_TESLA_V100 = 3;
79
80    // Nvidia Tesla P4 GPU.
81    NVIDIA_TESLA_P4 = 4;
82
83    // Nvidia Tesla T4 GPU.
84    NVIDIA_TESLA_T4 = 5;
85
86    // Nvidia Tesla A100 GPU.
87    NVIDIA_TESLA_A100 = 10;
88
89    // TPU v2.
90    TPU_V2 = 6;
91
92    // TPU v3.
93    TPU_V3 = 7;
94  }
95
96  // Definition of a hardware accelerator. Note that not all combinations
97  // of `type` and `core_count` are valid. Check [GPUs on
98  // Compute Engine](https://cloud.google.com/compute/docs/gpus) to find a valid
99  // combination. TPUs are not supported.
100  message SchedulerAcceleratorConfig {
101    // Type of this accelerator.
102    SchedulerAcceleratorType type = 1;
103
104    // Count of cores of this accelerator.
105    int64 core_count = 2;
106  }
107
108  // The backend used for this execution.
109  enum JobType {
110    // No type specified.
111    JOB_TYPE_UNSPECIFIED = 0;
112
113    // Custom Job in `aiplatform.googleapis.com`.
114    // Default value for an execution.
115    VERTEX_AI = 1;
116
117    // Run execution on a cluster with Dataproc as a job.
118    // https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs
119    DATAPROC = 2;
120  }
121
122  // Parameters used in Dataproc JobType executions.
123  message DataprocParameters {
124    // URI for cluster used to run Dataproc execution.
125    // Format: `projects/{PROJECT_ID}/regions/{REGION}/clusters/{CLUSTER_NAME}`
126    string cluster = 1;
127  }
128
129  // Parameters used in Vertex AI JobType executions.
130  message VertexAIParameters {
131    // The full name of the Compute Engine
132    // [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks)
133    // to which the Job should be peered. For example,
134    // `projects/12345/global/networks/myVPC`.
135    // [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert)
136    // is of the form `projects/{project}/global/networks/{network}`.
137    // Where `{project}` is a project number, as in `12345`, and `{network}` is
138    // a network name.
139    //
140    // Private services access must already be configured for the network. If
141    // left unspecified, the job is not peered with any network.
142    string network = 1;
143
144    // Environment variables.
145    // At most 100 environment variables can be specified and unique.
146    // Example: `GCP_BUCKET=gs://my-bucket/samples/`
147    map<string, string> env = 2;
148  }
149
150  // Required. Scale tier of the hardware used for notebook execution.
151  // DEPRECATED Will be discontinued. As right now only CUSTOM is supported.
152  ScaleTier scale_tier = 1 [
153    deprecated = true,
154    (google.api.field_behavior) = REQUIRED
155  ];
156
157  // Specifies the type of virtual machine to use for your training
158  // job's master worker. You must specify this field when `scaleTier` is set to
159  // `CUSTOM`.
160  //
161  // You can use certain Compute Engine machine types directly in this field.
162  // The following types are supported:
163  //
164  // - `n1-standard-4`
165  // - `n1-standard-8`
166  // - `n1-standard-16`
167  // - `n1-standard-32`
168  // - `n1-standard-64`
169  // - `n1-standard-96`
170  // - `n1-highmem-2`
171  // - `n1-highmem-4`
172  // - `n1-highmem-8`
173  // - `n1-highmem-16`
174  // - `n1-highmem-32`
175  // - `n1-highmem-64`
176  // - `n1-highmem-96`
177  // - `n1-highcpu-16`
178  // - `n1-highcpu-32`
179  // - `n1-highcpu-64`
180  // - `n1-highcpu-96`
181  //
182  //
183  // Alternatively, you can use the following legacy machine types:
184  //
185  // - `standard`
186  // - `large_model`
187  // - `complex_model_s`
188  // - `complex_model_m`
189  // - `complex_model_l`
190  // - `standard_gpu`
191  // - `complex_model_m_gpu`
192  // - `complex_model_l_gpu`
193  // - `standard_p100`
194  // - `complex_model_m_p100`
195  // - `standard_v100`
196  // - `large_model_v100`
197  // - `complex_model_m_v100`
198  // - `complex_model_l_v100`
199  //
200  //
201  // Finally, if you want to use a TPU for training, specify `cloud_tpu` in this
202  // field. Learn more about the [special configuration options for training
203  // with
204  // TPU](https://cloud.google.com/ai-platform/training/docs/using-tpus#configuring_a_custom_tpu_machine).
205  string master_type = 2;
206
207  // Configuration (count and accelerator type) for hardware running notebook
208  // execution.
209  SchedulerAcceleratorConfig accelerator_config = 3;
210
211  // Labels for execution.
212  // If execution is scheduled, a field included will be 'nbs-scheduled'.
213  // Otherwise, it is an immediate execution, and an included field will be
214  // 'nbs-immediate'. Use fields to efficiently index between various types of
215  // executions.
216  map<string, string> labels = 4;
217
218  // Path to the notebook file to execute.
219  // Must be in a Google Cloud Storage bucket.
220  // Format: `gs://{bucket_name}/{folder}/{notebook_file_name}`
221  // Ex: `gs://notebook_user/scheduled_notebooks/sentiment_notebook.ipynb`
222  string input_notebook_file = 5;
223
224  // Container Image URI to a DLVM
225  // Example: 'gcr.io/deeplearning-platform-release/base-cu100'
226  // More examples can be found at:
227  // https://cloud.google.com/ai-platform/deep-learning-containers/docs/choosing-container
228  string container_image_uri = 6;
229
230  // Path to the notebook folder to write to.
231  // Must be in a Google Cloud Storage bucket path.
232  // Format: `gs://{bucket_name}/{folder}`
233  // Ex: `gs://notebook_user/scheduled_notebooks`
234  string output_notebook_folder = 7;
235
236  // Parameters to be overridden in the notebook during execution.
237  // Ref https://papermill.readthedocs.io/en/latest/usage-parameterize.html on
238  // how to specifying parameters in the input notebook and pass them here
239  // in an YAML file.
240  // Ex: `gs://notebook_user/scheduled_notebooks/sentiment_notebook_params.yaml`
241  string params_yaml_file = 8;
242
243  // Parameters used within the 'input_notebook_file' notebook.
244  string parameters = 9;
245
246  // The email address of a service account to use when running the execution.
247  // You must have the `iam.serviceAccounts.actAs` permission for the specified
248  // service account.
249  string service_account = 10;
250
251  // The type of Job to be used on this execution.
252  JobType job_type = 11;
253
254  // Parameters for an execution type.
255  // NOTE: There are currently no extra parameters for VertexAI jobs.
256  oneof job_parameters {
257    // Parameters used in Dataproc JobType executions.
258    DataprocParameters dataproc_parameters = 12;
259
260    // Parameters used in Vertex AI JobType executions.
261    VertexAIParameters vertex_ai_parameters = 13;
262  }
263
264  // Name of the kernel spec to use. This must be specified if the
265  // kernel spec name on the execution target does not match the name in the
266  // input notebook file.
267  string kernel_spec = 14;
268
269  // The name of a Vertex AI [Tensorboard] resource to which this execution
270  // will upload Tensorboard logs.
271  // Format:
272  // `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
273  string tensorboard = 15 [(google.api.resource_reference) = {
274                             type: "aiplatform.googleapis.com/Tensorboard"
275                           }];
276}
277
278// The definition of a single executed notebook.
279message Execution {
280  option (google.api.resource) = {
281    type: "notebooks.googleapis.com/Execution"
282    pattern: "projects/{project}/location/{location}/executions/{execution}"
283  };
284
285  // Enum description of the state of the underlying AIP job.
286  enum State {
287    // The job state is unspecified.
288    STATE_UNSPECIFIED = 0;
289
290    // The job has been just created and processing has not yet begun.
291    QUEUED = 1;
292
293    // The service is preparing to execution the job.
294    PREPARING = 2;
295
296    // The job is in progress.
297    RUNNING = 3;
298
299    // The job completed successfully.
300    SUCCEEDED = 4;
301
302    // The job failed.
303    // `error_message` should contain the details of the failure.
304    FAILED = 5;
305
306    // The job is being cancelled.
307    // `error_message` should describe the reason for the cancellation.
308    CANCELLING = 6;
309
310    // The job has been cancelled.
311    // `error_message` should describe the reason for the cancellation.
312    CANCELLED = 7;
313
314    // The job has become expired (relevant to Vertex AI jobs)
315    // https://cloud.google.com/vertex-ai/docs/reference/rest/v1/JobState
316    EXPIRED = 9;
317
318    // The Execution is being created.
319    INITIALIZING = 10;
320  }
321
322  // execute metadata including name, hardware spec, region, labels, etc.
323  ExecutionTemplate execution_template = 1;
324
325  // Output only. The resource name of the execute. Format:
326  // `projects/{project_id}/locations/{location}/executions/{execution_id}`
327  string name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
328
329  // Output only. Name used for UI purposes.
330  // Name can only contain alphanumeric characters and underscores '_'.
331  string display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
332
333  // A brief description of this execution.
334  string description = 4;
335
336  // Output only. Time the Execution was instantiated.
337  google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
338
339  // Output only. Time the Execution was last updated.
340  google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
341
342  // Output only. State of the underlying AI Platform job.
343  State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
344
345  // Output notebook file generated by this execution
346  string output_notebook_file = 8;
347
348  // Output only. The URI of the external job used to execute the notebook.
349  string job_uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
350}
351