Mengelola template runtime

Halaman ini menjelaskan cara mengelola template runtime Colab Enterprise, termasuk tugas berikut:

  • Mengedit template runtime.
  • Menghapus template runtime.

Peran yang diperlukan

Untuk mendapatkan izin yang diperlukan untuk mengelola template runtime Colab Enterprise, minta administrator untuk memberi Anda peran IAM Colab Enterprise Admin (roles/aiplatform.colabEnterpriseAdmin) di project tersebut. Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.

Anda mungkin juga bisa mendapatkan izin yang diperlukan melalui peran khusus atau peran bawaan lainnya.

Mengedit template runtime

Anda dapat membuat perubahan pada beberapa spesifikasi template runtime, termasuk versi Python dan konfigurasi kunci enkripsi. Perubahan apa pun yang dibuat pada template runtime hanya berlaku untuk runtime yang baru dibuat dari template ini.

Untuk mengedit template runtime, Anda dapat menggunakan Google Cloud konsol atau REST API.

Konsol

Untuk mengedit template runtime, lakukan tindakan berikut:

  1. Di Google Cloud konsol, buka halaman Colab Enterprise Runtime templates.

    Buka Template Runtime

  2. Di menu Region, pilih region yang berisi template runtime Anda.

  3. Di kolom ID, klik nomor ID template runtime yang ingin Anda edit.

  4. Klik  Edit.

  5. Di panel Edit runtime template, buat perubahan pada template runtime.

  6. Klik Update.

REST

Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:

  • REGION: region tempat template runtime Anda berada.
  • PROJECT_ID: project ID Anda.
  • NOTEBOOK_RUNTIME_TEMPLATE_ID: ID template runtime Anda.
  • RELEASE_NAME: nama rilis image yang ingin Anda gunakan. Misalnya, py311 adalah nama rilis untuk image Python 3.11. Untuk menetapkan image ke Latest, biarkan RELEASE_NAME kosong.

Metode HTTP dan URL:

PATCH https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/notebookRuntimeTemplates/NOTEBOOK_RUNTIME_TEMPLATE_ID?updateMask=software_config.colab_image.release_name

Meminta isi JSON:

{
  softwareConfig: {
    colabImage: {
      releaseName: "RELEASE_NAME"
    }
  }
}

Untuk mengirim permintaan Anda, pilih salah satu opsi berikut:

curl

Simpan isi permintaan dalam file bernama request.json, dan jalankan perintah berikut:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/notebookRuntimeTemplates/NOTEBOOK_RUNTIME_TEMPLATE_ID?updateMask=software_config.colab_image.release_name"

PowerShell

Simpan isi permintaan dalam file bernama request.json, dan jalankan perintah berikut:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/notebookRuntimeTemplates/NOTEBOOK_RUNTIME_TEMPLATE_ID?updateMask=software_config.colab_image.release_name" | Select-Object -Expand Content
Jika berhasil, isi respons memuat instance Operation.

Untuk mengetahui informasi tentang parameter kueri yang tersedia, lihat notebookRuntimeTemplates.patch REST API dokumentasi.

Menghapus template runtime

Untuk menghapus template runtime, Anda dapat menggunakan Google Cloud konsol, gcloud CLI, atau REST API.

Konsol

Untuk menghapus template runtime, lakukan tindakan berikut:

  1. Di Google Cloud konsol, buka halaman Colab Enterprise Runtime templates.

    Buka Template Runtime

  2. Di menu Region, pilih region yang berisi template runtime Anda.

  3. Pilih template runtime yang ingin Anda hapus.

  4. Klik  Hapus.

  5. Klik Confirm.

gcloud

Sebelum menggunakan salah satu data perintah di bawah, lakukan penggantian berikut:

  • RUNTIME_ID: ID runtime Anda.
  • PROJECT_ID: project ID Anda.
  • REGION: region tempat runtime Anda berada.

Jalankan perintah berikut:

Linux, macOS, atau Cloud Shell

gcloud colab runtimes delete RUNTIME_ID \
    --project=PROJECT_ID \
    --region=REGION

Windows (PowerShell)

gcloud colab runtimes delete RUNTIME_ID `
    --project=PROJECT_ID `
    --region=REGION

Windows (cmd.exe)

gcloud colab runtimes delete RUNTIME_ID ^
    --project=PROJECT_ID ^
    --region=REGION

Untuk mengetahui informasi lebih lanjut tentang perintah untuk menghapus template runtime dari command line, lihat dokumentasi gcloud CLI.

REST

Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:

  • REGION: region tempat runtime Anda berada.
  • PROJECT_ID: project ID Anda.
  • RUNTIME_ID: ID runtime Anda.

Metode HTTP dan URL:

DELETE https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/notebookRuntimes/RUNTIME_ID

Untuk mengirim permintaan Anda, pilih salah satu opsi berikut:

curl

Jalankan perintah berikut:

curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/notebookRuntimes/RUNTIME_ID"

PowerShell

Jalankan perintah berikut:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/notebookRuntimes/RUNTIME_ID" | Select-Object -Expand Content
Jika berhasil, isi respons memuat instance Operation.

Untuk mengetahui informasi selengkapnya, lihat dokumentasi REST API notebookRuntimeTemplates.delete.

Langkah berikutnya