Skip to content

Commit

Permalink
feat: add NotebookExecutionJob resource and APIs to public v1beta1 cl…
Browse files Browse the repository at this point in the history
…ient library

PiperOrigin-RevId: 628125855
  • Loading branch information
Google APIs authored and Copybara-Service committed Apr 25, 2024
1 parent eb1a043 commit f41b4bc
Show file tree
Hide file tree
Showing 3 changed files with 269 additions and 0 deletions.
1 change: 1 addition & 0 deletions google/cloud/aiplatform/v1beta1/BUILD.bazel
Expand Up @@ -101,6 +101,7 @@ proto_library(
"nas_job.proto",
"network_spec.proto",
"notebook_euc_config.proto",
"notebook_execution_job.proto",
"notebook_idle_shutdown_config.proto",
"notebook_runtime.proto",
"notebook_runtime_template_ref.proto",
Expand Down
138 changes: 138 additions & 0 deletions google/cloud/aiplatform/v1beta1/notebook_execution_job.proto
@@ -0,0 +1,138 @@
// 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.aiplatform.v1beta1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/aiplatform/v1beta1/job_state.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";

option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
option java_multiple_files = true;
option java_outer_classname = "NotebookExecutionJobProto";
option java_package = "com.google.cloud.aiplatform.v1beta1";
option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
option ruby_package = "Google::Cloud::AIPlatform::V1beta1";

// NotebookExecutionJob represents an instance of a notebook execution.
message NotebookExecutionJob {
option (google.api.resource) = {
type: "aiplatform.googleapis.com/NotebookExecutionJob"
pattern: "projects/{project}/locations/{location}/notebookExecutionJobs/{notebook_execution_job}"
plural: "notebookExecutionJobs"
singular: "notebookExecutionJob"
};

// The Dataform Repository containing the input notebook.
message DataformRepositorySource {
// The resource name of the Dataform Repository. Format:
// `projects/{project_id}/locations/{location}/repositories/{repository_id}`
string dataform_repository_resource_name = 1;

// The commit SHA to read repository with. If unset, the file will be read
// at HEAD.
string commit_sha = 2;
}

// The Cloud Storage uri for the input notebook.
message GcsNotebookSource {
// The Cloud Storage uri pointing to the ipynb file. Format:
// `gs://bucket/notebook_file.ipynb`
string uri = 1;

// The version of the Cloud Storage object to read. If unset, the current
// version of the object is read. See
// https://cloud.google.com/storage/docs/metadata#generation-number.
string generation = 2;
}

// The input notebook.
oneof notebook_source {
// The Dataform Repository pointing to a single file notebook repository.
DataformRepositorySource dataform_repository_source = 3;

// The GCS url pointing to the ipynb file. Format:
// `gs://bucket/notebook_file.ipynb`
GcsNotebookSource gcs_notebook_source = 4;
}

// The compute config to use for an execution job.
oneof environment_spec {
// The NotebookRuntimeTemplate to source compute configuration from.
string notebook_runtime_template_resource_name = 14
[(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/NotebookRuntimeTemplate"
}];
}

// The location to store the notebook execution result.
oneof execution_sink {
// The GCS location to upload the result to. Format:
// `gs://bucket-name`
string gcs_output_uri = 8;
}

// The identity to run the execution as.
oneof execution_identity {
// The user email to run the execution as. Only supported by Colab runtimes.
string execution_user = 9;

// The service account to run the execution as.
string service_account = 18;
}

// Output only. The resource name of this NotebookExecutionJob. Format:
// `projects/{project_id}/locations/{location}/notebookExecutionJobs/{job_id}`
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// The display name of the NotebookExecutionJob. The name can be up to 128
// characters long and can consist of any UTF-8 characters.
string display_name = 2;

// Max running time of the execution job in seconds (default 86400s / 24 hrs).
google.protobuf.Duration execution_timeout = 5;

// Output only. The Schedule resource name if this job is triggered by one.
// Format:
// `projects/{project_id}/locations/{location}/schedules/{schedule_id}`
string schedule_resource_name = 6 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/Schedule"
}
];

