Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk beberapa panggilan API, Vertex AI akan menampilkan nama operasi. Panggilan API ini
memulai operasi yang memerlukan waktu untuk diselesaikan dan dikenal sebagai operasi yang
berjalan lama. Misalnya, membuat set data, menghapus endpoint, atau mengekspor
model merupakan operasi yang berjalan lama. Anda dapat menggunakan metode helper bersama dengan
nama operasi untuk mendapatkan status atau membatalkan operasi yang berjalan lama, seperti
yang dijelaskan di bagian berikut ini.
Mendapatkan status operasi
Untuk mendapatkan status operasi, gunakan nama operasi yang ada dalam respons
saat Anda meminta operasi yang berjalan lama. Misalnya, saat Anda membuat
set data, Vertex AI akan menampilkan nama operasi seperti: projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Anda dapat memeriksa operasi secara berkala agar mengetahui kapan operasi
tersebut selesai.
REST
Sebelum menggunakan salah satu data permintaan,
buat pengganti berikut ini:
OPERATION_NAME: Nama operasi yang ditampilkan saat Anda
memulai operasi yang berjalan lama, seperti
projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Metode HTTP dan URL:
GET https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME
Untuk mengirim permintaan Anda, pilih salah satu opsi berikut:
Dalam output, objek metadata berisi informasi yang
khusus untuk jenis permintaan tersebut. Kolom done menunjukkan apakah
operasi tersebut telah selesai. Jika operasi selesai, objek response
akan berisi hasil dari operasi tersebut.
Anda dapat membatalkan operasi yang berjalan lama agar dapat menghentikannya sebelum
operasi tersebut selesai. Jika Anda berhasil membatalkan operasi, operasi tersebut
tidak akan dihapus; sebagai gantinya, operasi akan berhenti dengan kode error 1, dan
dengan pesan CANCELLED. Perlu diketahui bahwa pembatalan tidak dijamin akan
berhasil.
REST
Sebelum menggunakan salah satu data permintaan,
buat pengganti berikut ini:
OPERATION_NAME: Nama operasi yang ditampilkan saat Anda
memulai operasi yang berjalan lama, seperti
projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Metode HTTP dan URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME:cancel
Untuk mengirim permintaan Anda, pilih salah satu opsi berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[],[],null,["# Long-running operations\n\nFor some API calls, Vertex AI returns operation names. These API calls\nstart operations that require time to complete and are known as *long-running\noperations*. For example, creating a dataset, deleting an endpoint, or exporting\na model are all long-running operations. You can use helper methods along with\noperation names to get the status of or cancel a long-running operation, as\ndescribed in the following sections.\n| **Note:** If you are using the Google Cloud console, the console shows the status of the operation and automatically updates the status when an operation is complete.\n\nGetting the status of an operation\n----------------------------------\n\nTo get the operation status, use the operation name that was in the response\nwhen you requested a long-running operation. For example, when you create a\ndataset, Vertex AI returns an operation name such as: \n\n`projects/`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/datasets/`\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e`/operations/`\u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e\n\nYou can poll the operation at regular intervals so that you know when an\noperation completes. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eOPERATION_NAME\u003c/var\u003e: The operation name that is returned when you start a long-running operation, such as `projects/`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/datasets/`\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e`/operations/`\u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e\n\n\nHTTP method and URL:\n\n```\nGET https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n \"https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -Uri \"https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME\" | Select-Object -Expand Content\n```\n\nIn the output, the `metadata` object contains information that is\nspecific to the request type. The `done` field indicates whether the\noperation is complete. If the operation is complete, the `response`\nobject contains results from the operation.\n\n```\n{\n \"name\": \"projects/123456789012/locations/us-central1/datasets/1234567890123456789/operations/1223344556677889900\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.cloud.aiplatform.v1.CreateDatasetOperationMetadata\",\n \"genericMetadata\": {\n \"createTime\": \"2020-10-12T16:00:44.686500Z\",\n \"updateTime\": \"2020-10-12T16:01:06.115081Z\"\n }\n },\n \"done\": true,\n \"response\": {\n \"@type\": \"type.googleapis.com/google.cloud.aiplatform.v1.Dataset\",\n \"name\": \"projects/123456789012/locations/us-central1/datasets/1234567890123456789\",\n \"displayName\": \"image_dataset\",\n \"metadataSchemaUri\": \"gs://google-cloud-aiplatform/schema/dataset/metadata/image_1.0.0.yaml\",\n \"labels\": {\n \"aiplatform.googleapis.com/dataset_metadata_schema\": \"IMAGE\"\n },\n \"metadata\": {\n \"dataItemSchemaUri\": \"gs://google-cloud-aiplatform/schema/dataset/dataitem/image_1.0.0.yaml\"\n }\n }\n}\n```\n\n\u003cbr /\u003e\n\nCanceling an Operation\n----------------------\n\nYou can cancel a long-running operation so that you can stop it before the\noperation completes. When you successfully cancel an operation, the operation\nisn't deleted; instead, the operation stops with an error code of `1` and\nwith a `CANCELLED` message. Note that the cancellation is not guaranteed to\nsucceed. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eOPERATION_NAME\u003c/var\u003e: The operation name that is returned when you start a long-running operation, such as `projects/`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/datasets/`\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e`/operations/`\u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e\n\n\nHTTP method and URL:\n\n```\nPOST https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME:cancel\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d \"\" \\\n \"https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME:cancel\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -Uri \"https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME:cancel\" | Select-Object -Expand Content\n```\n\nYou should receive a successful status code (2xx) and an empty response.\n\n\u003cbr /\u003e"]]