Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dokumen ini menjelaskan cara melihat peristiwa status untuk tugas dan pekerjaan Batch. Peristiwa status memberikan histori yang dapat Anda gunakan untuk menganalisis
pekerjaan dan sering kali berisi pesan error berguna yang dapat Anda gunakan untuk
memecahkan masalah.
Setiap tugas dan setiap tugasnya memiliki peristiwa status yang otomatis
dibuat oleh Batch saat tugas berjalan.
Setiap peristiwa status ini menjelaskan perubahan status dan detail tentang alasan status tersebut tercapai.
Untuk mempelajari status tugas dan pekerjaan, lihat
Siklus proses tugas.
Secara opsional, Anda juga dapat mengonfigurasi tugas agar memiliki peristiwa status kustom, yang
menggambarkan progres runnable.
Untuk mempelajari lebih lanjut peristiwa status kustom, lihat
Mengonfigurasi peristiwa status kustom.
Untuk mendapatkan izin yang diperlukan untuk melihat tugas dan pekerjaan, minta administrator untuk memberi Anda peran IAM Batch Job Viewer (roles/batch.jobsViewer) atau Batch Job Editor (roles/batch.jobsEditor) di project.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Anda mungkin juga bisa mendapatkan
izin yang diperlukan melalui peran
khusus atau peran
bawaan lainnya.
Petunjuk berikut menjelaskan cara melihat peristiwa status menggunakan
Google Cloud konsol, gcloud CLI, dan Batch API.
Untuk menggunakan bahasa library klien, ikuti langkah-langkah untuk
melihat detail tugas atau
melihat detail tugas
lalu lihat kolom statusEvents[] yang sesuai.
Melihat peristiwa status tugas
Konsol
Untuk melihat peristiwa status tugas di project saat ini menggunakan konsolGoogle Cloud , ikuti langkah-langkah berikut:
TASK_INDEX: indeks tugas yang detailnya ingin Anda lihat. Dalam grup tugas, indeks tugas dimulai dari 0 untuk tugas pertama dan bertambah 1 untuk setiap tugas tambahan. Misalnya, grup
tugas yang berisi empat tugas memiliki indeks 0, 1, 2, dan 3.
TASK_GROUP_NAME: nama grup tugas yang
berisi tugas yang detailnya ingin Anda lihat. Nilai harus ditetapkan ke group0.
TASK_INDEX: indeks tugas yang detailnya ingin Anda lihat. Dalam grup tugas, indeks tugas dimulai dari 0 untuk tugas pertama dan bertambah 1 untuk setiap tugas tambahan. Misalnya, grup
tugas yang berisi empat tugas memiliki indeks 0, 1, 2, dan 3.
Langkah berikutnya
Untuk memahami peristiwa status dari Batch yang menjelaskan error, lihat
Pemecahan masalah.
Jika Anda menginginkan histori yang lebih mendetail untuk pekerjaan Anda, seperti peristiwa status
untuk saat runnable dimulai dan berakhir,
konfigurasi peristiwa status kustom.
[[["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-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)."]]