Cloud Dataproc V1 API - Class Google::Cloud::Dataproc::V1::BatchController::Client (v0.11.0)

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

Client for the BatchController service.

The BatchController provides methods to manage batch workloads.

Inherits

  • Object

Methods

.configure

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

Configure the BatchController 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 BatchController clients
::Google::Cloud::Dataproc::V1::BatchController::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the BatchController 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

#create_batch

def create_batch(request, options = nil) -> ::Gapic::Operation
def create_batch(parent: nil, batch: nil, batch_id: nil, request_id: nil) -> ::Gapic::Operation

Creates a batch workload that executes asynchronously.

Overloads
def create_batch(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_batch via a request object, either of type CreateBatchRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::CreateBatchRequest, ::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 create_batch(parent: nil, batch: nil, batch_id: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to create_batch 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
  • parent (::String) — Required. The parent resource where this batch will be created.
  • batch (::Google::Cloud::Dataproc::V1::Batch, ::Hash) — Required. The batch to create.
  • batch_id (::String) — Optional. The ID to use for the batch, which will become the final component of the batch's resource name.

    This value must be 4-63 characters. Valid characters are /[a-z][0-9]-/.

  • request_id (::String) — Optional. A unique ID used to identify the request. If the service receives two CreateBatchRequests with the same request_id, the second request is ignored and the Operation that corresponds to the first Batch created and stored in the backend is returned.

    Recommendation: Set this value to a UUID.

    The value 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::BatchController::Client.new

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

# Call the create_batch method.
result = client.create_batch 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

#delete_batch

def delete_batch(request, options = nil) -> ::Google::Protobuf::Empty
def delete_batch(name: nil) -> ::Google::Protobuf::Empty

Deletes the batch workload resource. If the batch is not in terminal state, the delete fails and the response returns FAILED_PRECONDITION.

Overloads
def delete_batch(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_batch via a request object, either of type DeleteBatchRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::DeleteBatchRequest, ::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_batch(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_batch 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).
Parameter
  • name (::String) — Required. The name of the batch resource to delete.
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::BatchController::Client.new

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

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

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

#get_batch

def get_batch(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Batch
def get_batch(name: nil) -> ::Google::Cloud::Dataproc::V1::Batch

Gets the batch workload resource representation.

Overloads
def get_batch(request, options = nil) -> ::Google::Cloud::Dataproc::V1::Batch
Pass arguments to get_batch via a request object, either of type GetBatchRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::GetBatchRequest, ::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_batch(name: nil) -> ::Google::Cloud::Dataproc::V1::Batch
Pass arguments to get_batch 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).
Parameter
  • name (::String) — Required. The name of the batch to retrieve.
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::BatchController::Client.new

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

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

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

#initialize

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

Create a new BatchController client object.

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

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

#list_batches

def list_batches(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>
def list_batches(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>

Lists batch workloads.

Overloads
def list_batches(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>
Pass arguments to list_batches via a request object, either of type ListBatchesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::ListBatchesRequest, ::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_batches(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>
Pass arguments to list_batches 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
  • parent (::String) — Required. The parent, which owns this collection of batches.
  • page_size (::Integer) — Optional. The maximum number of batches to return in each response. The service may return fewer than this value. The default page size is 20; the maximum page size is 1000.
  • page_token (::String) — Optional. A page token received from a previous ListBatches call. Provide this token to retrieve the subsequent page.
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::BatchController::Client.new

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

# Call the list_batches method.
result = client.list_batches 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::Batch.
  p response
end

#operations_client

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

Get the associated client for long-running operations.