JobControllerClient

JobControllerClient

The JobController provides methods to manage jobs.

Constructor

new JobControllerClient(optionsopt)

Construct an instance of JobControllerClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. The options accepted by the constructor are described in detail in this document. The common options are:

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

clientConfig gax.ClientConfig <optional>

Client configuration override. Follows the structure of gapicConfig.

fallback boolean <optional>

Use HTTP fallback mode. In fallback mode, a special browser-compatible transport implementation is used instead of gRPC transport. In browser context (if the window object is defined) the fallback mode is enabled automatically; set options.fallback to false if you need to override this behavior.

Members

apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

port

The port for this API service.

scopes

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

The DNS address for this API service.

Methods

cancelJob(request, optionsopt) → {Promise}

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

jobId string

Required. The job ID.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Job. Please see the documentation for more details and examples.
Example
const [response] = await client.cancelJob(request);

(async) checkSubmitJobAsOperationProgress(name) → {Promise}

Check the status of the long running operation returned by submitJobAsOperation().

Parameters:
Name Type Description
name String

The operation name that will be passed.

Returns:
Type Description
Promise
  • The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.
Example
const decodedOperation = await checkSubmitJobAsOperationProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);

close() → {Promise}

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns:
Type Description
Promise

A promise that resolves when the client is closed.

deleteJob(request, optionsopt) → {Promise}

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

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

jobId string

Required. The job ID.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.
Example
const [response] = await client.deleteJob(request);

getJob(request, optionsopt) → {Promise}

Gets the resource representation for a job in a project.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

jobId string

Required. The job ID.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Job. Please see the documentation for more details and examples.
Example
const [response] = await client.getJob(request);

getProjectId() → {Promise}

Return the project ID used by this class.

Returns:
Type Description
Promise

A promise that resolves to string containing the project ID.

initialize() → {Promise}

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns:
Type Description
Promise

A promise that resolves to an authenticated service stub.

listJobs(request, optionsopt) → {Promise}

Lists regions/{region}/jobs in a project.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

pageSize number <optional>

Optional. The number of results to return in each response.

pageToken string <optional>

Optional. The page token, returned by a previous call, to request the next page of results.

clusterName string <optional>

Optional. If set, the returned jobs list includes only jobs that were submitted to the named cluster.

jobStateMatcher google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher <optional>

Optional. Specifies enumerated categories of jobs to list. (default = match ALL jobs).

If filter is provided, jobStateMatcher will be ignored.

filter string <optional>

Optional. A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax:

[field = value] AND [field [= value]] ...

where field is status.state or labels.[KEY], and [KEY] is a label key. value can be * to match all values. status.state can be either ACTIVE or NON_ACTIVE. Only the logical AND operator is supported; space-separated items are treated as having an implicit AND operator.

Example filter:

status.state = ACTIVE AND labels.env = staging AND labels.starred = *

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is Array of Job. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listJobsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listJobsAsync(request, optionsopt) → {Object}

Equivalent to listJobs, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

pageSize number <optional>

Optional. The number of results to return in each response.

pageToken string <optional>

Optional. The page token, returned by a previous call, to request the next page of results.

clusterName string <optional>

Optional. If set, the returned jobs list includes only jobs that were submitted to the named cluster.

jobStateMatcher google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher <optional>

Optional. Specifies enumerated categories of jobs to list. (default = match ALL jobs).

If filter is provided, jobStateMatcher will be ignored.

filter string <optional>

Optional. A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax:

[field = value] AND [field [= value]] ...

where field is status.state or labels.[KEY], and [KEY] is a label key. value can be * to match all values. status.state can be either ACTIVE or NON_ACTIVE. Only the logical AND operator is supported; space-separated items are treated as having an implicit AND operator.

Example filter:

status.state = ACTIVE AND labels.env = staging AND labels.starred = *

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Object

An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Job. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example
const iterable = client.listJobsAsync(request);
for await (const response of iterable) {
  // process response
}

listJobsStream(request, optionsopt) → {Stream}

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

pageSize number <optional>

Optional. The number of results to return in each response.

pageToken string <optional>

Optional. The page token, returned by a previous call, to request the next page of results.

clusterName string <optional>

Optional. If set, the returned jobs list includes only jobs that were submitted to the named cluster.

jobStateMatcher google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher <optional>

Optional. Specifies enumerated categories of jobs to list. (default = match ALL jobs).

If filter is provided, jobStateMatcher will be ignored.

filter string <optional>

Optional. A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax:

[field = value] AND [field [= value]] ...

where field is status.state or labels.[KEY], and [KEY] is a label key. value can be * to match all values. status.state can be either ACTIVE or NON_ACTIVE. Only the logical AND operator is supported; space-separated items are treated as having an implicit AND operator.

