Package com.google.cloud.tpu.v2 (2.17.0)

A client to Cloud TPU API

The interfaces provided are listed below, along with usage samples.

TpuClient

Service Description: Manages TPU nodes and other resources

TPU API v2

Sample for TpuClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TpuClient tpuClient = TpuClient.create()) {
   NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]");
   Node response = tpuClient.getNode(name);
 }
 

Classes

AcceleratorConfig

A TPU accelerator configuration.

Protobuf type google.cloud.tpu.v2.AcceleratorConfig

AcceleratorConfig.Builder

A TPU accelerator configuration.

Protobuf type google.cloud.tpu.v2.AcceleratorConfig

AcceleratorType

A accelerator type that a Node can be configured with.

Protobuf type google.cloud.tpu.v2.AcceleratorType

AcceleratorType.Builder

A accelerator type that a Node can be configured with.

Protobuf type google.cloud.tpu.v2.AcceleratorType

AcceleratorTypeName

AcceleratorTypeName.Builder

Builder for projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}.

AccessConfig

An access config attached to the TPU worker.

Protobuf type google.cloud.tpu.v2.AccessConfig

AccessConfig.Builder

An access config attached to the TPU worker.

Protobuf type google.cloud.tpu.v2.AccessConfig

AttachedDisk

A node-attached disk resource. Next ID: 8;

Protobuf type google.cloud.tpu.v2.AttachedDisk

AttachedDisk.Builder

A node-attached disk resource. Next ID: 8;

Protobuf type google.cloud.tpu.v2.AttachedDisk

CloudTpuProto

CreateNodeRequest

Request for CreateNode.

Protobuf type google.cloud.tpu.v2.CreateNodeRequest

CreateNodeRequest.Builder

Request for CreateNode.

Protobuf type google.cloud.tpu.v2.CreateNodeRequest

DeleteNodeRequest

Request for DeleteNode.

Protobuf type google.cloud.tpu.v2.DeleteNodeRequest

DeleteNodeRequest.Builder

Request for DeleteNode.

Protobuf type google.cloud.tpu.v2.DeleteNodeRequest

GenerateServiceIdentityRequest

Request for GenerateServiceIdentity.

Protobuf type google.cloud.tpu.v2.GenerateServiceIdentityRequest

GenerateServiceIdentityRequest.Builder

Request for GenerateServiceIdentity.

Protobuf type google.cloud.tpu.v2.GenerateServiceIdentityRequest

GenerateServiceIdentityResponse

Response for GenerateServiceIdentity.

Protobuf type google.cloud.tpu.v2.GenerateServiceIdentityResponse

GenerateServiceIdentityResponse.Builder

Response for GenerateServiceIdentity.

Protobuf type google.cloud.tpu.v2.GenerateServiceIdentityResponse

GetAcceleratorTypeRequest

Request for GetAcceleratorType.

Protobuf type google.cloud.tpu.v2.GetAcceleratorTypeRequest

GetAcceleratorTypeRequest.Builder

Request for GetAcceleratorType.

Protobuf type google.cloud.tpu.v2.GetAcceleratorTypeRequest

GetGuestAttributesRequest

Request for GetGuestAttributes.

Protobuf type google.cloud.tpu.v2.GetGuestAttributesRequest

GetGuestAttributesRequest.Builder

Request for GetGuestAttributes.

Protobuf type google.cloud.tpu.v2.GetGuestAttributesRequest

GetGuestAttributesResponse

Response for GetGuestAttributes.

Protobuf type google.cloud.tpu.v2.GetGuestAttributesResponse

GetGuestAttributesResponse.Builder

Response for GetGuestAttributes.

Protobuf type google.cloud.tpu.v2.GetGuestAttributesResponse

GetNodeRequest

Request for GetNode.

Protobuf type google.cloud.tpu.v2.GetNodeRequest

GetNodeRequest.Builder

Request for GetNode.

Protobuf type google.cloud.tpu.v2.GetNodeRequest

GetRuntimeVersionRequest

Request for GetRuntimeVersion.

Protobuf type google.cloud.tpu.v2.GetRuntimeVersionRequest

GetRuntimeVersionRequest.Builder

Request for GetRuntimeVersion.

Protobuf type google.cloud.tpu.v2.GetRuntimeVersionRequest

GuestAttributes

A guest attributes.

Protobuf type google.cloud.tpu.v2.GuestAttributes

GuestAttributes.Builder

A guest attributes.

Protobuf type google.cloud.tpu.v2.GuestAttributes

GuestAttributesEntry

A guest attributes namespace/key/value entry.

Protobuf type google.cloud.tpu.v2.GuestAttributesEntry

GuestAttributesEntry.Builder

A guest attributes namespace/key/value entry.

Protobuf type google.cloud.tpu.v2.GuestAttributesEntry

GuestAttributesValue

Array of guest attribute namespace/key/value tuples.

Protobuf type google.cloud.tpu.v2.GuestAttributesValue

GuestAttributesValue.Builder

Array of guest attribute namespace/key/value tuples.

Protobuf type google.cloud.tpu.v2.GuestAttributesValue

ListAcceleratorTypesRequest

