Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Para algumas chamadas de API, a Vertex AI retorna nomes de operação. Essas chamadas de API iniciam operações que exigem tempo para serem concluídas e são conhecidas como operações de longa duração. Por exemplo, criar um conjunto de dados, excluir um endpoint ou exportar um modelo são operações de longa duração. Use métodos auxiliares com nomes de operações para receber o status ou cancelar uma operação de longa duração, conforme descrito nas seções a seguir.
Como saber o status de uma operação
Para ver o status da operação, use o nome da operação que estava na resposta quando você solicitou uma operação de longa duração. Por exemplo, quando você cria um
conjunto de dados, a Vertex AI retorna um nome de operação como: projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
É possível pesquisar a operação em intervalos regulares para saber quando uma operação for concluída.
REST
Antes de usar os dados da solicitação abaixo, faça as substituições a seguir:
OPERATION_NAME: o nome da operação retornado quando você inicia uma operação de longa duração, como projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Método HTTP e URL:
GET https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME
Para enviar a solicitação, escolha uma destas opções:
Na saída, o objeto metadata contém informações específicas do tipo de solicitação. O campo done indica se a operação foi concluída. Se a operação estiver concluída, o objeto response conterá resultados da operação.
É possível cancelar uma operação de longa duração para interrompê-la antes que ela seja concluída. Quando uma operação é cancelada com sucesso, ela não é excluída. Em vez disso, a operação é interrompida com um código de erro 1 e com uma mensagem CANCELLED. O cancelamento não é garantido.
REST
Antes de usar os dados da solicitação abaixo, faça as substituições a seguir:
OPERATION_NAME: o nome da operação retornado quando você inicia uma operação de longa duração, como projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Método HTTP e URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME:cancel
Para enviar a solicitação, escolha uma destas opções:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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"]]