Schedule a notebook run
This page shows you how to schedule a notebook run in Colab Enterprise.
Overview
You can schedule a notebook to run immediately one time, or on arecurring schedule.
When you schedule the notebook run, you select a runtime template.Colab Enterprise uses this runtime template to create the runtimethat runs your notebook.
The runtime needs specific permissions to run the notebook's code andaccess Google Cloud services and APIs.
If your runtime template configuration has end-user credentials enabled,then the runtime uses the permissions associated with youruser credentials.
If end-user credentials aren't enabled, you must specify a service accountwhen you schedule the notebook run. Colab Enterprise uses thisservice account's credentials to run your notebook.
For more information, seeRequired roles for running thenotebook.
After Colab Enterprise completes the notebook run, the results arestored in a shareable Cloud Storage bucket.
Limitations
Colab Enterprise runtimes use Compute Engine quota. See theCompute EngineAllocation quotas page.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- Create a project: To create a project, you need the Project Creator role (
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant roles.
Verify that billing is enabled for your Google Cloud project.
Enable the Vertex AI, Dataform, and Compute Engine APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission.Learn how to grant roles.In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- Create a project: To create a project, you need the Project Creator role (
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant roles.
Verify that billing is enabled for your Google Cloud project.
Enable the Vertex AI, Dataform, and Compute Engine APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission.Learn how to grant roles.
Required roles for scheduling the notebook run
To get the permissions that you need to schedule a notebook run in Colab Enterprise, ask your administrator to grant you the following IAM roles on the project:
- Colab Enterprise User (
roles/aiplatform.colabEnterpriseUser) - Storage Admin (
roles/storage.admin)
For more information about granting roles, seeManage access to projects, folders, and organizations.
You might also be able to get the required permissions throughcustom roles or otherpredefined roles.
One or more of the required roles includes thedataform.repositories.list permission. Users who are granted thedataform.repositories.list permission or theCode Creator (roles/dataform.codeCreator) role in a project can list the names of code assets in that project by using the Dataform API or the Dataform command-line interface (CLI). Non-administrators using BigQuery Studio can only see code assets that they created or that were shared with them.Required roles for running the notebook
The principal that runs the notebook needs specific permissions. Theprincipal is either your user account or a service account that you specify,as described in theoverview.
To get the permissions that you need to run a notebook in Colab Enterprise, ask your administrator to grant you the following IAM roles:
- Code Viewer (
roles/dataform.codeViewer) on the notebook - Logs Writer (
roles/logging.logWriter) on the project - Monitoring Metric Writer (
roles/monitoring.metricWriter) on the project - Storage Legacy Bucket Writer (
roles/storage.legacyBucketWriter) on the notebook - Storage Legacy Object Reader (
roles/storage.legacyObjectReader) on the output bucket
For more information about granting roles, seeManage access to projects, folders, and organizations.
These predefined roles contain the permissions required to run a notebook in Colab Enterprise. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to run a notebook in Colab Enterprise:
dataform.locations.liston the notebookdataform.repositories.computeAccessTokenStatuson the notebookdataform.repositories.fetchHistoryon the notebookdataform.repositories.fetchRemoteBrancheson the notebookdataform.repositories.geton the notebookdataform.repositories.getIamPolicyon the notebookdataform.repositories.liston the notebookdataform.repositories.queryDirectoryContentson the notebookdataform.repositories.readFileon the notebooklogging.logEntries.createon the projectlogging.logEntries.routeon the projectmonitoring.metricDescriptors.createon the projectmonitoring.metricDescriptors.geton the projectmonitoring.metricDescriptors.liston the projectmonitoring.monitoredResourceDescriptors.geton the projectmonitoring.monitoredResourceDescriptors.liston the projectmonitoring.timeSeries.createon the projectresourcemanager.projects.geton the projectresourcemanager.projects.liston the projectstorage.buckets.geton the notebookstorage.managedFolders.createon the notebookstorage.managedFolders.deleteon the notebookstorage.managedFolders.geton the notebookstorage.managedFolders.liston the notebookstorage.multipartUploads.aborton the notebookstorage.multipartUploads.createon the notebookstorage.multipartUploads.liston the notebookstorage.multipartUploads.listPartson the notebookstorage.objects.createon the notebookstorage.objects.deleteon the notebookstorage.objects.geton the notebookstorage.objects.liston the notebookstorage.objects.restoreon the notebookstorage.objects.setRetentionon the notebook
You might also be able to get these permissions withcustom roles or otherpredefined roles.
One or more of the required roles includes thedataform.repositories.list permission. Users who are granted thedataform.repositories.list permission or theCode Creator (roles/dataform.codeCreator) role in a project can list the names of code assets in that project by using the Dataform API or the Dataform command-line interface (CLI). Non-administrators using BigQuery Studio can only see code assets that they created or that were shared with them.Use scheduled notebook runs in a Shared VPC network
To use scheduled notebook runs in a Shared VPC network, you mustgrant additional permissions. SeeUse Colab Enterprise ina Shared VPC network.
Run a notebook once
To run a notebook one time, you can use the Google Cloud console,the Google Cloud CLI, the Vertex AI Python client library,or Terraform.
Console
In the Google Cloud console, go to the Colab EnterpriseMy notebooks page.
In theRegion menu, select the region that contains your notebook.
Next to a notebook, click theNotebook actions menu and selectSchedule.
In theSchedule name field, enter a name for your schedule.
Click theRuntime template list, and select a runtime template. The runtime template determines the specifications of the runtime that runs your notebook.
UnderRun schedule, selectOne-off to run your notebook as soon as you submit the notebook run.
Next to theCloud Storage output location field, clickBrowse to open theSelect folder dialog.
Select a Cloud Storage bucket. Or, to create a bucket, click Create new bucket and complete the dialog.
If you selected a runtime template without end-user credentials enabled, the dialog includes aService account field. In theService account field, enter a service account's email address.
ClickSubmit.
The notebook run starts immediately.
gcloud
Before using any of the command data below, make the following replacements:
DISPLAY_NAME: the display name for your notebook run.NOTEBOOK_RUNTIME_TEMPLATE: the notebook runtime template that specifies your runtime's compute configuration.NOTEBOOK_URI: the Cloud Storage URI of the notebook to run.OUTPUT_URI: the Cloud Storage location where you want to store results.USER_EMAIL: the user account email address that specifies the notebook run's access to Google Cloud resources.PROJECT_ID: your project ID.REGION: the region where your notebook will run.
Execute the following command:
Linux, macOS, or Cloud Shell
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionscreate--display-name="DISPLAY_NAME"\--notebook-runtime-template=NOTEBOOK_RUNTIME_TEMPLATE\--gcs-notebook-uri=NOTEBOOK_URI\--gcs-output-uri=OUTPUT_URI\--user-email=USER_EMAIL\--project=PROJECT_ID\--region=REGION
Windows (PowerShell)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionscreate--display-name="DISPLAY_NAME"`--notebook-runtime-template=NOTEBOOK_RUNTIME_TEMPLATE`--gcs-notebook-uri=NOTEBOOK_URI`--gcs-output-uri=OUTPUT_URI`--user-email=USER_EMAIL`--project=PROJECT_ID`--region=REGION
Windows (cmd.exe)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionscreate--display-name="DISPLAY_NAME"^--notebook-runtime-template=NOTEBOOK_RUNTIME_TEMPLATE^--gcs-notebook-uri=NOTEBOOK_URI^--gcs-output-uri=OUTPUT_URI^--user-email=USER_EMAIL^--project=PROJECT_ID^--region=REGION
For more information about managing Colab Enterprise notebook runsfrom the command line, see thegcloud CLI documentation.
Python
Before trying this sample,install the Vertex AI SDK for Python. The Vertex AI Python client library is installed when you install the Vertex AI SDK for Python. For more information, see theVertex AI SDK for Python API reference documentation.
To run the following code sample, you'll need the Dataform repository ID of your notebook. To get the repository ID of your notebook, you can use Dataform'slist_repositories method.
fromgoogle.cloudimportaiplatform_v1PROJECT_ID="my-project"LOCATION="us-central1"REPOSITORY_ID="b223577f-a3fb-482c-a22c-0658c6602598"TEMPLATE_ID="6524523989455339520"API_ENDPOINT=f"{LOCATION}-aiplatform.googleapis.com"PARENT=f"projects/{PROJECT_ID}/locations/{LOCATION}"notebook_service_client=aiplatform_v1.NotebookServiceClient(client_options={"api_endpoint":API_ENDPOINT,})operation=notebook_service_client.create_notebook_execution_job(parent=PARENT,notebook_execution_job={"display_name":"my-execution-job",# Specify a NotebookRuntimeTemplate to source compute configuration from"notebook_runtime_template_resource_name":f"projects/{PROJECT_ID}/locations/{LOCATION}/notebookRuntimeTemplates/{TEMPLATE_ID}",# Specify a Colab Enterprise notebook to run"dataform_repository_source":{"dataform_repository_resource_name":f"projects/{PROJECT_ID}/locations/{LOCATION}/repositories/{REPOSITORY_ID}",},# Specify a Cloud Storage bucket to store output artifacts"gcs_output_uri":"gs://my-bucket/",# Specify the identity that runs the notebook"execution_user":"{EMAIL}",# Run as the service account instead# "service_account": "my-service-account",})print("Waiting for operation to complete...")result=operation.result()
Terraform
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands. For more information, see theTerraform provider reference documentation.
The following sample uses thegoogle_colab_notebook_execution Terraform resource to run a Colab Enterprise notebook.
resource"google_colab_runtime_template""my_runtime_template"{provider=google-betaname="{{index $.Vars "runtime_template_name"}}"display_name="Runtime template"location="us-central1"machine_spec{machine_type="e2-standard-4"}network_spec{enable_internet_access=true}}resource"google_storage_bucket""output_bucket"{provider=google-betaname="{{index $.Vars "bucket"}}"location="US"force_destroy=trueuniform_bucket_level_access=true}resource"google_storage_bucket_object""notebook"{provider=google-betaname="hello_world.ipynb"bucket=google_storage_bucket.output_bucket.namecontent=<<EOF{"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}EOF}resource"google_colab_notebook_execution" "{{$.PrimaryResourceId}}"{provider=google-betanotebook_execution_job_id="{{index $.Vars "notebook_execution_job_id"}}"display_name="Notebook execution full"location="us-central1"execution_timeout="86400s"gcs_notebook_source{uri="gs://${google_storage_bucket_object.notebook.bucket}/${google_storage_bucket_object.notebook.name}"generation=google_storage_bucket_object.notebook.generation}service_account="{{index $.TestEnvVars "service_account"}}"gcs_output_uri="gs://${google_storage_bucket.output_bucket.name}"notebook_runtime_template_resource_name="projects/${google_colab_runtime_template.my_runtime_template.project}/locations/${google_colab_runtime_template.my_runtime_template.location}/notebookRuntimeTemplates/${google_colab_runtime_template.my_runtime_template.name}"depends_on=[google_storage_bucket_object.notebook,google_storage_bucket.output_bucket,google_colab_runtime_template.my_runtime_template,]}You can view results from completed notebook runs on theExecutions page.
Schedule a notebook run
To schedule a notebook run, you can use the Google Cloud console,the gcloud CLI, the Vertex AI Python client library,or Terraform.
Console
In the Google Cloud console, go to the Colab EnterpriseMy notebooks page.
In theRegion menu, select the region that contains your notebook.
Next to a notebook, click theNotebook actions menu and selectSchedule.
In theSchedule name field, enter a name for your schedule.
Click theRuntime template list, and select a runtime template. The runtime template determines the specifications of the runtime that runs your notebook.
UnderRun schedule, selectRecurring to schedule the notebook run for a specific interval of time.
Complete the scheduling dialog.
Next to theCloud Storage output location field, clickBrowse to open theSelect folder dialog.
Select a Cloud Storage bucket. Or, to create a bucket, click Create new bucket and complete the dialog.
If you selected a runtime template without end-user credentials enabled, the dialog includes aService account field. In theService account field, enter a service account's email address.
ClickSubmit.
Scheduled notebook runs start automatically on the schedule that you set.
gcloud
Before using any of the command data below, make the following replacements:
DISPLAY_NAME: the display name of your schedule.CRON_SCHEDULE: the schedule that you set, inunix-cron format. For example,00 19 * * MONmeans weekly on Monday, at 1900 hours Greenwich Mean Time (GMT).NOTEBOOK_RUN_NAME: the display name for notebook runs generated by this schedule.NOTEBOOK_RUNTIME_TEMPLATE: the notebook runtime template that specifies your runtime's compute configuration.NOTEBOOK_URI: the Cloud Storage URI of the notebook to run.OUTPUT_URI: the Cloud Storage location where you want to store results.USER_EMAIL: the user account email address that specifies the notebook run's access to Google Cloud resources.PROJECT_ID: your project ID.REGION: the region where your schedule will run.
Execute the following command:
Linux, macOS, or Cloud Shell
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulescreate--display-name="DISPLAY_NAME"\--cron-schedule=CRON_SCHEDULE\--execution-display-name=NOTEBOOK_RUN_NAME\--notebook-runtime-template=NOTEBOOK_RUNTIME_TEMPLATE\--gcs-notebook-uri=NOTEBOOK_URI\--gcs-output-uri=OUTPUT_URI\--user-email=USER_EMAIL\--project=PROJECT_ID\--region=REGION
Windows (PowerShell)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulescreate--display-name="DISPLAY_NAME"`--cron-schedule=CRON_SCHEDULE`--execution-display-name=NOTEBOOK_RUN_NAME`--notebook-runtime-template=NOTEBOOK_RUNTIME_TEMPLATE`--gcs-notebook-uri=NOTEBOOK_URI`--gcs-output-uri=OUTPUT_URI`--user-email=USER_EMAIL`--project=PROJECT_ID`--region=REGION
Windows (cmd.exe)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulescreate--display-name="DISPLAY_NAME"^--cron-schedule=CRON_SCHEDULE^--execution-display-name=NOTEBOOK_RUN_NAME^--notebook-runtime-template=NOTEBOOK_RUNTIME_TEMPLATE^--gcs-notebook-uri=NOTEBOOK_URI^--gcs-output-uri=OUTPUT_URI^--user-email=USER_EMAIL^--project=PROJECT_ID^--region=REGION
For more information about creating Colab Enterprise notebook schedulesfrom the command line, see thegcloud CLIdocumentation.
Python
Before trying this sample,install the Vertex AI SDK for Python. The Vertex AI Python client library is installed when you install the Vertex AI SDK for Python. For more information, see theVertex AI SDK for Python API reference documentation.
To run the following code sample, you'll need the Dataform repository ID of your notebook. To get the repository ID of your notebook, you can use Dataform'slist_repositories method.
fromgoogle.cloudimportaiplatform_v1PROJECT_ID="my-project"LOCATION="us-central1"REPOSITORY_ID="b223577f-a3fb-482c-a22c-0658c6602598"TEMPLATE_ID="6524523989455339520"API_ENDPOINT=f"{LOCATION}-aiplatform.googleapis.com"PARENT=f"projects/{PROJECT_ID}/locations/{LOCATION}"schedules_service_client=aiplatform_v1.ScheduleServiceClient(client_options={"api_endpoint":API_ENDPOINT,})schedule=schedules_service_client.create_schedule(parent=PARENT,schedule={"display_name":"my-notebook-schedule",# Time specification. TZ is optional.# cron = "* * * * *" to run it in the next minute."cron":"TZ=America/Los_Angeles * * * * *",# How many runs the schedule will trigger before it becomes COMPLETED.# A Schedule in COMPLETED state will not trigger any more runs."max_run_count":1,"max_concurrent_run_count":1,"create_notebook_execution_job_request":{"parent":PARENT,"notebook_execution_job":{"display_name":"my-execution-job",# Specify a NotebookRuntimeTemplate to source compute configuration from"notebook_runtime_template_resource_name":f"projects/{PROJECT_ID}/locations/{LOCATION}/notebookRuntimeTemplates/{TEMPLATE_ID}",# Specify a Colab Enterprise notebook to run"dataform_repository_source":{"dataform_repository_resource_name":f"projects/{PROJECT_ID}/locations/{LOCATION}/repositories/{REPOSITORY_ID}",},# Specify a Cloud Storage bucket to store output artifacts"gcs_output_uri":"gs://my-bucket/",# Specify the identity that runs the notebook"execution_user":"{EMAIL}",# Run as the service account instead# "service_account": "my-service-account",}}})
Terraform
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands. For more information, see theTerraform provider reference documentation.
The following sample uses thegoogle_colab_schedule Terraform resource to schedule a Colab Enterprise notebook run.
resource"google_colab_runtime_template""my_runtime_template"{provider=google-betaname="{{index $.Vars "runtime_template_name"}}"display_name="Runtime template"location="us-central1"machine_spec{machine_type="e2-standard-4"}network_spec{enable_internet_access=true}}resource"google_storage_bucket""output_bucket"{provider=google-betaname="{{index $.Vars "bucket"}}"location="US"force_destroy=trueuniform_bucket_level_access=true}resource"google_secret_manager_secret""secret"{provider=google-betasecret_id="{{index $.Vars "secret"}}"replication{auto{}}}resource"google_secret_manager_secret_version""secret_version"{provider=google-betasecret=google_secret_manager_secret.secret.idsecret_data="secret-data"}resource"google_dataform_repository""dataform_repository"{provider=google-betaname="{{index $.Vars "dataform_repository"}}"display_name="dataform_repository"npmrc_environment_variables_secret_version=google_secret_manager_secret_version.secret_version.idkms_key_name="{{index $.Vars "key_name"}}"labels={label_foo1="label-bar1"}git_remote_settings{url="https://github.com/OWNER/REPOSITORY.git"default_branch="main"authentication_token_secret_version=google_secret_manager_secret_version.secret_version.id}workspace_compilation_overrides{default_database="database"schema_suffix="_suffix"table_prefix="prefix_"}}resource"google_colab_schedule" "{{$.PrimaryResourceId}}"{provider=google-betadisplay_name="{{index $.Vars "display_name"}}"location="{{index $.TestEnvVars "location"}}"allow_queueing=truemax_concurrent_run_count=2cron="TZ=America/Los_Angeles * * * * *"max_run_count=5start_time="{{index $.Vars "start_time"}}"end_time="{{index $.Vars "end_time"}}"desired_state="ACTIVE"create_notebook_execution_job_request{notebook_execution_job{display_name="Notebook execution"execution_timeout="86400s"dataform_repository_source{commit_sha="randomsha123"dataform_repository_resource_name="projects/{{index $.TestEnvVars "project_id"}}/locations/{{index $.TestEnvVars "location"}}/repositories/${google_dataform_repository.dataform_repository.name}"}notebook_runtime_template_resource_name="projects/${google_colab_runtime_template.my_runtime_template.project}/locations/${google_colab_runtime_template.my_runtime_template.location}/notebookRuntimeTemplates/${google_colab_runtime_template.my_runtime_template.name}"gcs_output_uri="gs://${google_storage_bucket.output_bucket.name}"service_account="{{index $.TestEnvVars "service_account"}}"}}depends_on=[google_colab_runtime_template.my_runtime_template,google_storage_bucket.output_bucket,google_secret_manager_secret_version.secret_version,google_dataform_repository.dataform_repository,]}In the Google Cloud console, you can view your schedules on theSchedules page. You can view results from thecompleted notebook runs on theExecutions page.
View results
To view notebook run results, you can use the Google Cloud console,the gcloud CLI, or the Vertex AI Pythonclient library.
Console
In the Google Cloud console, go to the Colab EnterpriseExecutions page.
Next to the notebook run that you want to view results for, clickView result.
Colab Enterprise opens the result of the notebook run in a new tab.
To view the result, click the tab.
gcloud
Before using any of the command data below, make the following replacements:
PROJECT_ID: your project ID.REGION: the region where your notebook run results are located.SCHEDULE_NAME: the name of the schedule to view results for. To see results from all schedules, omit the--filterflag.
Execute the following command:
Linux, macOS, or Cloud Shell
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionslist--project=PROJECT_ID\--region=REGION\--filter="scheduleResourceName:SCHEDULE_NAME"
Windows (PowerShell)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionslist--project=PROJECT_ID`--region=REGION`--filter="scheduleResourceName:SCHEDULE_NAME"
Windows (cmd.exe)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionslist--project=PROJECT_ID^--region=REGION^--filter="scheduleResourceName:SCHEDULE_NAME"
For more information about listing Colab Enterprise notebook runsfrom the command line, see thegcloud CLIdocumentation.
Python
Before trying this sample,install the Vertex AI SDK for Python. The Vertex AI Python client library is installed when you install the Vertex AI SDK for Python. For more information, see theVertex AI SDK for Python API reference documentation.
To run the following code sample, you'll need the Dataform repository ID of your notebook. To get the repository ID of your notebook, you can use Dataform'slist_repositories method.
fromgoogle.cloudimportaiplatform_v1PROJECT_ID="my-project"LOCATION="us-central1"API_ENDPOINT=f"{LOCATION}-aiplatform.googleapis.com"PARENT=f"projects/{PROJECT_ID}/locations/{LOCATION}"notebook_service_client=aiplatform_v1.NotebookServiceClient(client_options={"api_endpoint":API_ENDPOINT,})notebook_execution_jobs=notebook_service_client.list_notebook_execution_jobs(parent=PARENT)notebook_execution_jobs
Delete results
To delete a result from one of your notebook runs, you can usethe Google Cloud console or the gcloud CLI.
Console
In the Google Cloud console, go to the Colab EnterpriseExecutions page.
Select the notebook run that you want to delete the result for.
Click Delete.
To confirm the deletion, clickConfirm.
gcloud
Before using any of the command data below, make the following replacements:
NOTEBOOK_RUN_ID: the ID of the notebook run that you want to delete.PROJECT_ID: your project ID.REGION: the region where your notebook run is located.
Execute the following command:
Linux, macOS, or Cloud Shell
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionsdeleteNOTEBOOK_RUN_ID\--project=PROJECT_ID\--region=REGION
Windows (PowerShell)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionsdeleteNOTEBOOK_RUN_ID`--project=PROJECT_ID`--region=REGION
Windows (cmd.exe)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabexecutionsdeleteNOTEBOOK_RUN_ID^--project=PROJECT_ID^--region=REGION
For more information about deleting Colab Enterprise notebook runsfrom the command line, see thegcloud CLIdocumentation.
Share a notebook run's results
You can share notebook run results by providing access to theCloud Storage bucket that contains your notebook run.Providing this access also grants users access to any other resourcesin the same Cloud Storage bucket (seeSecurity considerations).
For more information, see the Cloud StorageSharing and collaboration page.
Security considerations
Your notebook run results are stored as notebook (IPYNB) files ina Cloud Storage bucket. Consider the following when you grant accessto this bucket:
Anyone with access to the bucket can see the notebook file's code andthe results of the notebook run.
Anyone with the ability to change the contents of the bucket can changethe contents of the notebook file.
When your schedule is configured to use personal credentials,only the specified user is able to modify the schedule or trigger the schedule.
When your schedule is configured to use a service account, only users with theiam.serviceAccounts.actAs permission on the service account is able to modifythe schedule or trigger the schedule.
View schedule details
You can view information about a schedule, including:
- The Cloud Storage bucket that the schedule stores results in.
- The start and end time.
- The frequency.
To view schedule details, you can use the Google Cloud console orthe gcloud CLI.
Console
In the Google Cloud console, go to the Colab EnterpriseSchedules page.
Click the name of a schedule.
TheSchedule details page opens.
To go back to theSchedules page, click Back to previous page.
gcloud
Before using any of the command data below, make the following replacements:
SCHEDULE: your schedule ID.PROJECT_ID: your project ID.REGION: the region where your schedule is located.
Execute the following command:
Linux, macOS, or Cloud Shell
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulesdescribeSCHEDULE\--project=PROJECT_ID\--region=REGION
Windows (PowerShell)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulesdescribeSCHEDULE`--project=PROJECT_ID`--region=REGION
Windows (cmd.exe)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulesdescribeSCHEDULE^--project=PROJECT_ID^--region=REGION
For more information about viewing Colab Enterprise schedulesfrom the command line, see thegcloud CLIdocumentation.
Pause, resume, or delete a schedule
To pause, resume, or delete a schedule, you can use the Google Cloud console,the gcloud CLI, or Terraform.
Console
In the Google Cloud console, go to the Colab EnterpriseSchedules page.
Select a schedule.
Click Pause, Resume, or Delete.
gcloud
Before using any of the command data below, make the following replacements:
ACTION: one ofpause,resume, ordelete.SCHEDULE_ID: your schedule ID.PROJECT_ID: your project ID.REGION: the region where your schedule is located.
Execute the following command:
Linux, macOS, or Cloud Shell
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulesACTIONSCHEDULE_ID\--project=PROJECT_ID\--region=REGION
Windows (PowerShell)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulesACTIONSCHEDULE_ID`--project=PROJECT_ID`--region=REGION
Windows (cmd.exe)
Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.gcloudcolabschedulesACTIONSCHEDULE_ID^--project=PROJECT_ID^--region=REGION
For more information about managing Colab Enterprise schedulesfrom the command line, see thegcloud CLIdocumentation.
Terraform
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands. For more information, see theTerraform provider reference documentation.
The following sample uses thegoogle_colab_schedule Terraform resource to pause or resume a schedule.
To use this sample, change the value ofdesired_state according to the following:
PAUSEDto pause the scheduleACTIVEto resume the schedule
resource"google_colab_runtime_template""my_runtime_template"{name="{{index $.Vars "runtime_template_name"}}"display_name="Runtime template"location="us-central1"machine_spec{machine_type="e2-standard-4"}network_spec{enable_internet_access=true}}resource"google_storage_bucket""output_bucket"{name="{{index $.Vars "bucket"}}"location="US"force_destroy=trueuniform_bucket_level_access=true}resource"google_storage_bucket_object""notebook"{name="hello_world.ipynb"bucket=google_storage_bucket.output_bucket.namecontent=<<EOF{"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}EOF}resource"google_colab_schedule" "{{$.PrimaryResourceId}}"{display_name="{{index $.Vars "display_name"}}"location="{{index $.TestEnvVars "location"}}"max_concurrent_run_count=2cron="TZ=America/Los_Angeles * * * * *"desired_state="PAUSED"create_notebook_execution_job_request{notebook_execution_job{display_name="Notebook execution"gcs_notebook_source{uri="gs://${google_storage_bucket_object.notebook.bucket}/${google_storage_bucket_object.notebook.name}"generation=google_storage_bucket_object.notebook.generation}notebook_runtime_template_resource_name="projects/${google_colab_runtime_template.my_runtime_template.project}/locations/${google_colab_runtime_template.my_runtime_template.location}/notebookRuntimeTemplates/${google_colab_runtime_template.my_runtime_template.name}"gcs_output_uri="gs://${google_storage_bucket.output_bucket.name}"service_account="{{index $.TestEnvVars "service_account"}}"}}depends_on=[google_colab_runtime_template.my_runtime_template,google_storage_bucket.output_bucket,]}What's next
To find a notebook that can help you get your project started quickly,see thenotebook gallery.
Learn more aboutruntimes and runtime templates.
Learn how tocreate a runtime template.
Learn more aboutaccessing Google Cloud services andAPIs in your notebook.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.