Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Para algunas llamadas a la API, Vertex AI muestra los nombres de las operaciones. En estas llamadas a la API, se inician las operaciones que requieren tiempo para completarse y se conocen como operaciones de larga duración. Por ejemplo, la creación de un conjunto de datos, la eliminación de un extremo o la exportación de un modelo son operaciones de larga duración. Puedes usar métodos de ayuda junto con nombres de operación para obtener el estado de una operación de larga duración o cancelarla, como se describe en las secciones siguientes.
Obtén el estado de una operación
Para obtener el estado de la operación, usa el nombre de la operación que estaba en la respuesta cuando solicitaste una operación de larga duración. Por ejemplo, cuando creas un conjunto de datos, Vertex AI muestra un nombre de operación, como: projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Puedes consultar la operación a intervalos regulares para saber cuándo se completa una operación.
REST
Antes de usar cualquiera de los datos de solicitud a continuación, realiza los siguientes reemplazos:
OPERATION_NAME: El nombre de la operación que se muestra cuando inicias una operación de larga duración, como projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Método HTTP y URL:
GET https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME
Para enviar tu solicitud, elige una de estas opciones:
En el resultado, el objeto metadata contiene información específica para el tipo de solicitud. El campo done indica si se completó la operación. Si la operación se completa, el objeto response contiene sus resultados.
Puedes cancelar una operación de larga duración para detenerla antes de que se complete. Cuando cancelas una operación de forma correcta, la operación no se borra. En su lugar, se detiene con un código de error de 1 y con un mensaje CANCELLED. Ten en cuenta que no se garantiza que la cancelación se realice de forma correcta.
REST
Antes de usar cualquiera de los datos de solicitud a continuación, realiza los siguientes reemplazos:
OPERATION_NAME: El nombre de la operación que se muestra cuando inicias una operación de larga duración, como projects/PROJECT_NUMBER/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID
Método HTTP y URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/OPERATION_NAME:cancel
Para enviar tu solicitud, elige una de estas opciones:
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-02 (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"]]