Skip to content

Commit

Permalink
feat: add AcceleratorConfig to ListAcceleratorTypesResponse (#220)
Browse files Browse the repository at this point in the history
* docs: minor comment update

PiperOrigin-RevId: 514872703

Source-Link: googleapis/googleapis@4c7bd62

Source-Link: googleapis/googleapis-gen@b37df6f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjM3ZGY2ZjBmNTJjNzZiNzZhOWRjMjAxNjVjNDA0NDRiNzM2ZTNlNiJ9

* 🦉 Updates from OwlBot post-processor

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

* feat: add AcceleratorConfig to ListAcceleratorTypesResponse

PiperOrigin-RevId: 514873293

Source-Link: googleapis/googleapis@08882cf

Source-Link: googleapis/googleapis-gen@06dc5c5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDZkYzVjNWNmNTQyNDJhMWM4ZWQxMzg2NjgzZTI5MjM0Yjc2NGMyYSJ9

* 🦉 Updates from OwlBot post-processor

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

* fix docs

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Mar 8, 2023
1 parent b78edb5 commit 44ab8c8
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/google-cloud-tpu/google/cloud/tpu_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from .services.tpu import TpuAsyncClient, TpuClient
from .types.cloud_tpu import (
AcceleratorConfig,
AcceleratorType,
AccessConfig,
AttachedDisk,
Expand Down Expand Up @@ -58,6 +59,7 @@

__all__ = (
"TpuAsyncClient",
"AcceleratorConfig",
"AcceleratorType",
"AccessConfig",
"AttachedDisk",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
#
from .cloud_tpu import (
AcceleratorConfig,
AcceleratorType,
AccessConfig,
AttachedDisk,
Expand Down Expand Up @@ -51,6 +52,7 @@
)

__all__ = (
"AcceleratorConfig",
"AcceleratorType",
"AccessConfig",
"AttachedDisk",
Expand Down
54 changes: 54 additions & 0 deletions packages/google-cloud-tpu/google/cloud/tpu_v2/types/cloud_tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"Symptom",
"GetGuestAttributesRequest",
"GetGuestAttributesResponse",
"AcceleratorConfig",
"ShieldedInstanceConfig",
},
)
Expand Down Expand Up @@ -379,6 +380,8 @@ class Node(proto.Message):
to the TPU Node.
shielded_instance_config (google.cloud.tpu_v2.types.ShieldedInstanceConfig):
Shielded Instance options.
accelerator_config (google.cloud.tpu_v2.types.AcceleratorConfig):
The AccleratorConfig for the TPU Node.
"""

class State(proto.Enum):
Expand Down Expand Up @@ -580,6 +583,11 @@ class ApiVersion(proto.Enum):
number=45,
message="ShieldedInstanceConfig",
)
accelerator_config: "AcceleratorConfig" = proto.Field(
proto.MESSAGE,
number=46,
message="AcceleratorConfig",
)


class ListNodesRequest(proto.Message):
Expand Down Expand Up @@ -803,6 +811,8 @@ class AcceleratorType(proto.Message):
The resource name.
type_ (str):
the accelerator type.
accelerator_configs (MutableSequence[google.cloud.tpu_v2.types.AcceleratorConfig]):
The accelerator config.
"""

name: str = proto.Field(
Expand All @@ -813,6 +823,11 @@ class AcceleratorType(proto.Message):
proto.STRING,
number=2,
)
accelerator_configs: MutableSequence["AcceleratorConfig"] = proto.RepeatedField(
proto.MESSAGE,
number=3,
message="AcceleratorConfig",
)


class GetAcceleratorTypeRequest(proto.Message):
Expand Down Expand Up @@ -1173,6 +1188,45 @@ class GetGuestAttributesResponse(proto.Message):
)


class AcceleratorConfig(proto.Message):
r"""A TPU accelerator configuration.
Attributes:
type_ (google.cloud.tpu_v2.types.AcceleratorConfig.Type):
Required. Type of TPU.
topology (str):
Required. Topology of TPU in chips.
"""

class Type(proto.Enum):
r"""TPU type.
Values:
TYPE_UNSPECIFIED (0):
Unspecified version.
V2 (2):
TPU v2.
V3 (4):
TPU v3.
V4 (7):
TPU v4.
"""
TYPE_UNSPECIFIED = 0
V2 = 2
V3 = 4
V4 = 7

type_: Type = proto.Field(
proto.ENUM,
number=1,
enum=Type,
)
topology: str = proto.Field(
proto.STRING,
number=2,
)


class ShieldedInstanceConfig(proto.Message):
r"""A set of Shielded Instance options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ class QueuedResource(proto.Message):
The queueing policy of the QueuedRequest.
state (google.cloud.tpu_v2alpha1.types.QueuedResourceState):
Output only. State of the QueuedResource
request
request.
"""

class Tpu(proto.Message):
Expand Down
4 changes: 4 additions & 0 deletions packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4712,6 +4712,7 @@ def test_create_node_rest(request_type):
}
],
"shielded_instance_config": {"enable_secure_boot": True},
"accelerator_config": {"type_": 2, "topology": "topology_value"},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -4934,6 +4935,7 @@ def test_create_node_rest_bad_request(
}
],
"shielded_instance_config": {"enable_secure_boot": True},
"accelerator_config": {"type_": 2, "topology": "topology_value"},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -5735,6 +5737,7 @@ def test_update_node_rest(request_type):
}
],
"shielded_instance_config": {"enable_secure_boot": True},
"accelerator_config": {"type_": 2, "topology": "topology_value"},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -5954,6 +5957,7 @@ def test_update_node_rest_bad_request(
}
],
"shielded_instance_config": {"enable_secure_boot": True},
"accelerator_config": {"type_": 2, "topology": "topology_value"},
}
request = request_type(**request_init)

Expand Down

0 comments on commit 44ab8c8

Please sign in to comment.