As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Tpu v2 API

class google.cloud.tpu_v2.types.AcceleratorConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A TPU accelerator configuration.

type_

Required. Type of TPU.

Type

google.cloud.tpu_v2.types.AcceleratorConfig.Type

topology

Required. Topology of TPU in chips.

Type

str

class Type(value)[source]

Bases: proto.enums.Enum

TPU type.

Values:
TYPE_UNSPECIFIED (0):

Unspecified version.

V2 (2):

TPU v2.

V3 (4):

TPU v3.

V4 (7):

TPU v4.

class google.cloud.tpu_v2.types.AcceleratorType(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A accelerator type that a Node can be configured with.

name

The resource name.

Type

str

type_

The accelerator type.

Type

str

accelerator_configs

The accelerator config.

Type

MutableSequence[google.cloud.tpu_v2.types.AcceleratorConfig]

class google.cloud.tpu_v2.types.AccessConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

An access config attached to the TPU worker.

external_ip

Output only. An external IP address associated with the TPU worker.

Type

str

class google.cloud.tpu_v2.types.AttachedDisk(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

source_disk

Specifies the full path to an existing disk. For example: “projects/my-project/zones/us-central1-c/disks/my-disk”.

Type

str

mode

The mode in which to attach this disk. If not specified, the default is READ_WRITE mode. Only applicable to data_disks.

Type

google.cloud.tpu_v2.types.AttachedDisk.DiskMode

class DiskMode(value)[source]

Bases: proto.enums.Enum

The different mode of the attached disk.

Values:
DISK_MODE_UNSPECIFIED (0):

The disk mode is not known/set.

READ_WRITE (1):

Attaches the disk in read-write mode. Only one TPU node can attach a disk in read-write mode at a time.

READ_ONLY (2):

Attaches the disk in read-only mode. Multiple TPU nodes can attach a disk in read-only mode at a time.

class google.cloud.tpu_v2.types.CreateNodeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [CreateNode][google.cloud.tpu.v2.Tpu.CreateNode].

parent

Required. The parent resource name.

Type

str

node_id

The unqualified resource name.

Type

str

node

Required. The node.

Type

google.cloud.tpu_v2.types.Node

class google.cloud.tpu_v2.types.DeleteNodeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [DeleteNode][google.cloud.tpu.v2.Tpu.DeleteNode].

name

Required. The resource name.

Type

str

class google.cloud.tpu_v2.types.GenerateServiceIdentityRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].

parent

Required. The parent resource name.

Type

str

class google.cloud.tpu_v2.types.GenerateServiceIdentityResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].

identity

ServiceIdentity that was created or retrieved.

Type

google.cloud.tpu_v2.types.ServiceIdentity

class google.cloud.tpu_v2.types.GetAcceleratorTypeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [GetAcceleratorType][google.cloud.tpu.v2.Tpu.GetAcceleratorType].

name

Required. The resource name.

Type

str

class google.cloud.tpu_v2.types.GetGuestAttributesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes].

name

Required. The resource name.

Type

str

query_path

The guest attributes path to be queried.

Type

str

worker_ids

The 0-based worker ID. If it is empty, all workers’ GuestAttributes will be returned.

Type

MutableSequence[str]

class google.cloud.tpu_v2.types.GetGuestAttributesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes].

guest_attributes

The guest attributes for the TPU workers.

Type

MutableSequence[google.cloud.tpu_v2.types.GuestAttributes]

class google.cloud.tpu_v2.types.GetNodeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [GetNode][google.cloud.tpu.v2.Tpu.GetNode].

name

Required. The resource name.

Type

str

class google.cloud.tpu_v2.types.GetRuntimeVersionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [GetRuntimeVersion][google.cloud.tpu.v2.Tpu.GetRuntimeVersion].

name

Required. The resource name.

Type

str