// Output only. The state of the NotebookExecutionJob.
JobState job_state = 10 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Populated when the NotebookExecutionJob is completed. When
// there is an error during notebook execution, the error details are
// populated.
google.rpc.Status status = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Timestamp when this NotebookExecutionJob was created.
google.protobuf.Timestamp create_time = 12
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Timestamp when this NotebookExecutionJob was most recently
// updated.
google.protobuf.Timestamp update_time = 13
[(google.api.field_behavior) = OUTPUT_ONLY];
}
130 changes: 130 additions & 0 deletions google/cloud/aiplatform/v1beta1/notebook_service.proto
Expand Up @@ -20,6 +20,7 @@ import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/aiplatform/v1beta1/notebook_execution_job.proto";
import "google/cloud/aiplatform/v1beta1/notebook_runtime.proto";
import "google/cloud/aiplatform/v1beta1/operation.proto";
import "google/longrunning/operations.proto";
Expand Down Expand Up @@ -159,6 +160,49 @@ service NotebookService {
metadata_type: "StartNotebookRuntimeOperationMetadata"
};
}

// Gets a NotebookExecutionJob.
rpc GetNotebookExecutionJob(GetNotebookExecutionJobRequest)
returns (NotebookExecutionJob) {
option (google.api.http) = {
get: "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*}"
};
option (google.api.method_signature) = "name";
}

// Lists NotebookExecutionJobs in a Location.
rpc ListNotebookExecutionJobs(ListNotebookExecutionJobsRequest)
returns (ListNotebookExecutionJobsResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=projects/*/locations/*}/notebookExecutionJobs"
};
option (google.api.method_signature) = "parent";
}

// Deletes a NotebookExecutionJob.
rpc DeleteNotebookExecutionJob(DeleteNotebookExecutionJobRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/locations/*/notebookExecutionJobs/*}"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "DeleteOperationMetadata"
};
}
}

// Views for Get/List NotebookExecutionJob
enum NotebookExecutionJobView {
// When unspecified, the API defaults to the BASIC view.
NOTEBOOK_EXECUTION_JOB_VIEW_UNSPECIFIED = 0;

// Includes all fields except for direct notebook inputs.
NOTEBOOK_EXECUTION_JOB_VIEW_BASIC = 1;

// Includes all fields.
NOTEBOOK_EXECUTION_JOB_VIEW_FULL = 2;
}

// Request message for
Expand Down Expand Up @@ -510,3 +554,89 @@ message StartNotebookRuntimeOperationMetadata {
// Response message for
// [NotebookService.StartNotebookRuntime][google.cloud.aiplatform.v1beta1.NotebookService.StartNotebookRuntime].
message StartNotebookRuntimeResponse {}

// Request message for [NotebookService.GetNotebookExecutionJob]
message GetNotebookExecutionJobRequest {
// Required. The name of the NotebookExecutionJob resource.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/NotebookExecutionJob"
}
];

// Optional. The NotebookExecutionJob view. Defaults to BASIC.
NotebookExecutionJobView view = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for [NotebookService.ListNotebookExecutionJobs]
message ListNotebookExecutionJobsRequest {
// Required. The resource name of the Location from which to list the
// NotebookExecutionJobs.
// Format: `projects/{project}/locations/{location}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];

// Optional. An expression for filtering the results of the request. For field
// names both snake_case and camelCase are supported.
//
// * `notebookExecutionJob` supports = and !=. `notebookExecutionJob`
// represents the NotebookExecutionJob ID.
// * `displayName` supports = and != and regex.
// * `schedule` supports = and != and regex.
//
// Some examples:
// * `notebookExecutionJob="123"`
// * `notebookExecutionJob="my-execution-job"`
// * `displayName="myDisplayName"` and `displayName=~"myDisplayNameRegex"`
string filter = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. The standard list page size.
int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. The standard list page token.
// Typically obtained via
// [ListNotebookExecutionJobs.next_page_token][] of the previous
// [NotebookService.ListNotebookExecutionJobs][google.cloud.aiplatform.v1beta1.NotebookService.ListNotebookExecutionJobs]
// call.
string page_token = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. A comma-separated list of fields to order by, sorted in ascending
// order. Use "desc" after a field name for descending. Supported fields:
//
// * `display_name`
// * `create_time`
// * `update_time`
//
// Example: `display_name, create_time desc`.
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];

// Optional. The NotebookExecutionJob view. Defaults to BASIC.
NotebookExecutionJobView view = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for [NotebookService.CreateNotebookExecutionJob]
message ListNotebookExecutionJobsResponse {
// List of NotebookExecutionJobs in the requested page.
repeated NotebookExecutionJob notebook_execution_jobs = 1;

// A token to retrieve next page of results.
// Pass to [ListNotebookExecutionJobs.page_token][] to obtain that
// page.
string next_page_token = 2;
}

// Request message for [NotebookService.DeleteNotebookExecutionJob]
message DeleteNotebookExecutionJobRequest {
// Required. The name of the NotebookExecutionJob resource to be deleted.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/NotebookExecutionJob"
}
];
}

0 comments on commit f41b4bc

Please sign in to comment.