Skip to main content

jobs

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

Overview

Namejobs
TypeResource
Idgoogle.dataproc.jobs

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
donebooleanOutput only. Indicates whether the job is completed. If the value is false, the job is still in progress. If true, the job is completed, and status.state field will indicate if it was successful, failed, or cancelled.
driverControlFilesUristringOutput only. If present, the location of miscellaneous control files which can be used as part of job setup and handling. If not present, control files might be placed in the same location as driver_output_uri.
driverOutputResourceUristringOutput only. A URI pointing to the location of the stdout of the job's driver program.
driverSchedulingConfigobjectOptional. Driver scheduling configuration. (id: DriverSchedulingConfig)
flinkJobobjectOptional. Job is a Flink job. (id: FlinkJob)
hadoopJobobjectOptional. Job is a Hadoop job. (id: HadoopJob)
hiveJobobjectOptional. Job is a Hive job. (id: HiveJob)
jobUuidstringOutput only. A UUID that uniquely identifies a job within the project over time. This is in contrast to a user-settable reference.job_id that might be reused over time.
labelsobjectOptional. The labels to associate with this job. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values can be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a job.
pigJobobjectOptional. Job is a Pig job. (id: PigJob)
placementobjectRequired. Job information, including how, when, and where to run the job. (id: JobPlacement)
prestoJobobjectOptional. Job is a Presto job. (id: PrestoJob)
pysparkJobobjectOptional. Job is a PySpark job. (id: PySparkJob)
referenceobjectOptional. The fully qualified reference to the job, which can be used to obtain the equivalent REST path of the job resource. If this property is not specified when a job is created, the server generates a job_id. (id: JobReference)
schedulingobjectOptional. Job scheduling configuration. (id: JobScheduling)
sparkJobobjectOptional. Job is a Spark job. (id: SparkJob)
sparkRJobobjectOptional. Job is a SparkR job. (id: SparkRJob)
sparkSqlJobobjectOptional. Job is a SparkSql job. (id: SparkSqlJob)
statusobjectOutput only. The job status. Additional application-specific status information might be contained in the type_job and yarn_applications fields. (id: JobStatus)
statusHistoryarrayOutput only. The previous job status.
trinoJobobjectOptional. Job is a Trino job. (id: TrinoJob)
yarnApplicationsarrayOutput only. The collection of YARN applications spun up by this job.Beta Feature: This report is available for testing purposes only. It might be changed before final release.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_regions_jobs_getselectprojectId, region, jobIdGets the resource representation for a job in a project.
projects_regions_jobs_listselectprojectId, regionpageSize, pageToken, clusterName, jobStateMatcher, filterLists regions/{region}/jobs in a project.
projects_regions_jobs_patchupdateprojectId, region, jobIdupdateMaskUpdates a job in a project.
projects_regions_jobs_deletedeleteprojectId, region, jobIdDeletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.
projects_regions_jobs_submitexecprojectId, regionSubmits a job to a cluster.
projects_regions_jobs_submit_as_operationexecprojectId, regionSubmits job to a cluster.
projects_regions_jobs_cancelexecprojectId, region, jobIdStarts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list (https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or regions/{region}/jobs.get (https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).

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.

NameDatatypeDescription
jobIdstring
projectIdstring
regionstring
clusterNamestring
filterstring
jobStateMatcherstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets the resource representation for a job in a project.

SELECT
done,
driverControlFilesUri,
driverOutputResourceUri,
driverSchedulingConfig,
flinkJob,
hadoopJob,
hiveJob,
jobUuid,
labels,
pigJob,
placement,
prestoJob,
pysparkJob,
reference,
scheduling,
sparkJob,
sparkRJob,
sparkSqlJob,
status,
statusHistory,
trinoJob,
yarnApplications
FROM google.dataproc.jobs
WHERE projectId = '{{ projectId }}' -- required
AND region = '{{ region }}' -- required
AND jobId = '{{ jobId }}' -- required;

UPDATE examples

Updates a job in a project.

UPDATE google.dataproc.jobs
SET
data__reference = '{{ reference }}',
data__placement = '{{ placement }}',
data__hadoopJob = '{{ hadoopJob }}',
data__sparkJob = '{{ sparkJob }}',
data__pysparkJob = '{{ pysparkJob }}',
data__hiveJob = '{{ hiveJob }}',
data__pigJob = '{{ pigJob }}',
data__sparkRJob = '{{ sparkRJob }}',
data__sparkSqlJob = '{{ sparkSqlJob }}',
data__prestoJob = '{{ prestoJob }}',
data__trinoJob = '{{ trinoJob }}',
data__flinkJob = '{{ flinkJob }}',
data__labels = '{{ labels }}',
data__scheduling = '{{ scheduling }}',
data__driverSchedulingConfig = '{{ driverSchedulingConfig }}'
WHERE
projectId = '{{ projectId }}' --required
AND region = '{{ region }}' --required
AND jobId = '{{ jobId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
done,
driverControlFilesUri,
driverOutputResourceUri,
driverSchedulingConfig,
flinkJob,
hadoopJob,
hiveJob,
jobUuid,
labels,
pigJob,
placement,
prestoJob,
pysparkJob,
reference,
scheduling,
sparkJob,
sparkRJob,
sparkSqlJob,
status,
statusHistory,
trinoJob,
yarnApplications;

DELETE examples

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

DELETE FROM google.dataproc.jobs
WHERE projectId = '{{ projectId }}' --required
AND region = '{{ region }}' --required
AND jobId = '{{ jobId }}' --required;

Lifecycle Methods

Submits a job to a cluster.

EXEC google.dataproc.jobs.projects_regions_jobs_submit 
@projectId='{{ projectId }}' --required,
@region='{{ region }}' --required
@@json=
'{
"job": "{{ job }}",
"requestId": "{{ requestId }}"
}';