jobs
Creates, updates, deletes, gets or lists a jobs
resource.
Overview
Name | jobs |
Type | Resource |
Id | google.batch.jobs |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Output only. Job name. For example: "projects/123456/locations/us-central1/jobs/job01". |
allocationPolicy | object | Compute resource allocation for all TaskGroups in the Job. (id: AllocationPolicy) |
createTime | string (google-datetime) | Output only. When the Job was created. |
labels | object | Custom labels to apply to the job and any Cloud Logging LogEntry that it generates. Use labels to group and describe the resources they are applied to. Batch automatically applies predefined labels and supports multiple labels fields for each job, which each let you apply custom labels to various resources. Label names that start with "goog-" or "google-" are reserved for predefined labels. For more information about labels with Batch, see Organize resources using labels. |
logsPolicy | object | Log preservation policy for the Job. (id: LogsPolicy) |
notifications | array | Notification configurations. |
priority | string (int64) | Priority of the Job. The valid value range is [0, 100). Default value is 0. Higher value indicates higher priority. A job with higher priority value is more likely to run earlier if all other requirements are satisfied. |
status | object | Output only. Job status. It is read only for users. (id: JobStatus) |
taskGroups | array | Required. TaskGroups in the Job. Only one TaskGroup is supported now. |
uid | string | Output only. A system generated unique ID for the Job. |
updateTime | string (google-datetime) | Output only. The last time the Job was updated. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Output only. Job name. For example: "projects/123456/locations/us-central1/jobs/job01". |
allocationPolicy | object | Compute resource allocation for all TaskGroups in the Job. (id: AllocationPolicy) |
createTime | string (google-datetime) | Output only. When the Job was created. |
labels | object | Custom labels to apply to the job and any Cloud Logging LogEntry that it generates. Use labels to group and describe the resources they are applied to. Batch automatically applies predefined labels and supports multiple labels fields for each job, which each let you apply custom labels to various resources. Label names that start with "goog-" or "google-" are reserved for predefined labels. For more information about labels with Batch, see Organize resources using labels. |
logsPolicy | object | Log preservation policy for the Job. (id: LogsPolicy) |
notifications | array | Notification configurations. |
priority | string (int64) | Priority of the Job. The valid value range is [0, 100). Default value is 0. Higher value indicates higher priority. A job with higher priority value is more likely to run earlier if all other requirements are satisfied. |
status | object | Output only. Job status. It is read only for users. (id: JobStatus) |
taskGroups | array | Required. TaskGroups in the Job. Only one TaskGroup is supported now. |
uid | string | Output only. A system generated unique ID for the Job. |
updateTime | string (google-datetime) | Output only. The last time the Job was updated. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , jobsId | Get a Job specified by its resource name. | |
list | select | projectsId , locationsId | filter , orderBy , pageSize , pageToken | List all Jobs for a project within a region. |
create | insert | projectsId , locationsId | jobId , requestId | Create a Job. |
delete | delete | projectsId , locationsId , jobsId | reason , requestId | Delete a Job. |
cancel | exec | projectsId , locationsId , jobsId | Cancel a Job. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
jobsId | string | |
locationsId | string | |
projectsId | string | |
filter | string | |
jobId | string | |
orderBy | string | |
pageSize | integer (int32) | |
pageToken | string | |
reason | string | |
requestId | string |
SELECT
examples
- get
- list
Get a Job specified by its resource name.
SELECT
name,
allocationPolicy,
createTime,
labels,
logsPolicy,
notifications,
priority,
status,
taskGroups,
uid,
updateTime
FROM google.batch.jobs
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND jobsId = '{{ jobsId }}' -- required;
List all Jobs for a project within a region.
SELECT
name,
allocationPolicy,
createTime,
labels,
logsPolicy,
notifications,
priority,
status,
taskGroups,
uid,
updateTime
FROM google.batch.jobs
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND filter = '{{ filter }}'
AND orderBy = '{{ orderBy }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
Create a Job.
INSERT INTO google.batch.jobs (
data__priority,
data__taskGroups,
data__allocationPolicy,
data__labels,
data__logsPolicy,
data__notifications,
projectsId,
locationsId,
jobId,
requestId
)
SELECT
'{{ priority }}',
'{{ taskGroups }}',
'{{ allocationPolicy }}',
'{{ labels }}',
'{{ logsPolicy }}',
'{{ notifications }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ jobId }}',
'{{ requestId }}'
RETURNING
name,
allocationPolicy,
createTime,
labels,
logsPolicy,
notifications,
priority,
status,
taskGroups,
uid,
updateTime
;
# Description fields are for documentation purposes
- name: jobs
props:
- name: projectsId
value: string
description: Required parameter for the jobs resource.
- name: locationsId
value: string
description: Required parameter for the jobs resource.
- name: priority
value: string
description: >
Priority of the Job. The valid value range is [0, 100). Default value is 0. Higher value indicates higher priority. A job with higher priority value is more likely to run earlier if all other requirements are satisfied.
- name: taskGroups
value: array
description: >
Required. TaskGroups in the Job. Only one TaskGroup is supported now.
- name: allocationPolicy
value: object
description: >
Compute resource allocation for all TaskGroups in the Job.
- name: labels
value: object
description: >
Custom labels to apply to the job and any Cloud Logging [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) that it generates. Use labels to group and describe the resources they are applied to. Batch automatically applies predefined labels and supports multiple `labels` fields for each job, which each let you apply custom labels to various resources. Label names that start with "goog-" or "google-" are reserved for predefined labels. For more information about labels with Batch, see [Organize resources using labels](https://cloud.google.com/batch/docs/organize-resources-using-labels).
- name: logsPolicy
value: object
description: >
Log preservation policy for the Job.
- name: notifications
value: array
description: >
Notification configurations.
- name: jobId
value: string
- name: requestId
value: string
DELETE
examples
- delete
Delete a Job.
DELETE FROM google.batch.jobs
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND jobsId = '{{ jobsId }}' --required
AND reason = '{{ reason }}'
AND requestId = '{{ requestId }}';
Lifecycle Methods
- cancel
Cancel a Job.
EXEC google.batch.jobs.cancel
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@jobsId='{{ jobsId }}' --required
@@json=
'{
"requestId": "{{ requestId }}"
}';