From 71ea538d922c5cb4115fc5340a956d4c7bceb1be Mon Sep 17 00:00:00 2001 From: Google APIs Date: Mon, 29 Jan 2024 10:25:04 -0800 Subject: [PATCH] feat: add session and session_template controllers PiperOrigin-RevId: 602428194 --- google/cloud/dataproc/v1/BUILD.bazel | 2 + google/cloud/dataproc/v1/dataproc_v1.yaml | 11 + google/cloud/dataproc/v1/operations.proto | 44 ++- .../cloud/dataproc/v1/session_templates.proto | 213 ++++++++++ google/cloud/dataproc/v1/sessions.proto | 371 ++++++++++++++++++ google/cloud/dataproc/v1/shared.proto | 100 ++++- 6 files changed, 723 insertions(+), 18 deletions(-) create mode 100644 google/cloud/dataproc/v1/session_templates.proto create mode 100644 google/cloud/dataproc/v1/sessions.proto diff --git a/google/cloud/dataproc/v1/BUILD.bazel b/google/cloud/dataproc/v1/BUILD.bazel index 45ca74b45c316..759cdade283ae 100644 --- a/google/cloud/dataproc/v1/BUILD.bazel +++ b/google/cloud/dataproc/v1/BUILD.bazel @@ -27,6 +27,8 @@ proto_library( "jobs.proto", "node_groups.proto", "operations.proto", + "session_templates.proto", + "sessions.proto", "shared.proto", "workflow_templates.proto", ], diff --git a/google/cloud/dataproc/v1/dataproc_v1.yaml b/google/cloud/dataproc/v1/dataproc_v1.yaml index e1da3ab29e8fa..72a826998db93 100644 --- a/google/cloud/dataproc/v1/dataproc_v1.yaml +++ b/google/cloud/dataproc/v1/dataproc_v1.yaml @@ -9,6 +9,8 @@ apis: - name: google.cloud.dataproc.v1.ClusterController - name: google.cloud.dataproc.v1.JobController - name: google.cloud.dataproc.v1.NodeGroupController +- name: google.cloud.dataproc.v1.SessionController +- name: google.cloud.dataproc.v1.SessionTemplateController - name: google.cloud.dataproc.v1.WorkflowTemplateService - name: google.iam.v1.IAMPolicy - name: google.longrunning.Operations @@ -19,6 +21,7 @@ types: - name: google.cloud.dataproc.v1.DiagnoseClusterResults - name: google.cloud.dataproc.v1.JobMetadata - name: google.cloud.dataproc.v1.NodeGroupOperationMetadata +- name: google.cloud.dataproc.v1.SessionOperationMetadata - name: google.cloud.dataproc.v1.WorkflowMetadata documentation: @@ -136,6 +139,14 @@ authentication: oauth: canonical_scopes: |- https://www.googleapis.com/auth/cloud-platform + - selector: 'google.cloud.dataproc.v1.SessionController.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.cloud.dataproc.v1.SessionTemplateController.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform - selector: 'google.cloud.dataproc.v1.WorkflowTemplateService.*' oauth: canonical_scopes: |- diff --git a/google/cloud/dataproc/v1/operations.proto b/google/cloud/dataproc/v1/operations.proto index d9fad26d2128f..234847dba2c5f 100644 --- a/google/cloud/dataproc/v1/operations.proto +++ b/google/cloud/dataproc/v1/operations.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,6 +60,48 @@ message BatchOperationMetadata { repeated string warnings = 9; } +// Metadata describing the Session operation. +message SessionOperationMetadata { + // Operation type for Session resources + enum SessionOperationType { + // Session operation type is unknown. + SESSION_OPERATION_TYPE_UNSPECIFIED = 0; + + // Create Session operation type. + CREATE = 1; + + // Terminate Session operation type. + TERMINATE = 2; + + // Delete Session operation type. + DELETE = 3; + } + + // Name of the session for the operation. + string session = 1; + + // Session UUID for the operation. + string session_uuid = 2; + + // The time when the operation was created. + google.protobuf.Timestamp create_time = 3; + + // The time when the operation was finished. + google.protobuf.Timestamp done_time = 4; + + // The operation type. + SessionOperationType operation_type = 6; + + // Short description of the operation. + string description = 7; + + // Labels associated with the operation. + map labels = 8; + + // Warnings encountered during operation execution. + repeated string warnings = 9; +} + // The status of the operation. message ClusterOperationStatus { // The operation state. diff --git a/google/cloud/dataproc/v1/session_templates.proto b/google/cloud/dataproc/v1/session_templates.proto new file mode 100644 index 0000000000000..6031dffcb0c87 --- /dev/null +++ b/google/cloud/dataproc/v1/session_templates.proto @@ -0,0 +1,213 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dataproc/v1/sessions.proto"; +import "google/cloud/dataproc/v1/shared.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "SessionTemplatesProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// The SessionTemplateController provides methods to manage session templates. +service SessionTemplateController { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Create a session template synchronously. + rpc CreateSessionTemplate(CreateSessionTemplateRequest) + returns (SessionTemplate) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/sessionTemplates" + body: "session_template" + }; + option (google.api.method_signature) = "parent,session_template"; + } + + // Updates the session template synchronously. + rpc UpdateSessionTemplate(UpdateSessionTemplateRequest) + returns (SessionTemplate) { + option (google.api.http) = { + patch: "/v1/{session_template.name=projects/*/locations/*/sessionTemplates/*}" + body: "session_template" + }; + option (google.api.method_signature) = "session_template"; + } + + // Gets the resource representation for a session template. + rpc GetSessionTemplate(GetSessionTemplateRequest) returns (SessionTemplate) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/sessionTemplates/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists session templates. + rpc ListSessionTemplates(ListSessionTemplatesRequest) + returns (ListSessionTemplatesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/sessionTemplates" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a session template. + rpc DeleteSessionTemplate(DeleteSessionTemplateRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/sessionTemplates/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// A request to create a session template. +message CreateSessionTemplateRequest { + // Required. The parent resource where this session template will be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/SessionTemplate" + } + ]; + + // Required. The session template to create. + SessionTemplate session_template = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to update a session template. +message UpdateSessionTemplateRequest { + // Required. The updated session template. + SessionTemplate session_template = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to get the resource representation for a session template. +message GetSessionTemplateRequest { + // Required. The name of the session template to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/SessionTemplate" + } + ]; +} + +// A request to list session templates in a project. +message ListSessionTemplatesRequest { + // Required. The parent that owns this collection of session templates. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/SessionTemplate" + } + ]; + + // Optional. The maximum number of sessions to return in each response. + // The service may return fewer than this value. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token received from a previous `ListSessions` call. + // Provide this token to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter for the session templates to return in the response. + // Filters are case sensitive and have the following syntax: + // + // [field = value] AND [field [= value]] ... + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A list of session templates. +message ListSessionTemplatesResponse { + // Output only. Session template list + repeated SessionTemplate session_templates = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// A request to delete a session template. +message DeleteSessionTemplateRequest { + // Required. The name of the session template resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/SessionTemplate" + } + ]; +} + +// A representation of a session template. +message SessionTemplate { + option (google.api.resource) = { + type: "dataproc.googleapis.com/SessionTemplate" + pattern: "projects/{project}/locations/{location}/sessionTemplates/{template}" + }; + + // Required. The resource name of the session template. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Brief description of the template. + string description = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time when the template was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The session configuration. + oneof session_config { + // Optional. Jupyter session config. + JupyterConfig jupyter_session = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The email address of the user who created the template. + string creator = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels to associate with sessions created using this template. + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // Label **values** can be empty, but, if present, must contain 1 to 63 + // characters and conform to [RFC + // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be + // associated with a session. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Runtime configuration for session execution. + RuntimeConfig runtime_config = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Environment configuration for session execution. + EnvironmentConfig environment_config = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time the template was last updated. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A session template UUID (Unique Universal Identifier). The + // service generates this value when it creates the session template. + string uuid = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/google/cloud/dataproc/v1/sessions.proto b/google/cloud/dataproc/v1/sessions.proto new file mode 100644 index 0000000000000..5e7b02acca0b2 --- /dev/null +++ b/google/cloud/dataproc/v1/sessions.proto @@ -0,0 +1,371 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dataproc/v1/shared.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "SessionsProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// The `SessionController` provides methods to manage interactive sessions. +service SessionController { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Create an interactive session asynchronously. + rpc CreateSession(CreateSessionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/sessions" + body: "session" + }; + option (google.api.method_signature) = "parent,session,session_id"; + option (google.longrunning.operation_info) = { + response_type: "Session" + metadata_type: "google.cloud.dataproc.v1.SessionOperationMetadata" + }; + } + + // Gets the resource representation for an interactive session. + rpc GetSession(GetSessionRequest) returns (Session) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/sessions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists interactive sessions. + rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/sessions" + }; + option (google.api.method_signature) = "parent"; + } + + // Terminates the interactive session. + rpc TerminateSession(TerminateSessionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/sessions/*}:terminate" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Session" + metadata_type: "google.cloud.dataproc.v1.SessionOperationMetadata" + }; + } + + // Deletes the interactive session resource. If the session is not in terminal + // state, it is terminated, and then deleted. + rpc DeleteSession(DeleteSessionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/sessions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Session" + metadata_type: "google.cloud.dataproc.v1.SessionOperationMetadata" + }; + } +} + +// A request to create a session. +message CreateSessionRequest { + // Required. The parent resource where this session will be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/Session" + } + ]; + + // Required. The interactive session to create. + Session session = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the session, which becomes the final component + // of the session's resource name. + // + // This value must be 4-63 characters. Valid characters + // are /[a-z][0-9]-/. + string session_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique ID used to identify the request. If the service + // receives two + // [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s + // with the same ID, the second request is ignored, and the + // first [Session][google.cloud.dataproc.v1.Session] is created and stored in + // the backend. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The value must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get the resource representation for a session. +message GetSessionRequest { + // Required. The name of the session to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/Session" + } + ]; +} + +// A request to list sessions in a project. +message ListSessionsRequest { + // Required. The parent, which owns this collection of sessions. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/Session" + } + ]; + + // Optional. The maximum number of sessions to return in each response. + // The service may return fewer than this value. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token received from a previous `ListSessions` call. + // Provide this token to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter for the sessions to return in the response. + // + // A filter is a logical expression constraining the values of various fields + // in each session resource. Filters are case sensitive, and may contain + // multiple clauses combined with logical operators (AND, OR). + // Supported fields are `session_id`, `session_uuid`, `state`, and + // `create_time`. + // + // Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"` + // is a filter for sessions in an ACTIVE state that were created before + // 2023-01-01. + // + // See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed + // description of the filter syntax and a list of supported comparators. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A list of interactive sessions. +message ListSessionsResponse { + // Output only. The sessions from the specified collection. + repeated Session sessions = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A token, which can be sent as `page_token`, to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// A request to terminate an interactive session. +message TerminateSessionRequest { + // Required. The name of the session resource to terminate. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/Session" + } + ]; + + // Optional. A unique ID used to identify the request. If the service + // receives two + // [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s + // with the same ID, the second request is ignored. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The value must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a session. +message DeleteSessionRequest { + // Required. The name of the session resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/Session" + } + ]; + + // Optional. A unique ID used to identify the request. If the service + // receives two + // [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s + // with the same ID, the second request is ignored. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The value must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A representation of a session. +message Session { + option (google.api.resource) = { + type: "dataproc.googleapis.com/Session" + pattern: "projects/{project}/locations/{location}/sessions/{session}" + }; + + // The session state. + enum State { + // The session state is unknown. + STATE_UNSPECIFIED = 0; + + // The session is created prior to running. + CREATING = 1; + + // The session is running. + ACTIVE = 2; + + // The session is terminating. + TERMINATING = 3; + + // The session is terminated successfully. + TERMINATED = 4; + + // The session is no longer running due to an error. + FAILED = 5; + } + + // Historical state information. + message SessionStateHistory { + // Output only. The state of the session at this point in the session + // history. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Details about the state at this point in the session + // history. + string state_message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the session entered the historical state. + google.protobuf.Timestamp state_start_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Required. The resource name of the session. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. A session UUID (Unique Universal Identifier). The service + // generates this value when it creates the session. + string uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the session was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The session configuration. + oneof session_config { + // Optional. Jupyter session config. + JupyterConfig jupyter_session = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. Runtime information about session execution. + RuntimeInfo runtime_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A state of the session. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Session state details, such as the failure + // description if the state is `FAILED`. + string state_message = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the session entered the current state. + google.protobuf.Timestamp state_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The email address of the user who created the session. + string creator = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The labels to associate with the session. + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // Label **values** may be empty, but, if present, must contain 1 to 63 + // characters, and must conform to [RFC + // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be + // associated with a session. + map labels = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Runtime configuration for the session execution. + RuntimeConfig runtime_config = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Environment configuration for the session execution. + EnvironmentConfig environment_config = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The email address of the user who owns the session. + string user = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Historical state information for the session. + repeated SessionStateHistory state_history = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The session template used by the session. + // + // Only resource names, including project ID and location, are valid. + // + // Example: + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]` + // * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]` + // + // The template must be in the same project and Dataproc region as the + // session. + string session_template = 16 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/SessionTemplate" + } + ]; +} + +// Jupyter configuration for an interactive session. +message JupyterConfig { + // Jupyter kernel types. + enum Kernel { + // The kernel is unknown. + KERNEL_UNSPECIFIED = 0; + + // Python kernel. + PYTHON = 1; + + // Scala kernel. + SCALA = 2; + } + + // Optional. Kernel + Kernel kernel = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Display name, shown in the Jupyter kernelspec card. + string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/google/cloud/dataproc/v1/shared.proto b/google/cloud/dataproc/v1/shared.proto index e3f1091e18029..f9316dab63117 100644 --- a/google/cloud/dataproc/v1/shared.proto +++ b/google/cloud/dataproc/v1/shared.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -46,6 +46,10 @@ message RuntimeConfig { // Optional. A mapping of property names to values, which are used to // configure workload execution. map properties = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Dependency repository configuration. + RepositoryConfig repository_config = 5 + [(google.api.field_behavior) = OPTIONAL]; } // Environment configuration for a workload. @@ -78,16 +82,33 @@ message ExecutionConfig { // Optional. The Cloud KMS key to use for encryption. string kms_key = 7 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The duration after which the workload will be terminated. - // When the workload passes this ttl, it will be unconditionally killed - // without waiting for ongoing work to finish. - // Minimum value is 10 minutes; maximum value is 14 days (see JSON - // representation of + // Optional. Applies to sessions only. The duration to keep the session alive + // while it's idling. Exceeding this threshold causes the session to + // terminate. This field cannot be set on a batch workload. Minimum value is + // 10 minutes; maximum value is 14 days (see JSON representation of // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - // If both ttl and idle_ttl are specified, the conditions are treated as - // and OR: the workload will be terminated when it has been idle for idle_ttl - // or when the ttl has passed, whichever comes first. - // If ttl is not specified for a session, it defaults to 24h. + // Defaults to 1 hour if not set. + // If both `ttl` and `idle_ttl` are specified for an interactive session, + // the conditions are treated as `OR` conditions: the workload will be + // terminated when it has been idle for `idle_ttl` or when `ttl` has been + // exceeded, whichever occurs first. + google.protobuf.Duration idle_ttl = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The duration after which the workload will be terminated, + // specified as the JSON representation for + // [Duration](https://protobuf.dev/programming-guides/proto3/#json). + // When the workload exceeds this duration, it will be unconditionally + // terminated without waiting for ongoing work to finish. If `ttl` is not + // specified for a batch workload, the workload will be allowed to run until + // it exits naturally (or run forever without exiting). If `ttl` is not + // specified for an interactive session, it defaults to 24 hours. If `ttl` is + // not specified for a batch that uses 2.1+ runtime version, it defaults to 4 + // hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl` + // and `idle_ttl` are specified (for an interactive session), the conditions + // are treated as `OR` conditions: the workload will be terminated when it has + // been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs + // first. google.protobuf.Duration ttl = 9 [(google.api.field_behavior) = OPTIONAL]; // Optional. A Cloud Storage bucket used to stage workload dependencies, @@ -144,9 +165,17 @@ message RuntimeInfo { // Output only. A URI pointing to the location of the diagnostics tarball. string diagnostic_output_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. Approximate workload resource usage calculated after workload - // finishes (see [Dataproc Serverless pricing] + // Output only. Approximate workload resource usage, calculated when + // the workload completes (see [Dataproc Serverless pricing] // (https://cloud.google.com/dataproc-serverless/pricing)). + // + // **Note:** This metric calculation may change in the future, for + // example, to capture cumulative workload resource + // consumption during workload execution (see the + // [Dataproc Serverless release notes] + // (https://cloud.google.com/dataproc-serverless/docs/release-notes) + // for announcements, changes, fixes + // and other Dataproc developments). UsageMetrics approximate_usage = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -165,9 +194,17 @@ message UsageMetrics { // [Dataproc Serverless pricing] // (https://cloud.google.com/dataproc-serverless/pricing)). int64 shuffle_storage_gb_seconds = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Accelerator usage in (`milliAccelerator` x `seconds`) (see + // [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)). + int64 milli_accelerator_seconds = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Accelerator type being used, if any + string accelerator_type = 4 [(google.api.field_behavior) = OPTIONAL]; } -// The usage snaphot represents the resources consumed by a workload at a +// The usage snapshot represents the resources consumed by a workload at a // specified time. message UsageSnapshot { // Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see @@ -179,6 +216,23 @@ message UsageSnapshot { // pricing] (https://cloud.google.com/dataproc-serverless/pricing)) int64 shuffle_storage_gb = 2 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at + // premium tier (see [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)). + int64 milli_dcu_premium = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see + // [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)) + int64 shuffle_storage_gb_premium = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Milli (one-thousandth) accelerator. (see [Dataproc + // Serverless pricing] (https://cloud.google.com/dataproc-serverless/pricing)) + int64 milli_accelerator = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Accelerator type being used, if any + string accelerator_type = 7 [(google.api.field_behavior) = OPTIONAL]; + // Optional. The timestamp of the usage snapshot. google.protobuf.Timestamp snapshot_time = 3 [(google.api.field_behavior) = OPTIONAL]; @@ -410,16 +464,28 @@ message GkeNodePoolConfig { [(google.api.field_behavior) = OPTIONAL]; } +// Configuration for dependency repositories +message RepositoryConfig { + // Optional. Configuration for PyPi repository. + PyPiRepositoryConfig pypi_repository_config = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for PyPi repository +message PyPiRepositoryConfig { + // Optional. PyPi repository address + string pypi_repository = 1 [(google.api.field_behavior) = OPTIONAL]; +} + // Cluster components that can be activated. enum Component { // Unspecified component. Specifying this will cause Cluster creation to fail. COMPONENT_UNSPECIFIED = 0; // The Anaconda python distribution. The Anaconda component is not supported - // in the Dataproc - // 2.0 - // image. The 2.0 image is pre-installed with Miniconda. + // in the Dataproc [2.0 image] + // (/https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-release-2.0). + // The 2.0 image is pre-installed with Miniconda. ANACONDA = 5; // Docker