Skip to main content

jobs

Creates, updates, deletes, gets or lists a jobs resource.

Overview

Namejobs
TypeResource
Idgoogle.batch.jobs

Fields

NameDatatypeDescription
namestringOutput only. Job name. For example: "projects/123456/locations/us-central1/jobs/job01".
allocationPolicyobjectA Job's resource allocation policy describes when, where, and how compute resources should be allocated for the Job.
createTimestringOutput only. When the Job was created.
labelsobjectLabels for the Job. Labels could be user provided or system generated. For example, "labels": { "department": "finance", "environment": "test" } You can assign up to 64 labels. Google Compute Engine label restrictions apply. Label names that start with "goog-" or "google-" are reserved.
logsPolicyobjectLogsPolicy describes how outputs from a Job's Tasks (stdout/stderr) will be preserved.
notificationsarrayNotification configurations.
prioritystringPriority 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.
statusobjectJob status.
taskGroupsarrayRequired. TaskGroups in the Job. Only one TaskGroup is supported now.
uidstringOutput only. A system generated unique ID for the Job.
updateTimestringOutput only. The last time the Job was updated.

Methods

NameAccessible byRequired ParamsDescription
getSELECTjobsId, locationsId, projectsIdGet a Job specified by its resource name.
listSELECTlocationsId, projectsIdList all Jobs for a project within a region.
createINSERTlocationsId, projectsIdCreate a Job.
deleteDELETEjobsId, locationsId, projectsIdDelete a Job.

SELECT examples

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 locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new jobs resource.

/*+ create */
INSERT INTO google.batch.jobs (
locationsId,
projectsId,
priority,
taskGroups,
allocationPolicy,
labels,
logsPolicy,
notifications
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ priority }}',
'{{ taskGroups }}',
'{{ allocationPolicy }}',
'{{ labels }}',
'{{ logsPolicy }}',
'{{ notifications }}'
;

DELETE example

Deletes the specified jobs resource.

/*+ delete */
DELETE FROM google.batch.jobs
WHERE jobsId = '{{ jobsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';