Skip to content

Commit d45ba66

Browse files
authored
fix(apple_silicon): add missing servertype infos for PCU (#1257)
1 parent 0b0b9a2 commit d45ba66

File tree

6 files changed

+114
-0
lines changed

6 files changed

+114
-0
lines changed

scaleway-async/scaleway_async/applesilicon/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .types import ServerTypeDisk
1919
from .types import ServerTypeGPU
2020
from .types import ServerTypeMemory
21+
from .types import ServerTypeNPU
2122
from .types import ServerTypeNetwork
2223
from .types import BatchCreateServersRequestBatchInnerCreateServerRequest
2324
from .types import Server
@@ -74,6 +75,7 @@
7475
"ServerTypeDisk",
7576
"ServerTypeGPU",
7677
"ServerTypeMemory",
78+
"ServerTypeNPU",
7779
"ServerTypeNetwork",
7880
"BatchCreateServersRequestBatchInnerCreateServerRequest",
7981
"Server",

scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
ServerTypeDisk,
2020
ServerTypeGPU,
2121
ServerTypeMemory,
22+
ServerTypeNPU,
2223
ServerTypeNetwork,
2324
ServerType,
2425
BatchCreateServersResponse,
@@ -360,6 +361,18 @@ def unmarshal_ServerTypeCPU(data: Any) -> ServerTypeCPU:
360361
else:
361362
args["frequency"] = None
362363

364+
field = data.get("sockets", None)
365+
if field is not None:
366+
args["sockets"] = field
367+
else:
368+
args["sockets"] = None
369+
370+
field = data.get("threads_per_core", None)
371+
if field is not None:
372+
args["threads_per_core"] = field
373+
else:
374+
args["threads_per_core"] = None
375+
363376
return ServerTypeCPU(**args)
364377

365378

@@ -426,6 +439,23 @@ def unmarshal_ServerTypeMemory(data: Any) -> ServerTypeMemory:
426439
return ServerTypeMemory(**args)
427440

428441

442+
def unmarshal_ServerTypeNPU(data: Any) -> ServerTypeNPU:
443+
if not isinstance(data, dict):
444+
raise TypeError(
445+
"Unmarshalling the type 'ServerTypeNPU' failed as data isn't a dictionary."
446+
)
447+
448+
args: dict[str, Any] = {}
449+
450+
field = data.get("count", None)
451+
if field is not None:
452+
args["count"] = field
453+
else:
454+
args["count"] = None
455+
456+
return ServerTypeNPU(**args)
457+
458+
429459
def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
430460
if not isinstance(data, dict):
431461
raise TypeError(
@@ -446,6 +476,12 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
446476
else:
447477
args["supported_bandwidth"] = None
448478

479+
field = data.get("default_public_bandwidth", None)
480+
if field is not None:
481+
args["default_public_bandwidth"] = field
482+
else:
483+
args["default_public_bandwidth"] = None
484+
449485
return ServerTypeNetwork(**args)
450486

451487

@@ -511,6 +547,12 @@ def unmarshal_ServerType(data: Any) -> ServerType:
511547
else:
512548
args["default_os"] = None
513549

550+
field = data.get("npu", None)
551+
if field is not None:
552+
args["npu"] = unmarshal_ServerTypeNPU(field)
553+
else:
554+
args["npu"] = None
555+
514556
return ServerType(**args)
515557

516558

scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ class ServerTypeCPU:
168168
name: str
169169
core_count: int
170170
frequency: int
171+
sockets: int
172+
threads_per_core: int
171173

172174

173175
@dataclass
@@ -187,10 +189,16 @@ class ServerTypeMemory:
187189
type_: str
188190

189191

192+
@dataclass
193+
class ServerTypeNPU:
194+
count: int
195+
196+
190197
@dataclass
191198
class ServerTypeNetwork:
192199
public_bandwidth_bps: int
193200
supported_bandwidth: list[int]
201+
default_public_bandwidth: int
194202

195203

196204
@dataclass
@@ -411,6 +419,11 @@ class ServerType:
411419
The default OS for this server type.
412420
"""
413421

422+
npu: Optional[ServerTypeNPU] = None
423+
"""
424+
NPU description.
425+
"""
426+
414427

415428
@dataclass
416429
class CommitmentTypeValue:

scaleway/scaleway/applesilicon/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .types import ServerTypeDisk
1919
from .types import ServerTypeGPU
2020
from .types import ServerTypeMemory
21+
from .types import ServerTypeNPU
2122
from .types import ServerTypeNetwork
2223
from .types import BatchCreateServersRequestBatchInnerCreateServerRequest
2324
from .types import Server
@@ -74,6 +75,7 @@
7475
"ServerTypeDisk",
7576
"ServerTypeGPU",
7677
"ServerTypeMemory",
78+
"ServerTypeNPU",
7779
"ServerTypeNetwork",
7880
"BatchCreateServersRequestBatchInnerCreateServerRequest",
7981
"Server",

scaleway/scaleway/applesilicon/v1alpha1/marshalling.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
ServerTypeDisk,
2020
ServerTypeGPU,
2121
ServerTypeMemory,
22+
ServerTypeNPU,
2223
ServerTypeNetwork,
2324
ServerType,
2425
BatchCreateServersResponse,
@@ -360,6 +361,18 @@ def unmarshal_ServerTypeCPU(data: Any) -> ServerTypeCPU:
360361
else:
361362
args["frequency"] = None
362363

364+
field = data.get("sockets", None)
365+
if field is not None:
366+
args["sockets"] = field
367+
else:
368+
args["sockets"] = None
369+
370+
field = data.get("threads_per_core", None)
371+
if field is not None:
372+
args["threads_per_core"] = field
373+
else:
374+
args["threads_per_core"] = None
375+
363376
return ServerTypeCPU(**args)
364377

365378

@@ -426,6 +439,23 @@ def unmarshal_ServerTypeMemory(data: Any) -> ServerTypeMemory:
426439
return ServerTypeMemory(**args)
427440

428441

442+
def unmarshal_ServerTypeNPU(data: Any) -> ServerTypeNPU:
443+
if not isinstance(data, dict):
444+
raise TypeError(
445+
"Unmarshalling the type 'ServerTypeNPU' failed as data isn't a dictionary."
446+
)
447+
448+
args: dict[str, Any] = {}
449+
450+
field = data.get("count", None)
451+
if field is not None:
452+
args["count"] = field
453+
else:
454+
args["count"] = None
455+
456+
return ServerTypeNPU(**args)
457+
458+
429459
def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
430460
if not isinstance(data, dict):
431461
raise TypeError(
@@ -446,6 +476,12 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
446476
else:
447477
args["supported_bandwidth"] = None
448478

479+
field = data.get("default_public_bandwidth", None)
480+
if field is not None:
481+
args["default_public_bandwidth"] = field
482+
else:
483+
args["default_public_bandwidth"] = None
484+
449485
return ServerTypeNetwork(**args)
450486

451487

@@ -511,6 +547,12 @@ def unmarshal_ServerType(data: Any) -> ServerType:
511547
else:
512548
args["default_os"] = None
513549

550+
field = data.get("npu", None)
551+
if field is not None:
552+
args["npu"] = unmarshal_ServerTypeNPU(field)
553+
else:
554+
args["npu"] = None
555+
514556
return ServerType(**args)
515557

516558

scaleway/scaleway/applesilicon/v1alpha1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ class ServerTypeCPU:
168168
name: str
169169
core_count: int
170170
frequency: int
171+
sockets: int
172+
threads_per_core: int
171173

172174

173175
@dataclass
@@ -187,10 +189,16 @@ class ServerTypeMemory:
187189
type_: str
188190

189191

192+
@dataclass
193+
class ServerTypeNPU:
194+
count: int
195+
196+
190197
@dataclass
191198
class ServerTypeNetwork:
192199
public_bandwidth_bps: int
193200
supported_bandwidth: list[int]
201+
default_public_bandwidth: int
194202

195203

196204
@dataclass
@@ -411,6 +419,11 @@ class ServerType:
411419
The default OS for this server type.
412420
"""
413421

422+
npu: Optional[ServerTypeNPU] = None
423+
"""
424+
NPU description.
425+
"""
426+
414427

415428
@dataclass
416429
class CommitmentTypeValue:

0 commit comments

Comments
 (0)