Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions mmv1/products/colab/NotebookExecution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,39 @@ samples:
service_account: 'SERVICE_ACCT'
ignore_read_extra:
- direct_notebook_source.0.content
- name: 'colab_notebook_execution_workbench_runtime'
primary_resource_id: 'notebook-execution'
steps:
- name: 'colab_notebook_execution_workbench_runtime'
resource_id_vars:
bucket: 'my_bucket'
test_env_vars:
project_id: 'PROJECT_NAME'
service_account: 'SERVICE_ACCT'
ignore_read_extra:
- direct_notebook_source.0.content
- name: 'colab_notebook_execution_workbench_runtime_vm'
primary_resource_id: 'notebook-execution'
steps:
- name: 'colab_notebook_execution_workbench_runtime_vm'
resource_id_vars:
bucket: 'my_bucket'
test_env_vars:
project_id: 'PROJECT_NAME'
service_account: 'SERVICE_ACCT'
ignore_read_extra:
- direct_notebook_source.0.content
- name: 'colab_notebook_execution_workbench_runtime_vm_name'
primary_resource_id: 'notebook-execution'
steps:
- name: 'colab_notebook_execution_workbench_runtime_vm_name'
resource_id_vars:
bucket: 'my_bucket'
test_env_vars:
project_id: 'PROJECT_NAME'
service_account: 'SERVICE_ACCT'
ignore_read_extra:
- direct_notebook_source.0.content
- name: 'colab_notebook_execution_full'
min_version: beta
primary_resource_id: 'notebook-execution'
Expand Down Expand Up @@ -213,6 +246,62 @@ properties:
type: String
description: 'The name of the subnetwork that this runtime is in.'
diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths'
- name: shieldedInstanceConfig
type: NestedObject
# GCP API does not return shieldedInstanceConfig in GET responses for NotebookExecutionJob.
ignore_read: true
description: 'Optional. Shielded VM configuration.'
properties:
- name: enableIntegrityMonitoring
type: Boolean
description: 'Optional. Defines whether the instance has integrity monitoring enabled. Enables monitoring and attestation of the boot integrity of the instance. The attestation is performed against the integrity policy baseline. This baseline is initially derived from the implicitly trusted boot image when the instance is created. Enabled by default.'
- name: enableSecureBoot
type: Boolean
description: 'Optional. Defines whether the instance has Secure Boot enabled. Secure Boot helps ensure that the system only runs authentic software by verifying the digital signature of all boot components, and halting the boot process if signature verification fails. Disabled by default.'
- name: enableVtpm
type: Boolean
description: 'Optional. Defines whether the instance has the vTPM enabled. Enabled by default.'
- name: workbenchRuntime
type: NestedObject
# GCP API does not return workbenchRuntime in GET responses for NotebookExecutionJob.
ignore_read: true
description: 'Configuration for a Workbench Instances-based environment.'
properties:
- name: customContainerImage
type: NestedObject
description: 'Optional. Custom container image for the Workbench instance.'
exactly_one_of:
- workbench_runtime.0.custom_container_image
- workbench_runtime.0.vm_image
properties:
- name: repository
type: String
description: 'The path to the container image repository. For example: gcr.io/{project_id}/{imageName}'
- name: tag
type: String
description: 'The tag of the container image. If not specified, this defaults to the latest tag.'
- name: vmImage
type: NestedObject
description: 'Optional. Custom Compute Engine VM image for the Workbench instance.'
exactly_one_of:
- workbench_runtime.0.custom_container_image
- workbench_runtime.0.vm_image
properties:
- name: family
type: String
exactly_one_of:
- workbench_runtime.0.vm_image.0.family
- workbench_runtime.0.vm_image.0.name
description: 'Optional. Use this VM image family to find the image; the newest image in this family will be used.'
- name: name
type: String
exactly_one_of:
- workbench_runtime.0.vm_image.0.family
- workbench_runtime.0.vm_image.0.name
description: 'Optional. Use VM image name to find the image.'
- name: project
type: String
description: 'The name of the Google Cloud project that this VM image belongs to. Format: {project_id}'
- name: 'gcsOutputUri'
required: true
type: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ resource "google_colab_notebook_execution" "{{$.PrimaryResourceId}}" {
network = google_compute_network.my_network.id
subnetwork = google_compute_subnetwork.my_subnetwork.id
}

shielded_instance_config {
enable_integrity_monitoring = true
enable_secure_boot = true
enable_vtpm = true
}
}

gcs_output_uri = "gs://${google_storage_bucket.output_bucket.name}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
resource "google_storage_bucket" "output_bucket" {
name = "{{index $.ResourceIdVars "bucket"}}"
location = "US"
force_destroy = true
uniform_bucket_level_access = true
}

resource "google_colab_notebook_execution" "{{$.PrimaryResourceId}}" {
display_name = "Notebook execution workbench runtime"
location = "us-central1"

direct_notebook_source {
content = base64encode(<<EOT
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"Hello, World!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
EOT
)
}

custom_environment_spec {
machine_spec {
machine_type = "n1-standard-2"
}

persistent_disk_spec {
disk_type = "pd-standard"
disk_size_gb = 200
}
}

workbench_runtime {
custom_container_image {
repository = "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cpu.py310"
tag = "latest"
}
}

gcs_output_uri = "gs://${google_storage_bucket.output_bucket.name}"

service_account = "{{index $.TestEnvVars "service_account"}}"

depends_on = [
google_storage_bucket.output_bucket,
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
resource "google_storage_bucket" "output_bucket" {
name = "{{index $.ResourceIdVars "bucket"}}"
location = "US"
force_destroy = true
uniform_bucket_level_access = true
}

resource "google_colab_notebook_execution" "{{$.PrimaryResourceId}}" {
display_name = "Notebook execution workbench runtime vm"
location = "us-central1"

direct_notebook_source {
content = base64encode(<<EOT
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"Hello, World!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
EOT
)
}

custom_environment_spec {
machine_spec {
machine_type = "n1-standard-2"
}

persistent_disk_spec {
disk_type = "pd-standard"
disk_size_gb = 200
}
}

workbench_runtime {
vm_image {
project = "cloud-notebooks-managed"
family = "workbench-instances"
}
}

gcs_output_uri = "gs://${google_storage_bucket.output_bucket.name}"

service_account = "{{index $.TestEnvVars "service_account"}}"

depends_on = [
google_storage_bucket.output_bucket,
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
data "google_compute_image" "my_image" {
family = "workbench-instances"
project = "cloud-notebooks-managed"
}

resource "google_storage_bucket" "output_bucket" {
name = "{{index $.ResourceIdVars "bucket"}}"
location = "US"
force_destroy = true
uniform_bucket_level_access = true
}

resource "google_colab_notebook_execution" "{{$.PrimaryResourceId}}" {
display_name = "Notebook execution workbench runtime vm name"
location = "us-central1"

direct_notebook_source {
content = base64encode(<<EOT
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"Hello, World!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
EOT
)
}

custom_environment_spec {
machine_spec {
machine_type = "n1-standard-2"
}

persistent_disk_spec {
disk_type = "pd-standard"
disk_size_gb = 200
}
}

workbench_runtime {
vm_image {
project = "cloud-notebooks-managed"
name = data.google_compute_image.my_image.name
}
}

gcs_output_uri = "gs://${google_storage_bucket.output_bucket.name}"

service_account = "{{index $.TestEnvVars "service_account"}}"

depends_on = [
google_storage_bucket.output_bucket,
]
}
Loading