Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
In diesem Dokument wird beschrieben, wie Sie Statusereignisse für Batch-Jobs und ‑Aufgaben aufrufen. Statusereignisse enthalten einen Verlauf, mit dem Sie Jobs analysieren können. Sie enthalten oft nützliche Fehlermeldungen, die Sie zur Fehlerbehebung verwenden können.
Für jeden Job und jede seiner Aufgaben werden während der Ausführung des Jobs automatisch Statusereignisse von Batch erstellt.
Jedes dieser Statusereignisse beschreibt eine Statusänderung und enthält Details dazu, warum dieser Status erreicht wurde.
Informationen zu Job- und Aufgabenstatus finden Sie unter Job-Lebenszyklus.
Optional können Sie einen Job auch so konfigurieren, dass er benutzerdefinierte Statusereignisse enthält, die den Fortschritt von Runnables beschreiben.
Weitere Informationen zu benutzerdefinierten Statusereignissen
Bitten Sie Ihren Administrator, Ihnen die IAM-Rolle „Batch Job Viewer“ (roles/batch.jobsViewer) oder „Batch Job Editor“ (roles/batch.jobsEditor) für das Projekt zuzuweisen, um die Berechtigungen zu erhalten, die Sie zum Aufrufen von Jobs und Aufgaben benötigen.
Weitere Informationen zum Zuweisen von Rollen finden Sie unter Zugriff auf Projekte, Ordner und Organisationen verwalten.
In der folgenden Anleitung wird beschrieben, wie Sie Statusereignisse über dieGoogle Cloud Console, die gcloud CLI und die Batch API aufrufen.
Wenn Sie eine Clientbibliotheksprache verwenden möchten, folgen Sie der Anleitung zum Aufrufen der Details eines Jobs oder Aufrufen der Details einer Aufgabe und sehen Sie sich dann das entsprechende Feld statusEvents[] an.
Statusereignisse eines Jobs ansehen
Console
So rufen Sie die Statusereignisse eines Jobs im aktuellen Projekt über dieGoogle Cloud console auf:
Rufen Sie in der Google Cloud Console die Seite Jobliste auf.
Klicken Sie in der Spalte Jobname auf den Namen eines Jobs.
Die Seite Jobdetails wird aufgerufen.
Der Tab Details ist standardmäßig geöffnet.
Klicken Sie auf den Tab Events (Ereignisse).
gcloud
Wenn Sie die Statusereignisse eines Jobs mit der gcloud CLI aufrufen möchten, verwenden Sie den Befehl gcloud batch jobs describe und sehen Sie sich dann das Feld statusEvents[] an.
gcloud batch jobs describe JOB_NAME \
--location=LOCATION
Ersetzen Sie Folgendes:
JOB_NAME: Der Name eines vorhandenen Jobs.
LOCATION: der Standort, an dem der Job vorhanden ist.
API
Wenn Sie die Statusereignisse eines Jobs mit der Batch API aufrufen möchten, senden Sie eine GET-Anfrage an die Methode jobs.get und sehen Sie sich das Feld statusEvents[] an.
GET https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/JOB_NAME
Ersetzen Sie Folgendes:
PROJECT_ID: Die Projekt-ID des aktuellen Projekts.
LOCATION: der Standort, an dem der Job vorhanden ist.
JOB_NAME: Der Name eines vorhandenen Jobs.
Statusereignisse einer Aufgabe ansehen
gcloud
Wenn Sie die Statusereignisse einer Aufgabe mit der gcloud CLI aufrufen möchten, verwenden Sie den Befehl gcloud batch tasks describe und sehen Sie sich das Feld statusEvents[] an.
TASK_INDEX: Der Index der Aufgabe, deren Details Sie aufrufen möchten. In einer Aufgabengruppe beginnt der Aufgabenindex bei 0 für die erste Aufgabe und wird bei jeder zusätzlichen Aufgabe um 1 erhöht. Eine Taskgruppe mit vier Tasks hat beispielsweise die Indexe 0, 1, 2 und 3.
JOB_NAME: Der Name eines vorhandenen Jobs.
LOCATION: Der Standort, an dem der Job vorhanden ist.
TASK_GROUP_NAME: der Name der Aufgabengruppe, die die Aufgabe enthält, deren Details Sie aufrufen möchten. Der Wert muss auf group0 festgelegt werden.
API
Wenn Sie die Statusereignisse einer Aufgabe mit der Batch API aufrufen möchten, senden Sie eine GET-Anfrage an die tasks.get-Methode und sehen Sie sich dann das Feld statusEvents[] an.
GET https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/JOB_NAME/taskGroups/TASK_GROUP_NAME/tasks/TASK_INDEX
Ersetzen Sie Folgendes:
PROJECT_ID: Die Projekt-ID des aktuellen Projekts.
LOCATION: der Standort, an dem der Job vorhanden ist.
JOB_NAME: Der Name eines vorhandenen Jobs.
TASK_GROUP_NAME: der Name der Aufgabengruppe, die die Aufgabe enthält, deren Details Sie aufrufen möchten. Der Wert muss auf group0 festgelegt werden.
TASK_INDEX: Der Index der Aufgabe, deren Details Sie aufrufen möchten. In einer Aufgabengruppe beginnt der Aufgabenindex bei 0 für die erste Aufgabe und wird bei jeder zusätzlichen Aufgabe um 1 erhöht. Eine Taskgruppe mit vier Tasks hat beispielsweise die Indexe 0, 1, 2 und 3.
Nächste Schritte
Informationen zu Statusereignissen aus Batch, die Fehler beschreiben, finden Sie unter Fehlerbehebung.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-12 (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)."]]