This page describes how to view Batch jobs and their tasks.
Before you begin
- If you haven't used Batch before, review Get started with Batch and enable Batch by completing the prerequisites for projects and users.
-
To get the permissions that you need to view jobs and tasks, ask your administrator to grant you the Batch Job Viewer (
roles/batch.jobsViewer
) or Batch Job Editor (roles/batch.jobsEditor
) IAM role on the project. For more information about granting roles, see Manage access.You might also be able to get the required permissions through custom roles or other predefined roles.
List and describe jobs
List jobs to view the jobs in a project. Describe a job to view its configuration details.
List jobs
You can list jobs using the Google Cloud console, gcloud CLI, Batch API, Go, Java, Node.js, or Python.
Console
To list your project's jobs, in the Google Cloud console, go to the Job list page.
gcloud
To list your project's jobs using the
gcloud CLI, use the gcloud batch jobs list
command.
gcloud batch jobs list
API
To list your project's jobs for a specific location using the
Batch API, use the
jobs.list
method:
GET https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/
Replace the following:
PROJECT_ID
: the project ID of your project.LOCATION
: the location of the job.JOB_NAME
: the name of the job.
Go
Go
For more information, see the Batch Go API reference documentation.
Java
Java
For more information, see the Batch Java API reference documentation.
Node.js
Node.js
For more information, see the Batch Node.js API reference documentation.
Python
Python
For more information, see the Batch Python API reference documentation.
Describe a job
You can describe a job using the Google Cloud console, gcloud CLI, Batch API, Go, Java, Node.js, or Python.
Console
To list your project's jobs, in the Google Cloud console, go to the Job list page.
To describe a job, in the Job name column, click the name of a job. The Job details page opens.
The Details tab is open by default. Click other tabs for more information.
gcloud
To describe a job using the gcloud CLI,
use the gcloud batch jobs describe
command.
gcloud batch jobs describe JOB_NAME --location LOCATION
Replace the following:
JOB_NAME
: the name of the job.LOCATION
: the location of the job.
API
To describe a job using the Batch API, use the
jobs.get
method:
GET https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/JOB_NAME
Replace the following:
PROJECT_ID
: the project ID of your project.LOCATION
: the location of the job.JOB_NAME
: the name of the job.
Go
Go
For more information, see the Batch Go API reference documentation.
Java
Java
For more information, see the Batch Java API reference documentation.
Node.js
Node.js
For more information, see the Batch Node.js API reference documentation.
Python
Python
For more information, see the Batch Python API reference documentation.
List and describe tasks
List tasks to view the tasks in a job or a job's task group. Describe a task to view its configuration details.
List tasks
You can list a job's tasks using the Google Cloud console, gcloud CLI, Batch API, Go, Java, Node.js, or Python.
Console
To view a job's task details using the Google Cloud console, describe a job to open the Job details page and see the Task details section.
gcloud
To list the tasks for a job's tasks group using the
gcloud CLI, use the gcloud batch tasks list
command.
gcloud batch tasks list --location LOCATION \
--job JOB_NAME
Replace the following:
LOCATION
: the location of the job.JOB_NAME
: the name of the job.
API
To list the tasks for a job's task group using the
Batch API, use the
tasks.list
method:
GET https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/JOB_NAME/taskGroups/TASK_GROUP_NAME/tasks
Replace the following:
PROJECT_ID
: the project ID of your project.LOCATION
: the location of the job.JOB_NAME
: the name of the job.TASK_GROUP_NAME
: the name of the task group that you want to describe. Set this togroup0
.
Go
Go
For more information, see the Batch Go API reference documentation.
Java
Java
For more information, see the Batch Java API reference documentation.
Node.js
Node.js
For more information, see the Batch Node.js API reference documentation.
Python
Python
For more information, see the Batch Python API reference documentation.
Describe a task
You can describe a task using the Google Cloud console, gcloud CLI, Batch API, Go, Java, Node.js, or Python.
Console
To view a job's task details using the Google Cloud console, describe a job to open the Job details page and see the Task details section.
gcloud
To describe a task using the
gcloud CLI, use the gcloud batch tasks describe
command.
gcloud batch tasks describe TASK_INDEX \
--location LOCATION \
--job JOB_NAME \
--task_group TASK_GROUP_NAME
Replace the following:
TASK_INDEX
: the index of the task that you want to describe. The indexes for the task in a task group begin at0
and increases by one for each task. For example, the indexes for a task group with four tasks are0
,1
,2
, and3
.TASK_GROUP_NAME
: the name of the task group that contains the task that you want to describe. Set this togroup0
.JOB_NAME
: the name of the job.LOCATION
: the location of the job.
API
To describe a task using the Batch API, use the
tasks.get
method:
GET https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/JOB_NAME/taskGroups/TASK_GROUP_NAME/tasks/TASK_INDEX
Replace the following:
PROJECT_ID
: the project ID of your project.LOCATION
: the location of the job.JOB_NAME
: the name of the job.TASK_GROUP_NAME
: the name of the task group that contains the task that you want to describe. Set this togroup0
.TASK_INDEX
: the index of the task that you want to describe. The indexes for the task in a task group begin at0
and increases by one for each task. For example, the indexes for a task group with four tasks are0
,1
,2
, and3
.
Go
Go
For more information, see the Batch Go API reference documentation.
Java
Java
For more information, see the Batch Java API reference documentation.
Node.js
Node.js
For more information, see the Batch Node.js API reference documentation.
Python
Python
For more information, see the Batch Python API reference documentation.