Conferir o histórico de um job por eventos de status
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Este documento explica como visualizar eventos de status para jobs e tarefas do Batch. Os eventos de status fornecem um histórico que pode ser usado para analisar jobs e geralmente contêm mensagens de erro úteis que podem ser usadas para solução de problemas.
Cada job e cada uma das tarefas têm eventos de status criados automaticamente pelo Batch enquanto o job é executado.
Cada um desses eventos de status descreve uma mudança de estado e detalhes sobre por que esse estado foi alcançado.
Para saber mais sobre os estados de jobs e tarefas, consulte
Ciclo de vida do job.
Também é possível configurar um job para ter eventos de status personalizados, que
descrevem o progresso dos executáveis.
Para saber mais sobre eventos de status personalizados, consulte
Configurar eventos de status personalizados.
Para receber as permissões necessárias para
ver jobs e tarefas,
peça ao administrador para conceder a você o
papel do IAM de Leitor de jobs em lote (roles/batch.jobsViewer) ou Editor de jobs em lote (roles/batch.jobsEditor)
no projeto.
Para mais informações sobre a concessão de papéis, consulte Gerenciar o acesso a projetos, pastas e organizações.
As instruções a seguir explicam como ver eventos de status usando o
consoleGoogle Cloud , a CLI gcloud e a API Batch.
Para usar uma linguagem de biblioteca de cliente, siga as etapas para ver os detalhes de um job ou ver os detalhes de uma tarefa e confira o campo statusEvents[] correspondente.
Ver os eventos de status de um job
Console
Para conferir os eventos de status de um job no projeto atual usando o
console doGoogle Cloud , siga estas etapas:
No console Google Cloud , acesse a página Lista de jobs.
TASK_INDEX: o índice da tarefa que você quer ver
os detalhes. Em um grupo de tarefas, o índice começa em 0 para a primeira tarefa e aumenta em 1 a cada tarefa adicional. Por exemplo, um grupo de tarefas com quatro tarefas tem os índices 0, 1, 2 e 3.
TASK_GROUP_NAME: o nome do grupo de tarefas que
contém a tarefa cujos detalhes você quer ver. O valor precisa ser definido como group0.
TASK_INDEX: o índice da tarefa que você quer ver
os detalhes. Em um grupo de tarefas, o índice começa em 0 para a primeira tarefa e aumenta em 1 a cada tarefa adicional. Por exemplo, um grupo de tarefas com quatro tarefas tem os índices 0, 1, 2 e 3.
A seguir
Para entender os eventos de status do Batch que descrevem erros, consulte
Solução de problemas.
[[["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-09-02 UTC."],[[["\u003cp\u003eStatus events in Batch provide a history of state changes for jobs and tasks, including error messages for troubleshooting.\u003c/p\u003e\n"],["\u003cp\u003eBoth jobs and individual tasks within those jobs automatically generate status events that are created by Batch while the job runs and will describe state changes.\u003c/p\u003e\n"],["\u003cp\u003eYou can view job-level status events through the Google Cloud console, gcloud CLI, or Batch API, with the console only showing job-level events.\u003c/p\u003e\n"],["\u003cp\u003eTask-level status events can be accessed via the gcloud CLI or Batch API, and it is done by identifying the task by its index, location, job name, and task group name.\u003c/p\u003e\n"],["\u003cp\u003eCustom status events can be configured for a job to capture more granular progress of runnables.\u003c/p\u003e\n"]]],[],null,["# View a job's history through status events\n\nThis document explains how to view status events for Batch\njobs and tasks. Status events provide a history that you can use to analyze\njobs and often contain useful error messages that you can use for\ntroubleshooting.\n\nEach job and each of its tasks have status events that are automatically\ncreated by Batch while the job runs.\nEach of these status events describe a state\nchange and details about why that state was reached.\nTo learn about job and task states, see\n[Job lifecycle](/batch/docs/create-run-job#lifecycle).\nOptionally, you can also configure a job to have custom status events, which\ndescribe the progress of runnables.\nTo learn more about custom status events, see\n[Configure custom status events](/batch/docs/create-run-job-custom-status-events).\n\nBefore you begin\n----------------\n\n1. If you haven't used Batch before, review [Get started with Batch](/batch/docs/get-started) and enable Batch by completing the [prerequisites for projects and users](/batch/docs/get-started#prerequisites).\n2.\n\n To get the permissions that\n you need to view jobs and tasks,\n\n ask your administrator to grant you the\n\n\n Batch Job Viewer (`roles/batch.jobsViewer`) or Batch Job Editor (`roles/batch.jobsEditor`)\n IAM role on the project.\n\n\n For more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\n You might also be able to get\n the required permissions through [custom\n roles](/iam/docs/creating-custom-roles) or other [predefined\n roles](/iam/docs/roles-overview#predefined).\n\n\u003cbr /\u003e\n\nView status events\n------------------\n\nDifferent status events might appear at the job level\n([`statusEvents[]` field for the job](/batch/docs/reference/rest/v1/projects.locations.jobs#JobStatus.FIELDS.status_events))\nand task level\n([`statusEvents[]` field for each task](/batch/docs/reference/rest/v1/projects.locations.jobs.taskGroups.tasks#TaskStatus.FIELDS.status_events)).\n\nThe following instructions explain how to view status events using the\nGoogle Cloud console, gcloud CLI, and Batch API.\nTo use a client-library language, follow the steps to\n[view the details of a job](/batch/docs/view-jobs-tasks#describe-job) or\n[view the details of a task](/batch/docs/view-jobs-tasks#describe-task)\nand then see the corresponding `statusEvents[]` field.\n\n### View the status events of a job\n\n### Console\n\n| **Note:** The Google Cloud console only lists job-level status events.\n\nTo view the status events of a job in the current project using the\nGoogle Cloud console, follow these steps:\n\n1. In the Google Cloud console, go to the **Job list** page.\n\n [Go to Job list](https://console.cloud.google.com/batch/jobs)\n2. In the **Job name** column, click the name of a job.\n\n The **Job details** page opens.\n\n The **Details** tab is open by default.\n3. Click the **Events** tab.\n\n### gcloud\n\nTo view the status events of a job using the\ngcloud CLI, use the\n[`gcloud batch jobs describe` command](/sdk/gcloud/reference/batch/jobs/describe),\nand then see the `statusEvents[]` field. \n\n gcloud batch jobs describe \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: the name of an existing job.\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [location](/batch/docs/locations)\n where the job exists.\n\n### API\n\nTo view the status events of a job using the\nBatch API, make a `GET` request to the\n[`jobs.get` method](/batch/docs/reference/rest/v1/projects.locations.jobs/get),\nand then see the `statusEvents[]` field. \n\n GET https://batch.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/jobs/\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the\n [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects)\n of the current project.\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [location](/batch/docs/locations)\n where the job exists.\n\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: the name of an existing job.\n\n### View the status events of a task\n\n### gcloud\n\nTo view the status events of a task using the gcloud CLI, use the\n[`gcloud batch tasks describe` command](/sdk/gcloud/reference/batch/tasks/describe),\nand then see the `statusEvents[]` field. \n\n gcloud batch tasks describe \u003cvar translate=\"no\"\u003eTASK_INDEX\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --job=\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e \\\n --task_group=\u003cvar translate=\"no\"\u003eTASK_GROUP_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eTASK_INDEX\u003c/var\u003e: the index of the task that you want to view\n the details of. In a task group, the task index starts at 0 for the first\n task and increases by 1 with each additional task. For example, a task\n group that contains four tasks has the indexes `0`, `1`, `2`, and `3`.\n\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: the name of an existing job.\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [location](/batch/docs/locations) where\n the job exists.\n\n- \u003cvar translate=\"no\"\u003eTASK_GROUP_NAME\u003c/var\u003e: the name of the task group that\n contains the task that you want to view the details of. The value must be\n set to [`group0`](/batch/docs/get-started#restrictions).\n\n### API\n\nTo view the status events of a task using the Batch API,\nmake a `GET` request to the\n[`tasks.get` method](/batch/docs/reference/rest/v1/projects.locations.jobs.taskGroups.tasks/get),\nand then see the `statusEvents[]` field. \n\n GET https://batch.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/jobs/\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e/taskGroups/\u003cvar translate=\"no\"\u003eTASK_GROUP_NAME\u003c/var\u003e/tasks/\u003cvar translate=\"no\"\u003eTASK_INDEX\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the\n [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects)\n of the current project.\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [location](/batch/docs/locations)\n where the job exists.\n\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: the name of an existing job.\n\n- \u003cvar translate=\"no\"\u003eTASK_GROUP_NAME\u003c/var\u003e: the name of the task group that\n contains the task that you want to view the details of. The value must be\n set to [`group0`](/batch/docs/get-started#restrictions).\n\n- \u003cvar translate=\"no\"\u003eTASK_INDEX\u003c/var\u003e: the index of the task that you want to view\n the details of. In a task group, the task index starts at 0 for the first\n task and increases by 1 with each additional task. For example, a task\n group that contains four tasks has the indexes `0`, `1`, `2`, and `3`.\n\nWhat's next\n-----------\n\n- To understand status events from Batch that describe errors, see\n [Troubleshooting](/batch/docs/troubleshooting).\n\n- If you want a more detailed history for your job, such as status events\n for when runnables start and end,\n [configure custom status events](/batch/docs/create-run-job-custom-status-events).\n\n- Learn how to\n [analyze a job by using logs](/batch/docs/analyze-job-using-logs)."]]