Cloud Dataproc V1 API - Class Google::Cloud::Dataproc::V1::BatchController::Client (v0.17.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 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

#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 fully qualified name of the batch to retrieve in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_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::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 fully qualified name of the batch to retrieve in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_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::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

#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 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, filter: nil, order_by: 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, filter: nil, order_by: 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.
  • filter (::String) — Optional. A filter for the batches to return in the response.

    A filter is a logical expression constraining the values of various fields in each batch resource. Filters are case sensitive, and may contain multiple clauses combined with logical operators (AND/OR). Supported fields are batch_id, batch_uuid, state, and create_time.

    e.g. state = RUNNING and create_time < "2023-01-01T00:00:00Z" filters for batches in state RUNNING that were created before 2023-01-01

    See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed description of the filter syntax and a list of supported comparisons.

  • order_by (::String) — Optional. Field(s) on which to sort the list of batches.

    Currently the only supported sort orders are unspecified (empty) and create_time desc to sort by most recently created batches first.

    See https://google.aip.dev/132#ordering for more details.

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 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::Batch.
  p item
end

#operations_client

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

Get the associated client for long-running operations.