class google.cloud.tpu_v2.types.GuestAttributes(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A guest attributes.

query_path

The path to be queried. This can be the default namespace (‘/’) or a nested namespace (‘/<namespace>/’) or a specified key (‘/<namespace>/<key>’)

Type

str

query_value

The value of the requested queried path.

Type

google.cloud.tpu_v2.types.GuestAttributesValue

class google.cloud.tpu_v2.types.GuestAttributesEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A guest attributes namespace/key/value entry.

namespace

Namespace for the guest attribute entry.

Type

str

key

Key for the guest attribute entry.

Type

str

value

Value for the guest attribute entry.

Type

str

class google.cloud.tpu_v2.types.GuestAttributesValue(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Array of guest attribute namespace/key/value tuples.

items

The list of guest attributes entries.

Type

MutableSequence[google.cloud.tpu_v2.types.GuestAttributesEntry]

class google.cloud.tpu_v2.types.ListAcceleratorTypesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].

parent

Required. The parent resource name.

Type

str

page_size

The maximum number of items to return.

Type

int

page_token

The next_page_token value returned from a previous List request, if any.

Type

str

filter

List filter.

Type

str

order_by

Sort results.

Type

str

class google.cloud.tpu_v2.types.ListAcceleratorTypesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].

accelerator_types

The listed nodes.

Type

MutableSequence[google.cloud.tpu_v2.types.AcceleratorType]

next_page_token

The next page token or empty if none.

Type

str

unreachable

Locations that could not be reached.

Type

MutableSequence[str]

class google.cloud.tpu_v2.types.ListNodesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [ListNodes][google.cloud.tpu.v2.Tpu.ListNodes].

parent

Required. The parent resource name.

Type

str

page_size

The maximum number of items to return.

Type

int

page_token

The next_page_token value returned from a previous List request, if any.

Type

str

class google.cloud.tpu_v2.types.ListNodesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for [ListNodes][google.cloud.tpu.v2.Tpu.ListNodes].

nodes

The listed nodes.

Type

MutableSequence[google.cloud.tpu_v2.types.Node]

next_page_token

The next page token or empty if none.

Type

str

unreachable

Locations that could not be reached.

Type

MutableSequence[str]

class google.cloud.tpu_v2.types.ListRuntimeVersionsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].

parent

Required. The parent resource name.

Type

str

page_size

The maximum number of items to return.

Type

int

page_token

The next_page_token value returned from a previous List request, if any.

Type

str

filter

List filter.

Type

str

order_by

Sort results.

Type

str

class google.cloud.tpu_v2.types.ListRuntimeVersionsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].

runtime_versions

The listed nodes.

Type

MutableSequence[google.cloud.tpu_v2.types.RuntimeVersion]

next_page_token

The next page token or empty if none.

Type

str

unreachable

Locations that could not be reached.

Type

MutableSequence[str]

class google.cloud.tpu_v2.types.NetworkConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Network related configurations.

network

The name of the network for the TPU node. It must be a preexisting Google Compute Engine network. If none is provided, “default” will be used.

Type

str

subnetwork

The name of the subnetwork for the TPU node. It must be a preexisting Google Compute Engine subnetwork. If none is provided, “default” will be used.

Type

str

enable_external_ips

Indicates that external IP addresses would be associated with the TPU workers. If set to false, the specified subnetwork or network should have Private Google Access enabled.

Type

bool

can_ip_forward

Allows the TPU node to send and receive packets with non-matching destination or source IPs. This is required if you plan to use the TPU workers to forward routes.

Type

bool

class google.cloud.tpu_v2.types.NetworkEndpoint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

ip_address

The internal IP address of this network endpoint.

Type

str

port

The port of this network endpoint.

Type

int

access_config

The access config for the TPU worker.

Type

google.cloud.tpu_v2.types.AccessConfig

