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

Commit 495fbad

Browse files
feat: add AcceleratorConfig to ListAcceleratorTypesResponse (#220)
* docs: minor comment update PiperOrigin-RevId: 514872703 Source-Link: googleapis/googleapis@4c7bd62 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: googleapis/googleapis@08882cf 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 <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 0c352bc commit 495fbad

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

google/cloud/tpu_v2/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from .services.tpu import TpuAsyncClient, TpuClient
2222
from .types.cloud_tpu import (
23+
AcceleratorConfig,
2324
AcceleratorType,
2425
AccessConfig,
2526
AttachedDisk,
@@ -58,6 +59,7 @@
5859

5960
__all__ = (
6061
"TpuAsyncClient",
62+
"AcceleratorConfig",
6163
"AcceleratorType",
6264
"AccessConfig",
6365
"AttachedDisk",

google/cloud/tpu_v2/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
#
1616
from .cloud_tpu import (
17+
AcceleratorConfig,
1718
AcceleratorType,
1819
AccessConfig,
1920
AttachedDisk,
@@ -51,6 +52,7 @@
5152
)
5253

5354
__all__ = (
55+
"AcceleratorConfig",
5456
"AcceleratorType",
5557
"AccessConfig",
5658
"AttachedDisk",

google/cloud/tpu_v2/types/cloud_tpu.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"Symptom",
5858
"GetGuestAttributesRequest",
5959
"GetGuestAttributesResponse",
60+
"AcceleratorConfig",
6061
"ShieldedInstanceConfig",
6162
},
6263
)
@@ -379,6 +380,8 @@ class Node(proto.Message):
379380
to the TPU Node.
380381
shielded_instance_config (google.cloud.tpu_v2.types.ShieldedInstanceConfig):
381382
Shielded Instance options.
383+
accelerator_config (google.cloud.tpu_v2.types.AcceleratorConfig):
384+
The AccleratorConfig for the TPU Node.
382385
"""
383386

384387
class State(proto.Enum):
@@ -580,6 +583,11 @@ class ApiVersion(proto.Enum):
580583
number=45,
581584
message="ShieldedInstanceConfig",
582585
)
586+
accelerator_config: "AcceleratorConfig" = proto.Field(
587+
proto.MESSAGE,
588+
number=46,
589+
message="AcceleratorConfig",
590+
)
583591

584592

585593
class ListNodesRequest(proto.Message):
@@ -803,6 +811,8 @@ class AcceleratorType(proto.Message):
803811
The resource name.
804812
type_ (str):
805813
the accelerator type.
814+
accelerator_configs (MutableSequence[google.cloud.tpu_v2.types.AcceleratorConfig]):
815+
The accelerator config.
806816
"""
807817

808818
name: str = proto.Field(
@@ -813,6 +823,11 @@ class AcceleratorType(proto.Message):
813823
proto.STRING,
814824
number=2,
815825
)
826+
accelerator_configs: MutableSequence["AcceleratorConfig"] = proto.RepeatedField(
827+
proto.MESSAGE,
828+
number=3,
829+
message="AcceleratorConfig",
830+
)
816831

817832

818833
class GetAcceleratorTypeRequest(proto.Message):
@@ -1173,6 +1188,45 @@ class GetGuestAttributesResponse(proto.Message):
11731188
)
11741189

11751190

1191+
class AcceleratorConfig(proto.Message):
1192+
r"""A TPU accelerator configuration.
1193+
1194+
Attributes:
1195+
type_ (google.cloud.tpu_v2.types.AcceleratorConfig.Type):
1196+
Required. Type of TPU.
1197+
topology (str):
1198+
Required. Topology of TPU in chips.
1199+
"""
1200+
1201+
class Type(proto.Enum):
1202+
r"""TPU type.
1203+
1204+
Values:
1205+
TYPE_UNSPECIFIED (0):
1206+
Unspecified version.
1207+
V2 (2):
1208+
TPU v2.
1209+
V3 (4):
1210+
TPU v3.
1211+
V4 (7):
1212+
TPU v4.
1213+
"""
1214+
TYPE_UNSPECIFIED = 0
1215+
V2 = 2
1216+
V3 = 4
1217+
V4 = 7
1218+
1219+
type_: Type = proto.Field(
1220+
proto.ENUM,
1221+
number=1,
1222+
enum=Type,
1223+
)
1224+
topology: str = proto.Field(
1225+
proto.STRING,
1226+
number=2,
1227+
)
1228+
1229+
11761230
class ShieldedInstanceConfig(proto.Message):
11771231
r"""A set of Shielded Instance options.
11781232

google/cloud/tpu_v2alpha1/types/cloud_tpu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ class QueuedResource(proto.Message):
637637
The queueing policy of the QueuedRequest.
638638
state (google.cloud.tpu_v2alpha1.types.QueuedResourceState):
639639
Output only. State of the QueuedResource
640-
request
640+
request.
641641
"""
642642

643643
class Tpu(proto.Message):

tests/unit/gapic/tpu_v2/test_tpu.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4712,6 +4712,7 @@ def test_create_node_rest(request_type):
47124712
}
47134713
],
47144714
"shielded_instance_config": {"enable_secure_boot": True},
4715+
"accelerator_config": {"type_": 2, "topology": "topology_value"},
47154716
}
47164717
request = request_type(**request_init)
47174718

@@ -4934,6 +4935,7 @@ def test_create_node_rest_bad_request(
49344935
}
49354936
],
49364937
"shielded_instance_config": {"enable_secure_boot": True},
4938+
"accelerator_config": {"type_": 2, "topology": "topology_value"},
49374939
}
49384940
request = request_type(**request_init)
49394941

@@ -5735,6 +5737,7 @@ def test_update_node_rest(request_type):
57355737
}
57365738
],
57375739
"shielded_instance_config": {"enable_secure_boot": True},
5740+
"accelerator_config": {"type_": 2, "topology": "topology_value"},
57385741
}
57395742
request = request_type(**request_init)
57405743

@@ -5954,6 +5957,7 @@ def test_update_node_rest_bad_request(
59545957
}
59555958
],
59565959
"shielded_instance_config": {"enable_secure_boot": True},
5960+
"accelerator_config": {"type_": 2, "topology": "topology_value"},
59575961
}
59585962
request = request_type(**request_init)
59595963

0 commit comments

Comments
 (0)