Request for ListAcceleratorTypes.

Protobuf type google.cloud.tpu.v2.ListAcceleratorTypesRequest

ListAcceleratorTypesRequest.Builder

Request for ListAcceleratorTypes.

Protobuf type google.cloud.tpu.v2.ListAcceleratorTypesRequest

ListAcceleratorTypesResponse

Response for ListAcceleratorTypes.

Protobuf type google.cloud.tpu.v2.ListAcceleratorTypesResponse

ListAcceleratorTypesResponse.Builder

Response for ListAcceleratorTypes.

Protobuf type google.cloud.tpu.v2.ListAcceleratorTypesResponse

ListNodesRequest

Request for ListNodes.

Protobuf type google.cloud.tpu.v2.ListNodesRequest

ListNodesRequest.Builder

Request for ListNodes.

Protobuf type google.cloud.tpu.v2.ListNodesRequest

ListNodesResponse

Response for ListNodes.

Protobuf type google.cloud.tpu.v2.ListNodesResponse

ListNodesResponse.Builder

Response for ListNodes.

Protobuf type google.cloud.tpu.v2.ListNodesResponse

ListRuntimeVersionsRequest

Request for ListRuntimeVersions.

Protobuf type google.cloud.tpu.v2.ListRuntimeVersionsRequest

ListRuntimeVersionsRequest.Builder

Request for ListRuntimeVersions.

Protobuf type google.cloud.tpu.v2.ListRuntimeVersionsRequest

ListRuntimeVersionsResponse

Response for ListRuntimeVersions.

Protobuf type google.cloud.tpu.v2.ListRuntimeVersionsResponse

ListRuntimeVersionsResponse.Builder

Response for ListRuntimeVersions.

Protobuf type google.cloud.tpu.v2.ListRuntimeVersionsResponse

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

NetworkConfig

Network related configurations.

Protobuf type google.cloud.tpu.v2.NetworkConfig

NetworkConfig.Builder

Network related configurations.

Protobuf type google.cloud.tpu.v2.NetworkConfig

NetworkEndpoint

A network endpoint over which a TPU worker can be reached.

Protobuf type google.cloud.tpu.v2.NetworkEndpoint

NetworkEndpoint.Builder

A network endpoint over which a TPU worker can be reached.

Protobuf type google.cloud.tpu.v2.NetworkEndpoint

Node

A TPU instance.

Protobuf type google.cloud.tpu.v2.Node

Node.Builder

A TPU instance.

Protobuf type google.cloud.tpu.v2.Node

NodeName

NodeName.Builder

Builder for projects/{project}/locations/{location}/nodes/{node}.

OperationMetadata

Metadata describing an Operation

Protobuf type google.cloud.tpu.v2.OperationMetadata

OperationMetadata.Builder

Metadata describing an Operation

Protobuf type google.cloud.tpu.v2.OperationMetadata

RuntimeVersion

A runtime version that a Node can be configured with.

Protobuf type google.cloud.tpu.v2.RuntimeVersion

RuntimeVersion.Builder

A runtime version that a Node can be configured with.

Protobuf type google.cloud.tpu.v2.RuntimeVersion

RuntimeVersionName

RuntimeVersionName.Builder

Builder for projects/{project}/locations/{location}/runtimeVersions/{runtime_version}.

SchedulingConfig

Sets the scheduling options for this node.

Protobuf type google.cloud.tpu.v2.SchedulingConfig

SchedulingConfig.Builder

Sets the scheduling options for this node.

Protobuf type google.cloud.tpu.v2.SchedulingConfig

ServiceAccount

A service account.

Protobuf type google.cloud.tpu.v2.ServiceAccount

ServiceAccount.Builder

A service account.

Protobuf type google.cloud.tpu.v2.ServiceAccount

ServiceIdentity

The per-product per-project service identity for Cloud TPU service.

Protobuf type google.cloud.tpu.v2.ServiceIdentity

ServiceIdentity.Builder

The per-product per-project service identity for Cloud TPU service.

Protobuf type google.cloud.tpu.v2.ServiceIdentity

ShieldedInstanceConfig

A set of Shielded Instance options.

Protobuf type google.cloud.tpu.v2.ShieldedInstanceConfig

ShieldedInstanceConfig.Builder

A set of Shielded Instance options.

Protobuf type google.cloud.tpu.v2.ShieldedInstanceConfig

StartNodeRequest

Request for StartNode.

Protobuf type google.cloud.tpu.v2.StartNodeRequest

StartNodeRequest.Builder

Request for StartNode.

Protobuf type google.cloud.tpu.v2.StartNodeRequest

StopNodeRequest

Request for StopNode.

Protobuf type google.cloud.tpu.v2.StopNodeRequest

StopNodeRequest.Builder

Request for StopNode.

Protobuf type google.cloud.tpu.v2.StopNodeRequest

Symptom

A Symptom instance.

Protobuf type google.cloud.tpu.v2.Symptom

Symptom.Builder

A Symptom instance.

Protobuf type google.cloud.tpu.v2.Symptom

TpuClient

Service Description: Manages TPU nodes and other resources