class google.cloud.tpu_v2.types.Node(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A TPU instance.

name

Output only. Immutable. The name of the TPU.

Type

str

description

The user-supplied description of the TPU. Maximum of 512 characters.

Type

str

accelerator_type

Optional. The type of hardware accelerators associated with this node.

Type

str

state

Output only. The current state for the TPU Node.

Type

google.cloud.tpu_v2.types.Node.State

health_description

Output only. If this field is populated, it contains a description of why the TPU Node is unhealthy.

Type

str

runtime_version

Required. The runtime version running in the Node.

Type

str

network_config

Network configurations for the TPU node.

Type

google.cloud.tpu_v2.types.NetworkConfig

cidr_block

The CIDR block that the TPU node will use when selecting an IP address. This CIDR block must be a /29 block; the Compute Engine networks API forbids a smaller block, and using a larger block would be wasteful (a node can only consume one IP address). Errors will occur if the CIDR block has already been used for a currently existing TPU node, the CIDR block conflicts with any subnetworks in the user’s provided network, or the provided network is peered with another network that is using that CIDR block.

Type

str

service_account

The Google Cloud Platform Service Account to be used by the TPU node VMs. If None is specified, the default compute service account will be used.

Type

google.cloud.tpu_v2.types.ServiceAccount

create_time

Output only. The time when the node was created.

Type

google.protobuf.timestamp_pb2.Timestamp

scheduling_config

The scheduling options for this node.

Type

google.cloud.tpu_v2.types.SchedulingConfig

network_endpoints

Output only. The network endpoints where TPU workers can be accessed and sent work. It is recommended that runtime clients of the node reach out to the 0th entry in this map first.

Type

MutableSequence[google.cloud.tpu_v2.types.NetworkEndpoint]

health

The health status of the TPU node.

Type

google.cloud.tpu_v2.types.Node.Health

labels

Resource labels to represent user-provided metadata.

Type

MutableMapping[str, str]

metadata

Custom metadata to apply to the TPU Node. Can set startup-script and shutdown-script

Type

MutableMapping[str, str]

tags

Tags to apply to the TPU Node. Tags are used to identify valid sources or targets for network firewalls.

Type

MutableSequence[str]

id

Output only. The unique identifier for the TPU Node.

Type

int

data_disks

The additional data disks for the Node.

Type

MutableSequence[google.cloud.tpu_v2.types.AttachedDisk]

api_version

Output only. The API version that created this Node.

Type

google.cloud.tpu_v2.types.Node.ApiVersion

symptoms

Output only. The Symptoms that have occurred to the TPU Node.

Type

MutableSequence[google.cloud.tpu_v2.types.Symptom]

shielded_instance_config

Shielded Instance options.

Type

google.cloud.tpu_v2.types.ShieldedInstanceConfig

accelerator_config

The AccleratorConfig for the TPU Node.

Type

google.cloud.tpu_v2.types.AcceleratorConfig

queued_resource

Output only. The qualified name of the QueuedResource that requested this Node.

Type

str

multislice_node

Output only. Whether the Node belongs to a Multislice group.

Type

bool

class ApiVersion(value)[source]

Bases: proto.enums.Enum

TPU API Version.

Values:
API_VERSION_UNSPECIFIED (0):

API version is unknown.

V1_ALPHA1 (1):

TPU API V1Alpha1 version.

V1 (2):

TPU API V1 version.

V2_ALPHA1 (3):

TPU API V2Alpha1 version.

V2 (4):

TPU API V2 version.

class Health(value)[source]

Bases: proto.enums.Enum

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

Values:
HEALTH_UNSPECIFIED (0):

Health status is unknown: not initialized or failed to retrieve.

HEALTHY (1):

The resource is healthy.

TIMEOUT (3):

The resource is unresponsive.

UNHEALTHY_TENSORFLOW (4):

The in-guest ML stack is unhealthy.

UNHEALTHY_MAINTENANCE (5):

The node is under maintenance/priority boost caused rescheduling and will resume running once rescheduled.

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class MetadataEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class State(value)[source]

Bases: proto.enums.Enum

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

Values:
STATE_UNSPECIFIED (0):

TPU node state is not known/set.

CREATING (1):

TPU node is being created.

READY (2):

TPU node has been created.

RESTARTING (3):

TPU node is restarting.

REIMAGING (4):

TPU node is undergoing reimaging.

DELETING (5):

TPU node is being deleted.

REPAIRING (6):

TPU node is being repaired and may be unusable. Details can be found in the ‘help_description’ field.

STOPPED (8):

TPU node is stopped.

STOPPING (9):

TPU node is currently stopping.

STARTING (10):

TPU node is currently starting.

PREEMPTED (11):

TPU node has been preempted. Only applies to Preemptible TPU Nodes.

TERMINATED (12):

TPU node has been terminated due to maintenance or has reached the end of its life cycle (for preemptible nodes).

HIDING (13):

TPU node is currently hiding.

HIDDEN (14):

TPU node has been hidden.

UNHIDING (15):

TPU node is currently unhiding.

class google.cloud.tpu_v2.types.OperationMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata describing an [Operation][google.longrunning.Operation]

create_time

The time the operation was created.

Type

google.protobuf.timestamp_pb2.Timestamp

end_time

The time the operation finished running.

Type

google.protobuf.timestamp_pb2.Timestamp

target

Target of the operation - for example projects/project-1/connectivityTests/test-1

Type

str

verb

Name of the verb executed by the operation.

Type

str

status_detail

Human-readable status of the operation, if any.

Type

str

cancel_requested

Specifies if cancellation was requested for the operation.

Type

bool

api_version

API version.

Type

str

class google.cloud.tpu_v2.types.RuntimeVersion(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A runtime version that a Node can be configured with.

name

The resource name.

Type

str

version

The runtime version.

Type

str

class google.cloud.tpu_v2.types.SchedulingConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Sets the scheduling options for this node.

preemptible

Defines whether the node is preemptible.

Type

bool

reserved

Whether the node is created under a reservation.

Type

bool

class google.cloud.tpu_v2.types.ServiceAccount(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A service account.

email

Email address of the service account. If empty, default Compute service account will be used.

Type

str

scope

The list of scopes to be made available for this service account. If empty, access to all Cloud APIs will be allowed.

Type

MutableSequence[str]

class google.cloud.tpu_v2.types.ServiceIdentity(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

email

The email address of the service identity.

Type

str

class google.cloud.tpu_v2.types.ShieldedInstanceConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A set of Shielded Instance options.

enable_secure_boot

Defines whether the instance has Secure Boot enabled.

Type

bool

class google.cloud.tpu_v2.types.StartNodeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [StartNode][google.cloud.tpu.v2.Tpu.StartNode].

name

Required. The resource name.

Type

str

class google.cloud.tpu_v2.types.StopNodeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [StopNode][google.cloud.tpu.v2.Tpu.StopNode].

name

Required. The resource name.

Type

str

class google.cloud.tpu_v2.types.Symptom(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A Symptom instance.

create_time

Timestamp when the Symptom is created.

Type

google.protobuf.timestamp_pb2.Timestamp

symptom_type

Type of the Symptom.

Type

google.cloud.tpu_v2.types.Symptom.SymptomType

details

Detailed information of the current Symptom.

Type

str

worker_id

A string used to uniquely distinguish a worker within a TPU node.

Type

str

class SymptomType(value)[source]

Bases: proto.enums.Enum

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

Values:
SYMPTOM_TYPE_UNSPECIFIED (0):

Unspecified symptom.

LOW_MEMORY (1):

TPU VM memory is low.

OUT_OF_MEMORY (2):

TPU runtime is out of memory.

EXECUTE_TIMED_OUT (3):

TPU runtime execution has timed out.

MESH_BUILD_FAIL (4):

TPU runtime fails to construct a mesh that recognizes each TPU device’s neighbors.

HBM_OUT_OF_MEMORY (5):

TPU HBM is out of memory.

PROJECT_ABUSE (6):

Abusive behaviors have been identified on the current project.

class google.cloud.tpu_v2.types.UpdateNodeRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for [UpdateNode][google.cloud.tpu.v2.Tpu.UpdateNode].

update_mask

Required. Mask of fields from [Node][Tpu.Node] to update. Supported fields: [description, tags, labels, metadata, network_config.enable_external_ips].

Type

google.protobuf.field_mask_pb2.FieldMask

node

Required. The node. Only fields specified in update_mask are updated.

Type

google.cloud.tpu_v2.types.Node