|
1 | 1 | from datetime import datetime |
2 | | -from typing import Annotated, List, Literal, Optional |
| 2 | +from typing import Annotated, List, Optional |
3 | 3 | from uuid import UUID |
4 | 4 |
|
5 | | -import gpuhunt |
6 | 5 | from pydantic import Field |
7 | 6 |
|
8 | | -from dstack._internal.core.models.backends.base import BackendType |
9 | 7 | from dstack._internal.core.models.common import CoreModel |
10 | | -from dstack._internal.core.models.instances import InstanceAvailability |
11 | | -from dstack._internal.core.models.resources import Range |
12 | 8 | from dstack._internal.core.models.runs import ApplyRunPlanInput, RunSpec |
13 | 9 |
|
14 | 10 |
|
@@ -68,57 +64,3 @@ class StopRunsRequest(CoreModel): |
68 | 64 |
|
69 | 65 | class DeleteRunsRequest(CoreModel): |
70 | 66 | runs_names: List[str] |
71 | | - |
72 | | - |
73 | | -class BackendGpu(CoreModel): |
74 | | - """GPU specification from a backend offer.""" |
75 | | - |
76 | | - name: str |
77 | | - memory_mib: int |
78 | | - vendor: gpuhunt.AcceleratorVendor |
79 | | - availability: InstanceAvailability |
80 | | - spot: bool |
81 | | - count: int |
82 | | - price: float |
83 | | - |
84 | | - |
85 | | -class BackendGpus(CoreModel): |
86 | | - """Backend GPU specifications.""" |
87 | | - |
88 | | - backend_type: BackendType |
89 | | - gpus: List[BackendGpu] |
90 | | - regions: List[str] |
91 | | - |
92 | | - |
93 | | -class GetRunGpusRequest(CoreModel): |
94 | | - """Request for getting run GPUs with optional grouping.""" |
95 | | - |
96 | | - run_spec: RunSpec |
97 | | - group_by: Optional[List[Literal["backend", "region", "count"]]] = Field( |
98 | | - default=None, |
99 | | - description="List of fields to group by. Valid values: 'backend', 'region', 'count'", |
100 | | - ) |
101 | | - |
102 | | - |
103 | | -class GpuGroup(CoreModel): |
104 | | - """GPU group that can handle all grouping scenarios.""" |
105 | | - |
106 | | - name: str |
107 | | - memory_mib: int |
108 | | - vendor: gpuhunt.AcceleratorVendor |
109 | | - availability: List[InstanceAvailability] |
110 | | - spot: List[Literal["spot", "on-demand"]] |
111 | | - count: Range[int] |
112 | | - price: Range[float] |
113 | | - backends: Optional[List[BackendType]] = None |
114 | | - backend: Optional[BackendType] = None |
115 | | - regions: Optional[List[str]] = None |
116 | | - region: Optional[str] = None |
117 | | - |
118 | | - |
119 | | -class RunGpusResponse(CoreModel): |
120 | | - """Response containing GPU specifications.""" |
121 | | - |
122 | | - gpus: List[GpuGroup] = Field( |
123 | | - description="List of GPU specifications, grouped according to the group_by parameter" |
124 | | - ) |
0 commit comments