Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
docs: Add documentation for enums (#207)
Browse files Browse the repository at this point in the history
* docs: Add documentation for enums

fix: Add context manager return types

chore: Update gapic-generator-python to v1.8.1
PiperOrigin-RevId: 503210727

Source-Link: googleapis/googleapis@a391fd1

Source-Link: googleapis/googleapis-gen@0080f83
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jan 20, 2023
1 parent 6cafcac commit 3b28ff9
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 12 deletions.
2 changes: 1 addition & 1 deletion google/cloud/tpu_v1/services/tpu/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ def sample_get_accelerator_type():
# Done; return the response.
return response

def __enter__(self):
def __enter__(self) -> "TpuClient":
return self

def __exit__(self, type, value, traceback):
Expand Down
84 changes: 83 additions & 1 deletion google/cloud/tpu_v1/types/cloud_tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,42 @@ class Node(proto.Message):
class State(proto.Enum):
r"""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.
"""
STATE_UNSPECIFIED = 0
CREATING = 1
Expand All @@ -196,6 +232,23 @@ class State(proto.Enum):
class Health(proto.Enum):
r"""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.
DEPRECATED_UNHEALTHY (2):
The resource is unhealthy.
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.
"""
HEALTH_UNSPECIFIED = 0
HEALTHY = 1
Expand All @@ -205,7 +258,18 @@ class Health(proto.Enum):
UNHEALTHY_MAINTENANCE = 5

class ApiVersion(proto.Enum):
r"""TPU API Version."""
r"""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.
"""
API_VERSION_UNSPECIFIED = 0
V1_ALPHA1 = 1
V1 = 2
Expand Down Expand Up @@ -745,6 +809,24 @@ class Symptom(proto.Message):
class SymptomType(proto.Enum):
r"""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.
"""
SYMPTOM_TYPE_UNSPECIFIED = 0
LOW_MEMORY = 1
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/tpu_v2/services/tpu/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@ def sample_get_guest_attributes():
# Done; return the response.
return response

def __enter__(self):
def __enter__(self) -> "TpuClient":
return self

def __exit__(self, type, value, traceback):
Expand Down
99 changes: 97 additions & 2 deletions google/cloud/tpu_v2/types/cloud_tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,20 @@ class AttachedDisk(proto.Message):
"""

class DiskMode(proto.Enum):
r"""The different mode of the attached disk."""
r"""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.
"""
DISK_MODE_UNSPECIFIED = 0
READ_WRITE = 1
READ_ONLY = 2
Expand Down Expand Up @@ -369,6 +382,42 @@ class Node(proto.Message):
class State(proto.Enum):
r"""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.
"""
STATE_UNSPECIFIED = 0
CREATING = 1
Expand All @@ -389,6 +438,21 @@ class State(proto.Enum):
class Health(proto.Enum):
r"""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.
"""
HEALTH_UNSPECIFIED = 0
HEALTHY = 1
Expand All @@ -397,7 +461,20 @@ class Health(proto.Enum):
UNHEALTHY_MAINTENANCE = 5

class ApiVersion(proto.Enum):
r"""TPU API Version."""
r"""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.
"""
API_VERSION_UNSPECIFIED = 0
V1_ALPHA1 = 1
V1 = 2
Expand Down Expand Up @@ -1003,6 +1080,24 @@ class Symptom(proto.Message):
class SymptomType(proto.Enum):
r"""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.
"""
SYMPTOM_TYPE_UNSPECIFIED = 0
LOW_MEMORY = 1
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/tpu_v2alpha1/services/tpu/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,7 @@ def sample_simulate_maintenance_event():
# Done; return the response.
return response

def __enter__(self):
def __enter__(self) -> "TpuClient":
return self

def __exit__(self, type, value, traceback):
Expand Down
Loading

0 comments on commit 3b28ff9

Please sign in to comment.