TPU API v2

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TpuClient tpuClient = TpuClient.create()) {
   NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]");
   Node response = tpuClient.getNode(name);
 }
 

Note: close() needs to be called on the TpuClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of TpuSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TpuSettings tpuSettings =
     TpuSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 TpuClient tpuClient = TpuClient.create(tpuSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TpuSettings tpuSettings = TpuSettings.newBuilder().setEndpoint(myEndpoint).build();
 TpuClient tpuClient = TpuClient.create(tpuSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TpuSettings tpuSettings = TpuSettings.newHttpJsonBuilder().build();
 TpuClient tpuClient = TpuClient.create(tpuSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

TpuClient.ListAcceleratorTypesFixedSizeCollection

TpuClient.ListAcceleratorTypesPage

TpuClient.ListAcceleratorTypesPagedResponse

TpuClient.ListLocationsFixedSizeCollection

TpuClient.ListLocationsPage

TpuClient.ListLocationsPagedResponse

TpuClient.ListNodesFixedSizeCollection

TpuClient.ListNodesPage

TpuClient.ListNodesPagedResponse

TpuClient.ListRuntimeVersionsFixedSizeCollection

TpuClient.ListRuntimeVersionsPage

TpuClient.ListRuntimeVersionsPagedResponse

TpuGrpc

Manages TPU nodes and other resources TPU API v2

TpuGrpc.TpuBlockingStub

A stub to allow clients to do synchronous rpc calls to service Tpu.

Manages TPU nodes and other resources TPU API v2

TpuGrpc.TpuFutureStub

A stub to allow clients to do ListenableFuture-style rpc calls to service Tpu.

Manages TPU nodes and other resources TPU API v2

TpuGrpc.TpuImplBase

Base class for the server implementation of the service Tpu.

Manages TPU nodes and other resources TPU API v2

TpuGrpc.TpuStub

A stub to allow clients to do asynchronous rpc calls to service Tpu.

Manages TPU nodes and other resources TPU API v2

TpuSettings

Settings class to configure an instance of TpuClient.

The default instance has everything set to sensible defaults:

  • The default service address (tpu.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getNode to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TpuSettings.Builder tpuSettingsBuilder = TpuSettings.newBuilder();
 tpuSettingsBuilder
     .getNodeSettings()
     .setRetrySettings(
         tpuSettingsBuilder
             .getNodeSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 TpuSettings tpuSettings = tpuSettingsBuilder.build();
 

TpuSettings.Builder

Builder for TpuSettings.

UpdateNodeRequest

Request for UpdateNode.

Protobuf type google.cloud.tpu.v2.UpdateNodeRequest

UpdateNodeRequest.Builder

Request for UpdateNode.

Protobuf type google.cloud.tpu.v2.UpdateNodeRequest

Interfaces

AcceleratorConfigOrBuilder

AcceleratorTypeOrBuilder

AccessConfigOrBuilder

AttachedDiskOrBuilder

CreateNodeRequestOrBuilder

DeleteNodeRequestOrBuilder

GenerateServiceIdentityRequestOrBuilder

GenerateServiceIdentityResponseOrBuilder

GetAcceleratorTypeRequestOrBuilder

GetGuestAttributesRequestOrBuilder

GetGuestAttributesResponseOrBuilder

GetNodeRequestOrBuilder

GetRuntimeVersionRequestOrBuilder

GuestAttributesEntryOrBuilder

GuestAttributesOrBuilder

GuestAttributesValueOrBuilder

ListAcceleratorTypesRequestOrBuilder

ListAcceleratorTypesResponseOrBuilder

ListNodesRequestOrBuilder

ListNodesResponseOrBuilder

ListRuntimeVersionsRequestOrBuilder

ListRuntimeVersionsResponseOrBuilder

NetworkConfigOrBuilder

NetworkEndpointOrBuilder

NodeOrBuilder

OperationMetadataOrBuilder

RuntimeVersionOrBuilder

SchedulingConfigOrBuilder

ServiceAccountOrBuilder

ServiceIdentityOrBuilder

ShieldedInstanceConfigOrBuilder

StartNodeRequestOrBuilder

StopNodeRequestOrBuilder

SymptomOrBuilder

TpuGrpc.AsyncService

Manages TPU nodes and other resources TPU API v2

UpdateNodeRequestOrBuilder

Enums

AcceleratorConfig.Type

TPU type.

Protobuf enum google.cloud.tpu.v2.AcceleratorConfig.Type

AttachedDisk.DiskMode

The different mode of the attached disk.

Protobuf enum google.cloud.tpu.v2.AttachedDisk.DiskMode

Node.ApiVersion

TPU API Version.

Protobuf enum google.cloud.tpu.v2.Node.ApiVersion

Node.Health

Health defines the status of a TPU node as reported by Health Monitor.

Protobuf enum google.cloud.tpu.v2.Node.Health

Node.State

Represents the different states of a TPU node during its lifecycle.

Protobuf enum google.cloud.tpu.v2.Node.State

Symptom.SymptomType

SymptomType represents the different types of Symptoms that a TPU can be at.

Protobuf enum google.cloud.tpu.v2.Symptom.SymptomType