Skip to content

feat(instance): add GPU information in ServerType #901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/instance/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
from .types import VolumeServer
from .types import SnapshotBaseVolume
from .types import ServerTypeCapabilities
from .types import ServerTypeGPUInfo
from .types import ServerTypeNetwork
from .types import ServerTypeVolumeConstraintsByType
from .types import VolumeTypeCapabilities
Expand Down Expand Up @@ -253,6 +254,7 @@
"VolumeServer",
"SnapshotBaseVolume",
"ServerTypeCapabilities",
"ServerTypeGPUInfo",
"ServerTypeNetwork",
"ServerTypeVolumeConstraintsByType",
"VolumeTypeCapabilities",
Expand Down
38 changes: 34 additions & 4 deletions scaleway-async/scaleway_async/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
ServerTypeNetworkInterface,
ServerTypeVolumeConstraintSizes,
ServerTypeCapabilities,
ServerTypeGPUInfo,
ServerTypeNetwork,
ServerTypeVolumeConstraintsByType,
ServerType,
Expand Down Expand Up @@ -2060,6 +2061,29 @@ def unmarshal_ServerTypeCapabilities(data: Any) -> ServerTypeCapabilities:
return ServerTypeCapabilities(**args)


def unmarshal_ServerTypeGPUInfo(data: Any) -> ServerTypeGPUInfo:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'ServerTypeGPUInfo' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("gpu_manufacturer", None)
if field is not None:
args["gpu_manufacturer"] = field

field = data.get("gpu_name", None)
if field is not None:
args["gpu_name"] = field

field = data.get("gpu_memory", None)
if field is not None:
args["gpu_memory"] = field

return ServerTypeGPUInfo(**args)


def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -2152,10 +2176,6 @@ def unmarshal_ServerType(data: Any) -> ServerType:
if field is not None:
args["baremetal"] = field

field = data.get("end_of_service", None)
if field is not None:
args["end_of_service"] = field

field = data.get("per_volume_constraint", None)
if field is not None:
args["per_volume_constraint"] = unmarshal_ServerTypeVolumeConstraintsByType(
Expand All @@ -2176,6 +2196,16 @@ def unmarshal_ServerType(data: Any) -> ServerType:
else:
args["gpu"] = None

field = data.get("end_of_service", None)
if field is not None:
args["end_of_service"] = field

field = data.get("gpu_info", None)
if field is not None:
args["gpu_info"] = unmarshal_ServerTypeGPUInfo(field)
else:
args["gpu_info"] = None

field = data.get("network", None)
if field is not None:
args["network"] = unmarshal_ServerTypeNetwork(field)
Expand Down
33 changes: 28 additions & 5 deletions scaleway-async/scaleway_async/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,24 @@ class ServerTypeCapabilities:
"""


@dataclass
class ServerTypeGPUInfo:
gpu_manufacturer: str
"""
GPU manufacturer.
"""

gpu_name: str
"""
GPU model name.
"""

gpu_memory: int
"""
RAM of a single GPU, in bytes.
"""


@dataclass
class ServerTypeNetwork:
interfaces: List[ServerTypeNetworkInterface]
Expand Down Expand Up @@ -1342,11 +1360,6 @@ class ServerType:
True if it is a baremetal Instance.
"""

end_of_service: bool
"""
True if this Instance type has reached end of service.
"""

per_volume_constraint: Optional[ServerTypeVolumeConstraintsByType]
"""
Additional volume constraints.
Expand All @@ -1362,6 +1375,16 @@ class ServerType:
Number of GPU.
"""

end_of_service: bool
"""
True if this Instance type has reached end of service.
"""

gpu_info: Optional[ServerTypeGPUInfo]
"""
GPU information.
"""

network: Optional[ServerTypeNetwork]
"""
Network available for the Instance.
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/instance/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
from .types import VolumeServer
from .types import SnapshotBaseVolume
from .types import ServerTypeCapabilities
from .types import ServerTypeGPUInfo
from .types import ServerTypeNetwork
from .types import ServerTypeVolumeConstraintsByType
from .types import VolumeTypeCapabilities
Expand Down Expand Up @@ -253,6 +254,7 @@
"VolumeServer",
"SnapshotBaseVolume",
"ServerTypeCapabilities",
"ServerTypeGPUInfo",
"ServerTypeNetwork",
"ServerTypeVolumeConstraintsByType",
"VolumeTypeCapabilities",
Expand Down
38 changes: 34 additions & 4 deletions scaleway/scaleway/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
ServerTypeNetworkInterface,
ServerTypeVolumeConstraintSizes,
ServerTypeCapabilities,
ServerTypeGPUInfo,
ServerTypeNetwork,
ServerTypeVolumeConstraintsByType,
ServerType,
Expand Down Expand Up @@ -2060,6 +2061,29 @@ def unmarshal_ServerTypeCapabilities(data: Any) -> ServerTypeCapabilities:
return ServerTypeCapabilities(**args)


def unmarshal_ServerTypeGPUInfo(data: Any) -> ServerTypeGPUInfo:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'ServerTypeGPUInfo' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("gpu_manufacturer", None)
if field is not None:
args["gpu_manufacturer"] = field

field = data.get("gpu_name", None)
if field is not None:
args["gpu_name"] = field

field = data.get("gpu_memory", None)
if field is not None:
args["gpu_memory"] = field

return ServerTypeGPUInfo(**args)


def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -2152,10 +2176,6 @@ def unmarshal_ServerType(data: Any) -> ServerType:
if field is not None:
args["baremetal"] = field

field = data.get("end_of_service", None)
if field is not None:
args["end_of_service"] = field

field = data.get("per_volume_constraint", None)
if field is not None:
args["per_volume_constraint"] = unmarshal_ServerTypeVolumeConstraintsByType(
Expand All @@ -2176,6 +2196,16 @@ def unmarshal_ServerType(data: Any) -> ServerType:
else:
args["gpu"] = None

field = data.get("end_of_service", None)
if field is not None:
args["end_of_service"] = field

field = data.get("gpu_info", None)
if field is not None:
args["gpu_info"] = unmarshal_ServerTypeGPUInfo(field)
else:
args["gpu_info"] = None

field = data.get("network", None)
if field is not None:
args["network"] = unmarshal_ServerTypeNetwork(field)
Expand Down
33 changes: 28 additions & 5 deletions scaleway/scaleway/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,24 @@ class ServerTypeCapabilities:
"""


@dataclass
class ServerTypeGPUInfo:
gpu_manufacturer: str
"""
GPU manufacturer.
"""

gpu_name: str
"""
GPU model name.
"""

gpu_memory: int
"""
RAM of a single GPU, in bytes.
"""


@dataclass
class ServerTypeNetwork:
interfaces: List[ServerTypeNetworkInterface]
Expand Down Expand Up @@ -1342,11 +1360,6 @@ class ServerType:
True if it is a baremetal Instance.
"""

end_of_service: bool
"""
True if this Instance type has reached end of service.
"""

per_volume_constraint: Optional[ServerTypeVolumeConstraintsByType]
"""
Additional volume constraints.
Expand All @@ -1362,6 +1375,16 @@ class ServerType:
Number of GPU.
"""

end_of_service: bool
"""
True if this Instance type has reached end of service.
"""

gpu_info: Optional[ServerTypeGPUInfo]
"""
GPU information.
"""

network: Optional[ServerTypeNetwork]
"""
Network available for the Instance.
Expand Down