Example filter:

status.state = ACTIVE AND labels.env = staging AND labels.starred = *

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Stream

An object stream which emits an object representing Job on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listJobsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName) → {string}

Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource.

Parameters:
Name Type Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the autoscaling_policy.

matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName) → {string}

Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource.

Parameters:
Name Type Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the autoscaling_policy.

matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName) → {string}

Parse the location from ProjectLocationAutoscalingPolicy resource.

Parameters:
Name Type Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the location.

matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName) → {string}

Parse the location from ProjectLocationWorkflowTemplate resource.

Parameters:
Name Type Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns:
Type Description
string

A string representing the location.

matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName) → {string}

Parse the project from ProjectLocationAutoscalingPolicy resource.

Parameters:
Name Type Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName) → {string}

Parse the project from ProjectLocationWorkflowTemplate resource.

Parameters:
Name Type Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName) → {string}

Parse the project from ProjectRegionAutoscalingPolicy resource.

Parameters:
Name Type Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName) → {string}

Parse the project from ProjectRegionWorkflowTemplate resource.

Parameters:
Name Type Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns:
Type Description
string

A string representing the project.

matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName) → {string}

Parse the region from ProjectRegionAutoscalingPolicy resource.

Parameters:
Name Type Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the region.

matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName) → {string}

Parse the region from ProjectRegionWorkflowTemplate resource.

Parameters:
Name Type Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns:
Type Description
string

A string representing the region.

matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName) → {string}

Parse the workflow_template from ProjectLocationWorkflowTemplate resource.

Parameters:
Name Type Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns:
Type Description
string

A string representing the workflow_template.

matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName) → {string}

Parse the workflow_template from ProjectRegionWorkflowTemplate resource.

Parameters:
Name Type Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns:
Type Description
string

A string representing the workflow_template.

projectLocationAutoscalingPolicyPath(project, location, autoscaling_policy) → {string}

Return a fully-qualified projectLocationAutoscalingPolicy resource name string.

Parameters:
Name Type Description
project string
location string
autoscaling_policy string
Returns:
Type Description
string

Resource name string.

projectLocationWorkflowTemplatePath(project, location, workflow_template) → {string}

Return a fully-qualified projectLocationWorkflowTemplate resource name string.

Parameters:
Name Type Description
project string
location string
workflow_template string
Returns:
Type Description
string

Resource name string.

projectRegionAutoscalingPolicyPath(project, region, autoscaling_policy) → {string}

Return a fully-qualified projectRegionAutoscalingPolicy resource name string.

Parameters:
Name Type Description
project string
region string
autoscaling_policy string
Returns:
Type Description
string

Resource name string.

projectRegionWorkflowTemplatePath(project, region, workflow_template) → {string}

Return a fully-qualified projectRegionWorkflowTemplate resource name string.

Parameters:
Name Type Description
project string
region string
workflow_template string
Returns:
Type Description
string

Resource name string.

submitJob(request, optionsopt) → {Promise}

Submits a job to a cluster.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

job google.cloud.dataproc.v1.Job

Required. The job resource.

requestId string <optional>

Optional. A unique id used to identify the request. If the server receives two SubmitJobRequests with the same id, then the second request will be ignored and the first Job created and stored in the backend is returned.

It is recommended to always set this value to a UUID.

The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Job. Please see the documentation for more details and examples.
Example
const [response] = await client.submitJob(request);

submitJobAsOperation(request, optionsopt) → {Promise}

Submits job to a cluster.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

job google.cloud.dataproc.v1.Job

Required. The job resource.

requestId string <optional>

Optional. A unique id used to identify the request. If the server receives two SubmitJobRequests with the same id, then the second request will be ignored and the first Job created and stored in the backend is returned.

It is recommended to always set this value to a UUID.

The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.
Example
const [operation] = await client.submitJobAsOperation(request);
const [response] = await operation.promise();

updateJob(request, optionsopt) → {Promise}

Updates a job in a project.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
projectId string

Required. The ID of the Google Cloud Platform project that the job belongs to.

region string

Required. The Dataproc region in which to handle the request.

jobId string

Required. The job ID.

job google.cloud.dataproc.v1.Job

Required. The changes to the job.

updateMask google.protobuf.FieldMask

Required. Specifies the path, relative to Job, of the field to update. For example, to update the labels of a Job the update_mask parameter would be specified as labels, and the PATCH request body would specify the new value. Note: Currently, labels is the only field that can be updated.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Job. Please see the documentation for more details and examples.
Example
const [response] = await client.updateJob(request);