Cloud Dataproc V1 API - Class Google::Cloud::Dataproc::V1::JobController::Client (v0.18.1)

Reference documentation and code samples for the Cloud Dataproc V1 API class Google::Cloud::Dataproc::V1::JobController::Client.

Client for the JobController service.

The JobController provides methods to manage jobs.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the JobController Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all JobController clients
::Google::Cloud::Dataproc::V1::JobController::Client.configure do |config|
  config.timeout = 10.0
end

#cancel_job

def cancel_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
def cancel_job(project_id: nil, region: nil, job_id: nil) -> ::Google::Cloud::Dataproc::V1::Job

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

Overloads
def cancel_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to cancel_job via a request object, either of type CancelJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::CancelJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def cancel_job(project_id: nil, region: nil, job_id: nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to cancel_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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_id (::String) — Required. The job ID.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::CancelJobRequest.new

# Call the cancel_job method.
result = client.cancel_job request

# The returned object is of type Google::Cloud::Dataproc::V1::Job.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the JobController Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#delete_job

def delete_job(request, options = nil) -> ::Google::Protobuf::Empty
def delete_job(project_id: nil, region: nil, job_id: nil) -> ::Google::Protobuf::Empty

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

Overloads
def delete_job(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_job via a request object, either of type DeleteJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::DeleteJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_job(project_id: nil, region: nil, job_id: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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_id (::String) — Required. The job ID.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::DeleteJobRequest.new

# Call the delete_job method.
result = client.delete_job request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_job

def get_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
def get_job(project_id: nil, region: nil, job_id: nil) -> ::Google::Cloud::Dataproc::V1::Job

Gets the resource representation for a job in a project.

Overloads
def get_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to get_job via a request object, either of type GetJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::GetJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_job(project_id: nil, region: nil, job_id: nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to get_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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_id (::String) — Required. The job ID.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::GetJobRequest.new

# Call the get_job method.
result = client.get_job request

# The returned object is of type Google::Cloud::Dataproc::V1::Job.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Client)

#initialize

def initialize() { |config| ... } -> Client

Create a new JobController client object.

Yields
  • (config) — Configure the JobController client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Dataproc::V1::JobController::Client.new do |config|
  config.timeout = 10.0
end

#list_jobs

def list_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>
def list_jobs(project_id: nil, region: nil, page_size: nil, page_token: nil, cluster_name: nil, job_state_matcher: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>

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

Overloads
def list_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>
Pass arguments to list_jobs via a request object, either of type ListJobsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::ListJobsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_jobs(project_id: nil, region: nil, page_size: nil, page_token: nil, cluster_name: nil, job_state_matcher: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>
Pass arguments to list_jobs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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.
  • page_size (::Integer) — Optional. The number of results to return in each response.
  • page_token (::String) — Optional. The page token, returned by a previous call, to request the next page of results.
  • cluster_name (::String) — Optional. If set, the returned jobs list includes only jobs that were submitted to the named cluster.
  • job_state_matcher (::Google::Cloud::Dataproc::V1::ListJobsRequest::JobStateMatcher) — Optional. Specifies enumerated categories of jobs to list. (default = match ALL jobs).

    If filter is provided, jobStateMatcher will be ignored.

  • filter (::String) — 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 = *

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::ListJobsRequest.new

# Call the list_jobs method.
result = client.list_jobs request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Dataproc::V1::Job.
  p item
end

#operations_client

def operations_client() -> ::Google::Cloud::Dataproc::V1::JobController::Operations

Get the associated client for long-running operations.

#submit_job

def submit_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
def submit_job(project_id: nil, region: nil, job: nil, request_id: nil) -> ::Google::Cloud::Dataproc::V1::Job

Submits a job to a cluster.

Overloads
def submit_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to submit_job via a request object, either of type SubmitJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::SubmitJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def submit_job(project_id: nil, region: nil, job: nil, request_id: nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to submit_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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, ::Hash) — Required. The job resource.
  • request_id (::String) — 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.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::SubmitJobRequest.new

# Call the submit_job method.
result = client.submit_job request

# The returned object is of type Google::Cloud::Dataproc::V1::Job.
p result

#submit_job_as_operation

def submit_job_as_operation(request, options = nil) -> ::Gapic::Operation
def submit_job_as_operation(project_id: nil, region: nil, job: nil, request_id: nil) -> ::Gapic::Operation

Submits job to a cluster.

Overloads
def submit_job_as_operation(request, options = nil) -> ::Gapic::Operation
Pass arguments to submit_job_as_operation via a request object, either of type SubmitJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::SubmitJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def submit_job_as_operation(project_id: nil, region: nil, job: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to submit_job_as_operation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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, ::Hash) — Required. The job resource.
  • request_id (::String) — 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.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::SubmitJobRequest.new

# Call the submit_job_as_operation method.
result = client.submit_job_as_operation request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#update_job

def update_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
def update_job(project_id: nil, region: nil, job_id: nil, job: nil, update_mask: nil) -> ::Google::Cloud::Dataproc::V1::Job

Updates a job in a project.

Overloads
def update_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to update_job via a request object, either of type UpdateJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::UpdateJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_job(project_id: nil, region: nil, job_id: nil, job: nil, update_mask: nil) -> ::Google::Cloud::Dataproc::V1::Job
Pass arguments to update_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • project_id (::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_id (::String) — Required. The job ID.
  • job (::Google::Cloud::Dataproc::V1::Job, ::Hash) — Required. The changes to the job.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::JobController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::UpdateJobRequest.new

# Call the update_job method.
result = client.update_job request

# The returned object is of type Google::Cloud::Dataproc::V1::Job.
p result