Skip to main content

jobs

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

Overview

Namejobs
TypeResource
Idgoogle.ml.jobs

Fields

NameDatatypeDescription
createTimestringOutput only. When the job was created.
endTimestringOutput only. When the job processing was completed.
errorMessagestringOutput only. The details of a failure or a cancellation.
etagstringetag is used for optimistic concurrency control as a way to help prevent simultaneous updates of a job from overwriting each other. It is strongly suggested that systems make use of the etag in the read-modify-write cycle to perform job updates in order to avoid race conditions: An etag is returned in the response to GetJob, and systems are expected to put that etag in the request to UpdateJob to ensure that their change will be applied to the same version of the job.
jobIdstringRequired. The user-specified id of the job.
jobPositionstringOutput only. It's only effect when the job is in QUEUED state. If it's positive, it indicates the job's position in the job scheduler. It's 0 when the job is already scheduled.
labelsobjectOptional. One or more labels that you can add, to organize your jobs. Each label is a key-value pair, where both the key and the value are arbitrary strings that you supply. For more information, see the documentation on using labels.
predictionInputobjectRepresents input parameters for a prediction job.
predictionOutputobjectRepresents results of a prediction job.
startTimestringOutput only. When the job processing was started.
statestringOutput only. The detailed state of a job.
trainingInputobjectRepresents input parameters for a training job. When using the gcloud command to submit your training job, you can specify the input parameters as command-line arguments and/or in a YAML configuration file referenced from the --config command-line argument. For details, see the guide to submitting a training job.
trainingOutputobjectRepresents results of a training job. Output only.

Methods

NameAccessible byRequired ParamsDescription
projects_jobs_getSELECTjobsId, projectsIdDescribes a job.
projects_jobs_listSELECTprojectsIdLists the jobs in the project. If there are no jobs that match the request parameters, the list request returns an empty response body: {}.
projects_jobs_createINSERTprojectsIdCreates a training or a batch prediction job.
projects_jobs_patchUPDATEjobsId, projectsIdUpdates a specific job resource. Currently the only supported fields to update are labels.
projects_jobs_cancelEXECjobsId, projectsIdCancels a running job.

SELECT examples

Lists the jobs in the project. If there are no jobs that match the request parameters, the list request returns an empty response body: {}.

SELECT
createTime,
endTime,
errorMessage,
etag,
jobId,
jobPosition,
labels,
predictionInput,
predictionOutput,
startTime,
state,
trainingInput,
trainingOutput
FROM google.ml.jobs
WHERE projectsId = '{{ projectsId }}';

INSERT example

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

/*+ create */
INSERT INTO google.ml.jobs (
projectsId,
jobId,
trainingInput,
predictionInput,
startTime,
endTime,
state,
errorMessage,
trainingOutput,
predictionOutput,
labels,
etag
)
SELECT
'{{ projectsId }}',
'{{ jobId }}',
'{{ trainingInput }}',
'{{ predictionInput }}',
'{{ startTime }}',
'{{ endTime }}',
'{{ state }}',
'{{ errorMessage }}',
'{{ trainingOutput }}',
'{{ predictionOutput }}',
'{{ labels }}',
'{{ etag }}'
;

UPDATE example

Updates a jobs resource.

/*+ update */
UPDATE google.ml.jobs
SET
jobId = '{{ jobId }}',
trainingInput = '{{ trainingInput }}',
predictionInput = '{{ predictionInput }}',
startTime = '{{ startTime }}',
endTime = '{{ endTime }}',
state = '{{ state }}',
errorMessage = '{{ errorMessage }}',
trainingOutput = '{{ trainingOutput }}',
predictionOutput = '{{ predictionOutput }}',
labels = '{{ labels }}',
etag = '{{ etag }}'
WHERE
jobsId = '{{ jobsId }}'
AND projectsId = '{{ projectsId }}';