From 6cd78f914bfa99f1c95a4fcaa714997da6548faf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:27:14 -0800 Subject: [PATCH] feat: add workbench_runtime and kernel_name to NotebookExecutionJob (#7881) docs: A comment for field `encryption_spec` in message `.google.cloud.aiplatform.v1.NotebookExecutionJob` is changed PiperOrigin-RevId: 702775459 Source-Link: https://github.com/googleapis/googleapis/commit/e865ba04a87a262b936f02e10dc13b210ee480d6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6e54e782f9ceb0f2f9208e5cf00ec7cbe33fcf93 Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiNmU1NGU3ODJmOWNlYjBmMmY5MjA4ZTVjZjAwZWM3Y2JlMzNmY2Y5MyJ9 --- .../metadata/V1/NotebookExecutionJob.php | Bin 3680 -> 3840 bytes AiPlatform/src/V1/NotebookExecutionJob.php | 92 +++++++++++++++++- .../NotebookExecutionJob/WorkbenchRuntime.php | 34 +++++++ .../V1/Client/NotebookServiceClientTest.php | 4 + 4 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 AiPlatform/src/V1/NotebookExecutionJob/WorkbenchRuntime.php diff --git a/AiPlatform/metadata/V1/NotebookExecutionJob.php b/AiPlatform/metadata/V1/NotebookExecutionJob.php index 5adfabbd39814ab058bcaa1258cec6f2ac602af5..488b453e9bc592a1b2db3f5040a9b270b96eef72 100644 GIT binary patch delta 171 zcmaDL(;&COj)m#7$YuwY9!92Sfz9VwtC(csxCG1di?Wka^O7^-i%RoKGILWU#1$Ad zxQ!eqZ(uhR3Wv!CK_op`HoJ42V-ykQ;?7Pj%1h0O&r1Yq5dmu9+$_TNl2KTQO8{Nd s=0DuljB=t}!cZIHQ}fC)i}LewQ}arkt}}AUCFkb?ZIj*{$;-|N0HBgLv;Y7A delta 55 zcmV-70LcG<9^f3XJ_G{O6SF`Bi~$1U4ztb$dIGbk2+aYriVElfvxW>h0SDIs3Lax` NZIiGE8?*Th2LUS<6FUF^ diff --git a/AiPlatform/src/V1/NotebookExecutionJob.php b/AiPlatform/src/V1/NotebookExecutionJob.php index e48e07ed3b96..5782a230ef2e 100644 --- a/AiPlatform/src/V1/NotebookExecutionJob.php +++ b/AiPlatform/src/V1/NotebookExecutionJob.php @@ -82,10 +82,18 @@ class NotebookExecutionJob extends \Google\Protobuf\Internal\Message * Generated from protobuf field map labels = 19; */ private $labels; + /** + * The name of the kernel to use during notebook execution. If unset, the + * default kernel is used. + * + * Generated from protobuf field string kernel_name = 20; + */ + protected $kernel_name = ''; /** * Customer-managed encryption key spec for the notebook execution job. * This field is auto-populated if the - * [NotebookService.NotebookRuntimeTemplate][] has an encryption spec. + * [NotebookRuntimeTemplate][google.cloud.aiplatform.v1.NotebookRuntimeTemplate] + * has an encryption spec. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 22; */ @@ -94,6 +102,7 @@ class NotebookExecutionJob extends \Google\Protobuf\Internal\Message protected $environment_spec; protected $execution_sink; protected $execution_identity; + protected $runtime_environment; /** * Constructor. @@ -119,6 +128,8 @@ class NotebookExecutionJob extends \Google\Protobuf\Internal\Message * The user email to run the execution as. Only supported by Colab runtimes. * @type string $service_account * The service account to run the execution as. + * @type \Google\Cloud\AIPlatform\V1\NotebookExecutionJob\WorkbenchRuntime $workbench_runtime + * The Workbench runtime configuration to use for the notebook execution. * @type string $name * Output only. The resource name of this NotebookExecutionJob. Format: * `projects/{project_id}/locations/{location}/notebookExecutionJobs/{job_id}` @@ -150,10 +161,14 @@ class NotebookExecutionJob extends \Google\Protobuf\Internal\Message * See https://goo.gl/xmQnxf for more information and examples of labels. * System reserved label keys are prefixed with "aiplatform.googleapis.com/" * and are immutable. + * @type string $kernel_name + * The name of the kernel to use during notebook execution. If unset, the + * default kernel is used. * @type \Google\Cloud\AIPlatform\V1\EncryptionSpec $encryption_spec * Customer-managed encryption key spec for the notebook execution job. * This field is auto-populated if the - * [NotebookService.NotebookRuntimeTemplate][] has an encryption spec. + * [NotebookRuntimeTemplate][google.cloud.aiplatform.v1.NotebookRuntimeTemplate] + * has an encryption spec. * } */ public function __construct($data = NULL) { @@ -413,6 +428,37 @@ public function setServiceAccount($var) return $this; } + /** + * The Workbench runtime configuration to use for the notebook execution. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookExecutionJob.WorkbenchRuntime workbench_runtime = 23; + * @return \Google\Cloud\AIPlatform\V1\NotebookExecutionJob\WorkbenchRuntime|null + */ + public function getWorkbenchRuntime() + { + return $this->readOneof(23); + } + + public function hasWorkbenchRuntime() + { + return $this->hasOneof(23); + } + + /** + * The Workbench runtime configuration to use for the notebook execution. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookExecutionJob.WorkbenchRuntime workbench_runtime = 23; + * @param \Google\Cloud\AIPlatform\V1\NotebookExecutionJob\WorkbenchRuntime $var + * @return $this + */ + public function setWorkbenchRuntime($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\NotebookExecutionJob\WorkbenchRuntime::class); + $this->writeOneof(23, $var); + + return $this; + } + /** * Output only. The resource name of this NotebookExecutionJob. Format: * `projects/{project_id}/locations/{location}/notebookExecutionJobs/{job_id}` @@ -713,10 +759,39 @@ public function setLabels($var) return $this; } + /** + * The name of the kernel to use during notebook execution. If unset, the + * default kernel is used. + * + * Generated from protobuf field string kernel_name = 20; + * @return string + */ + public function getKernelName() + { + return $this->kernel_name; + } + + /** + * The name of the kernel to use during notebook execution. If unset, the + * default kernel is used. + * + * Generated from protobuf field string kernel_name = 20; + * @param string $var + * @return $this + */ + public function setKernelName($var) + { + GPBUtil::checkString($var, True); + $this->kernel_name = $var; + + return $this; + } + /** * Customer-managed encryption key spec for the notebook execution job. * This field is auto-populated if the - * [NotebookService.NotebookRuntimeTemplate][] has an encryption spec. + * [NotebookRuntimeTemplate][google.cloud.aiplatform.v1.NotebookRuntimeTemplate] + * has an encryption spec. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 22; * @return \Google\Cloud\AIPlatform\V1\EncryptionSpec|null @@ -739,7 +814,8 @@ public function clearEncryptionSpec() /** * Customer-managed encryption key spec for the notebook execution job. * This field is auto-populated if the - * [NotebookService.NotebookRuntimeTemplate][] has an encryption spec. + * [NotebookRuntimeTemplate][google.cloud.aiplatform.v1.NotebookRuntimeTemplate] + * has an encryption spec. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 22; * @param \Google\Cloud\AIPlatform\V1\EncryptionSpec $var @@ -785,5 +861,13 @@ public function getExecutionIdentity() return $this->whichOneof("execution_identity"); } + /** + * @return string + */ + public function getRuntimeEnvironment() + { + return $this->whichOneof("runtime_environment"); + } + } diff --git a/AiPlatform/src/V1/NotebookExecutionJob/WorkbenchRuntime.php b/AiPlatform/src/V1/NotebookExecutionJob/WorkbenchRuntime.php new file mode 100644 index 000000000000..070a71ffe09b --- /dev/null +++ b/AiPlatform/src/V1/NotebookExecutionJob/WorkbenchRuntime.php @@ -0,0 +1,34 @@ +google.cloud.aiplatform.v1.NotebookExecutionJob.WorkbenchRuntime + */ +class WorkbenchRuntime extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Aiplatform\V1\NotebookExecutionJob::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php index 9a0beb35fe74..93febc78abf7 100644 --- a/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php @@ -299,6 +299,7 @@ public function createNotebookExecutionJobTest() $name = 'name3373707'; $displayName = 'displayName1615086568'; $scheduleResourceName = 'scheduleResourceName-627484556'; + $kernelName = 'kernelName-497416883'; $expectedResponse = new NotebookExecutionJob(); $expectedResponse->setNotebookRuntimeTemplateResourceName($notebookRuntimeTemplateResourceName); $expectedResponse->setGcsOutputUri($gcsOutputUri); @@ -306,6 +307,7 @@ public function createNotebookExecutionJobTest() $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setScheduleResourceName($scheduleResourceName); + $expectedResponse->setKernelName($kernelName); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -955,6 +957,7 @@ public function getNotebookExecutionJobTest() $name2 = 'name2-1052831874'; $displayName = 'displayName1615086568'; $scheduleResourceName = 'scheduleResourceName-627484556'; + $kernelName = 'kernelName-497416883'; $expectedResponse = new NotebookExecutionJob(); $expectedResponse->setNotebookRuntimeTemplateResourceName($notebookRuntimeTemplateResourceName); $expectedResponse->setGcsOutputUri($gcsOutputUri); @@ -962,6 +965,7 @@ public function getNotebookExecutionJobTest() $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setScheduleResourceName($scheduleResourceName); + $expectedResponse->setKernelName($kernelName); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->notebookExecutionJobName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_EXECUTION_JOB]');