Reference documentation and code samples for the Cloud TPU V1 API class Google::Cloud::Tpu::V1::Tpu::Client.
Client for the Tpu service.
Manages TPU nodes and other resources
TPU API v1
Inherits
- Object
Includes
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all Tpu clients ::Google::Cloud::Tpu::V1::Tpu::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::ConfigurationConfigure the Tpu 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)
#create_node
def create_node(request, options = nil) -> ::Gapic::Operation
def create_node(parent: nil, node_id: nil, node: nil) -> ::Gapic::OperationCreates a node.
def create_node(request, options = nil) -> ::Gapic::Operationcreate_node via a request object, either of type
CreateNodeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::CreateNodeRequest, ::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_node(parent: nil, node_id: nil, node: nil) -> ::Gapic::Operationcreate_node 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).
- parent (::String) — Required. The parent resource name.
- node_id (::String) — The unqualified resource name.
- node (::Google::Cloud::Tpu::V1::Node, ::Hash) — Required. The node.
- (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/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::CreateNodeRequest.new # Call the create_node method. result = client.create_node 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_node
def delete_node(request, options = nil) -> ::Gapic::Operation
def delete_node(name: nil) -> ::Gapic::OperationDeletes a node.
def delete_node(request, options = nil) -> ::Gapic::Operationdelete_node via a request object, either of type
DeleteNodeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::DeleteNodeRequest, ::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_node(name: nil) -> ::Gapic::Operationdelete_node 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).
- name (::String) — Required. The resource name.
- (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/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::DeleteNodeRequest.new # Call the delete_node method. result = client.delete_node 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
#get_accelerator_type
def get_accelerator_type(request, options = nil) -> ::Google::Cloud::Tpu::V1::AcceleratorType
def get_accelerator_type(name: nil) -> ::Google::Cloud::Tpu::V1::AcceleratorTypeGets AcceleratorType.
def get_accelerator_type(request, options = nil) -> ::Google::Cloud::Tpu::V1::AcceleratorTypeget_accelerator_type via a request object, either of type
GetAcceleratorTypeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::GetAcceleratorTypeRequest, ::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_accelerator_type(name: nil) -> ::Google::Cloud::Tpu::V1::AcceleratorTypeget_accelerator_type 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).
- name (::String) — Required. The resource name.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Tpu::V1::AcceleratorType)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::GetAcceleratorTypeRequest.new # Call the get_accelerator_type method. result = client.get_accelerator_type request # The returned object is of type Google::Cloud::Tpu::V1::AcceleratorType. p result
#get_node
def get_node(request, options = nil) -> ::Google::Cloud::Tpu::V1::Node
def get_node(name: nil) -> ::Google::Cloud::Tpu::V1::NodeGets the details of a node.
def get_node(request, options = nil) -> ::Google::Cloud::Tpu::V1::Nodeget_node via a request object, either of type
GetNodeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::GetNodeRequest, ::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_node(name: nil) -> ::Google::Cloud::Tpu::V1::Nodeget_node 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).
- name (::String) — Required. The resource name.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Tpu::V1::Node)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::GetNodeRequest.new # Call the get_node method. result = client.get_node request # The returned object is of type Google::Cloud::Tpu::V1::Node. p result
#get_tensor_flow_version
def get_tensor_flow_version(request, options = nil) -> ::Google::Cloud::Tpu::V1::TensorFlowVersion
def get_tensor_flow_version(name: nil) -> ::Google::Cloud::Tpu::V1::TensorFlowVersionGets TensorFlow Version.
def get_tensor_flow_version(request, options = nil) -> ::Google::Cloud::Tpu::V1::TensorFlowVersionget_tensor_flow_version via a request object, either of type
GetTensorFlowVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::GetTensorFlowVersionRequest, ::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_tensor_flow_version(name: nil) -> ::Google::Cloud::Tpu::V1::TensorFlowVersionget_tensor_flow_version 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).
- name (::String) — Required. The resource name.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Tpu::V1::TensorFlowVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::GetTensorFlowVersionRequest.new # Call the get_tensor_flow_version method. result = client.get_tensor_flow_version request # The returned object is of type Google::Cloud::Tpu::V1::TensorFlowVersion. p result
#initialize
def initialize() { |config| ... } -> ClientCreate a new Tpu client object.
- (config) — Configure the Tpu client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Tpu::V1::Tpu::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Tpu::V1::Tpu::Client.new do |config| config.timeout = 10.0 end
#list_accelerator_types
def list_accelerator_types(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>
def list_accelerator_types(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>Lists accelerator types supported by this API.
def list_accelerator_types(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>list_accelerator_types via a request object, either of type
ListAcceleratorTypesRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::ListAcceleratorTypesRequest, ::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_accelerator_types(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>list_accelerator_types 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).
- parent (::String) — Required. The parent resource name.
- page_size (::Integer) — The maximum number of items to return.
- page_token (::String) — The next_page_token value returned from a previous List request, if any.
- filter (::String) — List filter.
- order_by (::String) — Sort results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::AcceleratorType>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::ListAcceleratorTypesRequest.new # Call the list_accelerator_types method. result = client.list_accelerator_types 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::Tpu::V1::AcceleratorType. p item end
#list_nodes
def list_nodes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>
def list_nodes(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>Lists nodes.
def list_nodes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>list_nodes via a request object, either of type
ListNodesRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::ListNodesRequest, ::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_nodes(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>list_nodes 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).
- parent (::String) — Required. The parent resource name.
- page_size (::Integer) — The maximum number of items to return.
- page_token (::String) — The next_page_token value returned from a previous List request, if any.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::Node>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::ListNodesRequest.new # Call the list_nodes method. result = client.list_nodes 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::Tpu::V1::Node. p item end
#list_tensor_flow_versions
def list_tensor_flow_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>
def list_tensor_flow_versions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>List TensorFlow versions supported by this API.
def list_tensor_flow_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>list_tensor_flow_versions via a request object, either of type
ListTensorFlowVersionsRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::ListTensorFlowVersionsRequest, ::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_tensor_flow_versions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>list_tensor_flow_versions 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).
- parent (::String) — Required. The parent resource name.
- page_size (::Integer) — The maximum number of items to return.
- page_token (::String) — The next_page_token value returned from a previous List request, if any.
- filter (::String) — List filter.
- order_by (::String) — Sort results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Tpu::V1::TensorFlowVersion>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::ListTensorFlowVersionsRequest.new # Call the list_tensor_flow_versions method. result = client.list_tensor_flow_versions 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::Tpu::V1::TensorFlowVersion. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::ClientGet the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#logger
def logger() -> LoggerThe logger used for request/response debug logging.
- (Logger)
#operations_client
def operations_client() -> ::Google::Cloud::Tpu::V1::Tpu::OperationsGet the associated client for long-running operations.
#reimage_node
def reimage_node(request, options = nil) -> ::Gapic::Operation
def reimage_node(name: nil, tensorflow_version: nil) -> ::Gapic::OperationReimages a node's OS.
def reimage_node(request, options = nil) -> ::Gapic::Operationreimage_node via a request object, either of type
ReimageNodeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::ReimageNodeRequest, ::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 reimage_node(name: nil, tensorflow_version: nil) -> ::Gapic::Operationreimage_node 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).
- name (::String) — The resource name.
- tensorflow_version (::String) — The version for reimage to create.
- (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/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::ReimageNodeRequest.new # Call the reimage_node method. result = client.reimage_node 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
#start_node
def start_node(request, options = nil) -> ::Gapic::Operation
def start_node(name: nil) -> ::Gapic::OperationStarts a node.
def start_node(request, options = nil) -> ::Gapic::Operationstart_node via a request object, either of type
StartNodeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::StartNodeRequest, ::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 start_node(name: nil) -> ::Gapic::Operationstart_node 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).
- name (::String) — The resource name.
- (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/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::StartNodeRequest.new # Call the start_node method. result = client.start_node 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
#stop_node
def stop_node(request, options = nil) -> ::Gapic::Operation
def stop_node(name: nil) -> ::Gapic::OperationStops a node, this operation is only available with single TPU nodes.
def stop_node(request, options = nil) -> ::Gapic::Operationstop_node via a request object, either of type
StopNodeRequest or an equivalent Hash.
- request (::Google::Cloud::Tpu::V1::StopNodeRequest, ::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 stop_node(name: nil) -> ::Gapic::Operationstop_node 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).
- name (::String) — The resource name.
- (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/tpu/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tpu::V1::Tpu::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tpu::V1::StopNodeRequest.new # Call the stop_node method. result = client.stop_node 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
#universe_domain
def universe_domain() -> StringThe effective universe domain
- (String)