From 44ab8c872be4d58bb8f5bfc3258ec5037fd12796 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 8 Mar 2023 05:42:06 -0500 Subject: [PATCH] feat: add AcceleratorConfig to ListAcceleratorTypesResponse (#220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: minor comment update PiperOrigin-RevId: 514872703 Source-Link: https://github.com/googleapis/googleapis/commit/4c7bd62ffcc787eafd4745dcbe4b691d1f32e1a3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b37df6f0f52c76b76a9dc20165c40444b736e3e6 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: https://github.com/googleapis/googleapis/commit/08882cfb3fb4047bc6804bf459afab04c7f5bc8e Source-Link: https://github.com/googleapis/googleapis-gen/commit/06dc5c5cf54242a1c8ed1386683e29234b764c2a 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 Co-authored-by: Anthonios Partheniou --- .../google/cloud/tpu_v2/__init__.py | 2 + .../google/cloud/tpu_v2/types/__init__.py | 2 + .../google/cloud/tpu_v2/types/cloud_tpu.py | 54 +++++++++++++++++++ .../cloud/tpu_v2alpha1/types/cloud_tpu.py | 2 +- .../tests/unit/gapic/tpu_v2/test_tpu.py | 4 ++ 5 files changed, 63 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-tpu/google/cloud/tpu_v2/__init__.py b/packages/google-cloud-tpu/google/cloud/tpu_v2/__init__.py index eedd3b941e97..67ebad73883b 100644 --- a/packages/google-cloud-tpu/google/cloud/tpu_v2/__init__.py +++ b/packages/google-cloud-tpu/google/cloud/tpu_v2/__init__.py @@ -20,6 +20,7 @@ from .services.tpu import TpuAsyncClient, TpuClient from .types.cloud_tpu import ( + AcceleratorConfig, AcceleratorType, AccessConfig, AttachedDisk, @@ -58,6 +59,7 @@ __all__ = ( "TpuAsyncClient", + "AcceleratorConfig", "AcceleratorType", "AccessConfig", "AttachedDisk", diff --git a/packages/google-cloud-tpu/google/cloud/tpu_v2/types/__init__.py b/packages/google-cloud-tpu/google/cloud/tpu_v2/types/__init__.py index da17d91de717..dd86a21b2c18 100644 --- a/packages/google-cloud-tpu/google/cloud/tpu_v2/types/__init__.py +++ b/packages/google-cloud-tpu/google/cloud/tpu_v2/types/__init__.py @@ -14,6 +14,7 @@ # limitations under the License. # from .cloud_tpu import ( + AcceleratorConfig, AcceleratorType, AccessConfig, AttachedDisk, @@ -51,6 +52,7 @@ ) __all__ = ( + "AcceleratorConfig", "AcceleratorType", "AccessConfig", "AttachedDisk", diff --git a/packages/google-cloud-tpu/google/cloud/tpu_v2/types/cloud_tpu.py b/packages/google-cloud-tpu/google/cloud/tpu_v2/types/cloud_tpu.py index da22ea58e0fd..d93a53fc8afc 100644 --- a/packages/google-cloud-tpu/google/cloud/tpu_v2/types/cloud_tpu.py +++ b/packages/google-cloud-tpu/google/cloud/tpu_v2/types/cloud_tpu.py @@ -57,6 +57,7 @@ "Symptom", "GetGuestAttributesRequest", "GetGuestAttributesResponse", + "AcceleratorConfig", "ShieldedInstanceConfig", }, ) @@ -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): @@ -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): @@ -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( @@ -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): @@ -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. diff --git a/packages/google-cloud-tpu/google/cloud/tpu_v2alpha1/types/cloud_tpu.py b/packages/google-cloud-tpu/google/cloud/tpu_v2alpha1/types/cloud_tpu.py index a52c227cb17a..204cc2a8e696 100644 --- a/packages/google-cloud-tpu/google/cloud/tpu_v2alpha1/types/cloud_tpu.py +++ b/packages/google-cloud-tpu/google/cloud/tpu_v2alpha1/types/cloud_tpu.py @@ -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): diff --git a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py index 179c5967907c..7253593e7fdc 100644 --- a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py +++ b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py @@ -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) @@ -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) @@ -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) @@ -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)