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.
- (config) — Configure the Client client.
- config (Client::Configuration)
# 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.
def cancel_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
cancel_job
via a request object, either of type
CancelJobRequest or an equivalent Hash.
- 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
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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dataproc::V1::Job)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#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
.
def delete_job(request, options = nil) -> ::Google::Protobuf::Empty
delete_job
via a request object, either of type
DeleteJobRequest or an equivalent Hash.
- 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
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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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.
def get_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
get_job
via a request object, either of type
GetJobRequest or an equivalent Hash.
- 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
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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dataproc::V1::Job)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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
#initialize
def initialize() { |config| ... } -> Client
Create a new JobController client object.
- (config) — Configure the JobController client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# 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.
def list_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>
list_jobs
via a request object, either of type
ListJobsRequest or an equivalent Hash.
- 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>
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).
- 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
orlabels.[KEY]
, and[KEY]
is a label key. value can be*
to match all values.status.state
can be eitherACTIVE
orNON_ACTIVE
. Only the logicalAND
operator is supported; space-separated items are treated as having an implicitAND
operator.Example filter:
status.state = ACTIVE AND labels.env = staging AND labels.starred = *
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Dataproc::V1::Job. p response 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.
def submit_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
submit_job
via a request object, either of type
SubmitJobRequest or an equivalent Hash.
- 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
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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dataproc::V1::Job)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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.
def submit_job_as_operation(request, options = nil) -> ::Gapic::Operation
submit_job_as_operation
via a request object, either of type
SubmitJobRequest or an equivalent Hash.
- 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
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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" 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.
def update_job(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Job
update_job
via a request object, either of type
UpdateJobRequest or an equivalent Hash.
- 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
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).
- 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 theupdate_mask
parameter would be specified aslabels
, and thePATCH
request body would specify the new value. Note: Currently,labels
is the only field that can be updated.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dataproc::V1::Job)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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