together 2.0.0a13__py3-none-any.whl → 2.0.0a15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- together/_client.py +38 -0
- together/_version.py +1 -1
- together/constants.py +34 -0
- together/error.py +16 -0
- together/lib/cli/api/beta/beta.py +12 -0
- together/lib/cli/api/beta/clusters.py +357 -0
- together/lib/cli/api/beta/clusters_storage.py +152 -0
- together/lib/cli/api/utils.py +41 -5
- together/lib/cli/cli.py +2 -0
- together/lib/types/fine_tuning.py +3 -0
- together/resources/__init__.py +14 -0
- together/resources/beta/__init__.py +33 -0
- together/resources/beta/beta.py +102 -0
- together/resources/beta/clusters/__init__.py +33 -0
- together/resources/beta/clusters/clusters.py +628 -0
- together/resources/beta/clusters/storage.py +490 -0
- together/types/__init__.py +12 -1
- together/types/beta/__init__.py +12 -0
- together/types/beta/cluster.py +93 -0
- together/types/beta/cluster_create_params.py +51 -0
- together/types/beta/cluster_create_response.py +9 -0
- together/types/beta/cluster_delete_response.py +9 -0
- together/types/beta/cluster_list_regions_response.py +21 -0
- together/types/beta/cluster_list_response.py +12 -0
- together/types/beta/cluster_update_params.py +13 -0
- together/types/beta/cluster_update_response.py +9 -0
- together/types/beta/clusters/__init__.py +10 -0
- together/types/beta/clusters/cluster_storage.py +13 -0
- together/types/beta/clusters/storage_create_params.py +17 -0
- together/types/beta/clusters/storage_create_response.py +9 -0
- together/types/beta/clusters/storage_delete_response.py +9 -0
- together/types/beta/clusters/storage_list_response.py +12 -0
- together/types/beta/clusters/storage_update_params.py +13 -0
- together/types/chat_completions.py +7 -0
- together/types/endpoints.py +4 -0
- together/types/files.py +8 -0
- together/types/fine_tuning_cancel_response.py +3 -0
- together/types/fine_tuning_list_response.py +3 -0
- together/types/finetune.py +27 -0
- together/types/finetune_response.py +2 -0
- together/types/models.py +2 -0
- {together-2.0.0a13.dist-info → together-2.0.0a15.dist-info}/METADATA +55 -8
- {together-2.0.0a13.dist-info → together-2.0.0a15.dist-info}/RECORD +46 -15
- {together-2.0.0a13.dist-info → together-2.0.0a15.dist-info}/WHEEL +0 -0
- {together-2.0.0a13.dist-info → together-2.0.0a15.dist-info}/entry_points.txt +0 -0
- {together-2.0.0a13.dist-info → together-2.0.0a15.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from .storage import (
|
|
10
|
+
StorageResource,
|
|
11
|
+
AsyncStorageResource,
|
|
12
|
+
StorageResourceWithRawResponse,
|
|
13
|
+
AsyncStorageResourceWithRawResponse,
|
|
14
|
+
StorageResourceWithStreamingResponse,
|
|
15
|
+
AsyncStorageResourceWithStreamingResponse,
|
|
16
|
+
)
|
|
17
|
+
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
18
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
19
|
+
from ...._compat import cached_property
|
|
20
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
21
|
+
from ...._response import (
|
|
22
|
+
to_raw_response_wrapper,
|
|
23
|
+
to_streamed_response_wrapper,
|
|
24
|
+
async_to_raw_response_wrapper,
|
|
25
|
+
async_to_streamed_response_wrapper,
|
|
26
|
+
)
|
|
27
|
+
from ....types.beta import cluster_create_params, cluster_update_params
|
|
28
|
+
from ...._base_client import make_request_options
|
|
29
|
+
from ....types.beta.cluster import Cluster
|
|
30
|
+
from ....types.beta.cluster_list_response import ClusterListResponse
|
|
31
|
+
from ....types.beta.cluster_create_response import ClusterCreateResponse
|
|
32
|
+
from ....types.beta.cluster_delete_response import ClusterDeleteResponse
|
|
33
|
+
from ....types.beta.cluster_update_response import ClusterUpdateResponse
|
|
34
|
+
from ....types.beta.cluster_list_regions_response import ClusterListRegionsResponse
|
|
35
|
+
|
|
36
|
+
__all__ = ["ClustersResource", "AsyncClustersResource"]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ClustersResource(SyncAPIResource):
|
|
40
|
+
@cached_property
|
|
41
|
+
def storage(self) -> StorageResource:
|
|
42
|
+
return StorageResource(self._client)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_raw_response(self) -> ClustersResourceWithRawResponse:
|
|
46
|
+
"""
|
|
47
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
48
|
+
the raw response object instead of the parsed content.
|
|
49
|
+
|
|
50
|
+
For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
|
|
51
|
+
"""
|
|
52
|
+
return ClustersResourceWithRawResponse(self)
|
|
53
|
+
|
|
54
|
+
@cached_property
|
|
55
|
+
def with_streaming_response(self) -> ClustersResourceWithStreamingResponse:
|
|
56
|
+
"""
|
|
57
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
58
|
+
|
|
59
|
+
For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
|
|
60
|
+
"""
|
|
61
|
+
return ClustersResourceWithStreamingResponse(self)
|
|
62
|
+
|
|
63
|
+
def create(
|
|
64
|
+
self,
|
|
65
|
+
*,
|
|
66
|
+
billing_type: Literal["RESERVED", "ON_DEMAND"],
|
|
67
|
+
cluster_name: str,
|
|
68
|
+
driver_version: Literal["CUDA_12_5_555", "CUDA_12_6_560", "CUDA_12_6_565", "CUDA_12_8_570"],
|
|
69
|
+
duration_days: int,
|
|
70
|
+
gpu_type: Literal["H100_SXM", "H200_SXM", "RTX_6000_PCI", "L40_PCIE", "B200_SXM", "H100_SXM_INF"],
|
|
71
|
+
num_gpus: int,
|
|
72
|
+
region: Literal["us-central-8", "us-central-4"],
|
|
73
|
+
cluster_type: Literal["KUBERNETES", "SLURM"] | Omit = omit,
|
|
74
|
+
shared_volume: cluster_create_params.SharedVolume | Omit = omit,
|
|
75
|
+
volume_id: str | Omit = omit,
|
|
76
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
77
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
78
|
+
extra_headers: Headers | None = None,
|
|
79
|
+
extra_query: Query | None = None,
|
|
80
|
+
extra_body: Body | None = None,
|
|
81
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
82
|
+
) -> ClusterCreateResponse:
|
|
83
|
+
"""
|
|
84
|
+
Create GPU Cluster
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
cluster_name: Name of the GPU cluster.
|
|
88
|
+
|
|
89
|
+
driver_version: NVIDIA driver version to use in the cluster.
|
|
90
|
+
|
|
91
|
+
duration_days: Duration in days to keep the cluster running.
|
|
92
|
+
|
|
93
|
+
gpu_type: Type of GPU to use in the cluster
|
|
94
|
+
|
|
95
|
+
num_gpus: Number of GPUs to allocate in the cluster. This must be multiple of 8. For
|
|
96
|
+
example, 8, 16 or 24
|
|
97
|
+
|
|
98
|
+
region: Region to create the GPU cluster in. Valid values are us-central-8 and
|
|
99
|
+
us-central-4.
|
|
100
|
+
|
|
101
|
+
extra_headers: Send extra headers
|
|
102
|
+
|
|
103
|
+
extra_query: Add additional query parameters to the request
|
|
104
|
+
|
|
105
|
+
extra_body: Add additional JSON properties to the request
|
|
106
|
+
|
|
107
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
108
|
+
"""
|
|
109
|
+
return self._post(
|
|
110
|
+
"/clusters",
|
|
111
|
+
body=maybe_transform(
|
|
112
|
+
{
|
|
113
|
+
"billing_type": billing_type,
|
|
114
|
+
"cluster_name": cluster_name,
|
|
115
|
+
"driver_version": driver_version,
|
|
116
|
+
"duration_days": duration_days,
|
|
117
|
+
"gpu_type": gpu_type,
|
|
118
|
+
"num_gpus": num_gpus,
|
|
119
|
+
"region": region,
|
|
120
|
+
"cluster_type": cluster_type,
|
|
121
|
+
"shared_volume": shared_volume,
|
|
122
|
+
"volume_id": volume_id,
|
|
123
|
+
},
|
|
124
|
+
cluster_create_params.ClusterCreateParams,
|
|
125
|
+
),
|
|
126
|
+
options=make_request_options(
|
|
127
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
128
|
+
),
|
|
129
|
+
cast_to=ClusterCreateResponse,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
def retrieve(
|
|
133
|
+
self,
|
|
134
|
+
cluster_id: str,
|
|
135
|
+
*,
|
|
136
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
137
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
138
|
+
extra_headers: Headers | None = None,
|
|
139
|
+
extra_query: Query | None = None,
|
|
140
|
+
extra_body: Body | None = None,
|
|
141
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
142
|
+
) -> Cluster:
|
|
143
|
+
"""
|
|
144
|
+
Get GPU cluster by cluster ID
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
extra_headers: Send extra headers
|
|
148
|
+
|
|
149
|
+
extra_query: Add additional query parameters to the request
|
|
150
|
+
|
|
151
|
+
extra_body: Add additional JSON properties to the request
|
|
152
|
+
|
|
153
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
154
|
+
"""
|
|
155
|
+
if not cluster_id:
|
|
156
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
157
|
+
return self._get(
|
|
158
|
+
f"/clusters/{cluster_id}",
|
|
159
|
+
options=make_request_options(
|
|
160
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
161
|
+
),
|
|
162
|
+
cast_to=Cluster,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def update(
|
|
166
|
+
self,
|
|
167
|
+
cluster_id: str,
|
|
168
|
+
*,
|
|
169
|
+
cluster_type: Literal["KUBERNETES", "SLURM"] | Omit = omit,
|
|
170
|
+
num_gpus: int | Omit = omit,
|
|
171
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
172
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
173
|
+
extra_headers: Headers | None = None,
|
|
174
|
+
extra_query: Query | None = None,
|
|
175
|
+
extra_body: Body | None = None,
|
|
176
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
177
|
+
) -> ClusterUpdateResponse:
|
|
178
|
+
"""
|
|
179
|
+
Update a GPU Cluster.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
extra_headers: Send extra headers
|
|
183
|
+
|
|
184
|
+
extra_query: Add additional query parameters to the request
|
|
185
|
+
|
|
186
|
+
extra_body: Add additional JSON properties to the request
|
|
187
|
+
|
|
188
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
189
|
+
"""
|
|
190
|
+
if not cluster_id:
|
|
191
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
192
|
+
return self._put(
|
|
193
|
+
f"/clusters/{cluster_id}",
|
|
194
|
+
body=maybe_transform(
|
|
195
|
+
{
|
|
196
|
+
"cluster_type": cluster_type,
|
|
197
|
+
"num_gpus": num_gpus,
|
|
198
|
+
},
|
|
199
|
+
cluster_update_params.ClusterUpdateParams,
|
|
200
|
+
),
|
|
201
|
+
options=make_request_options(
|
|
202
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
203
|
+
),
|
|
204
|
+
cast_to=ClusterUpdateResponse,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
def list(
|
|
208
|
+
self,
|
|
209
|
+
*,
|
|
210
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
211
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
212
|
+
extra_headers: Headers | None = None,
|
|
213
|
+
extra_query: Query | None = None,
|
|
214
|
+
extra_body: Body | None = None,
|
|
215
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
216
|
+
) -> ClusterListResponse:
|
|
217
|
+
"""List all GPU clusters."""
|
|
218
|
+
return self._get(
|
|
219
|
+
"/clusters",
|
|
220
|
+
options=make_request_options(
|
|
221
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
222
|
+
),
|
|
223
|
+
cast_to=ClusterListResponse,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
def delete(
|
|
227
|
+
self,
|
|
228
|
+
cluster_id: str,
|
|
229
|
+
*,
|
|
230
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
231
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
232
|
+
extra_headers: Headers | None = None,
|
|
233
|
+
extra_query: Query | None = None,
|
|
234
|
+
extra_body: Body | None = None,
|
|
235
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
236
|
+
) -> ClusterDeleteResponse:
|
|
237
|
+
"""
|
|
238
|
+
Delete GPU cluster by cluster ID
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
extra_headers: Send extra headers
|
|
242
|
+
|
|
243
|
+
extra_query: Add additional query parameters to the request
|
|
244
|
+
|
|
245
|
+
extra_body: Add additional JSON properties to the request
|
|
246
|
+
|
|
247
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
248
|
+
"""
|
|
249
|
+
if not cluster_id:
|
|
250
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
251
|
+
return self._delete(
|
|
252
|
+
f"/clusters/{cluster_id}",
|
|
253
|
+
options=make_request_options(
|
|
254
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
255
|
+
),
|
|
256
|
+
cast_to=ClusterDeleteResponse,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
def list_regions(
|
|
260
|
+
self,
|
|
261
|
+
*,
|
|
262
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
263
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
264
|
+
extra_headers: Headers | None = None,
|
|
265
|
+
extra_query: Query | None = None,
|
|
266
|
+
extra_body: Body | None = None,
|
|
267
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
268
|
+
) -> ClusterListRegionsResponse:
|
|
269
|
+
"""List regions and corresponding supported driver versions"""
|
|
270
|
+
return self._get(
|
|
271
|
+
"/clusters/regions",
|
|
272
|
+
options=make_request_options(
|
|
273
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
274
|
+
),
|
|
275
|
+
cast_to=ClusterListRegionsResponse,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class AsyncClustersResource(AsyncAPIResource):
|
|
280
|
+
@cached_property
|
|
281
|
+
def storage(self) -> AsyncStorageResource:
|
|
282
|
+
return AsyncStorageResource(self._client)
|
|
283
|
+
|
|
284
|
+
@cached_property
|
|
285
|
+
def with_raw_response(self) -> AsyncClustersResourceWithRawResponse:
|
|
286
|
+
"""
|
|
287
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
288
|
+
the raw response object instead of the parsed content.
|
|
289
|
+
|
|
290
|
+
For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
|
|
291
|
+
"""
|
|
292
|
+
return AsyncClustersResourceWithRawResponse(self)
|
|
293
|
+
|
|
294
|
+
@cached_property
|
|
295
|
+
def with_streaming_response(self) -> AsyncClustersResourceWithStreamingResponse:
|
|
296
|
+
"""
|
|
297
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
298
|
+
|
|
299
|
+
For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
|
|
300
|
+
"""
|
|
301
|
+
return AsyncClustersResourceWithStreamingResponse(self)
|
|
302
|
+
|
|
303
|
+
async def create(
|
|
304
|
+
self,
|
|
305
|
+
*,
|
|
306
|
+
billing_type: Literal["RESERVED", "ON_DEMAND"],
|
|
307
|
+
cluster_name: str,
|
|
308
|
+
driver_version: Literal["CUDA_12_5_555", "CUDA_12_6_560", "CUDA_12_6_565", "CUDA_12_8_570"],
|
|
309
|
+
duration_days: int,
|
|
310
|
+
gpu_type: Literal["H100_SXM", "H200_SXM", "RTX_6000_PCI", "L40_PCIE", "B200_SXM", "H100_SXM_INF"],
|
|
311
|
+
num_gpus: int,
|
|
312
|
+
region: Literal["us-central-8", "us-central-4"],
|
|
313
|
+
cluster_type: Literal["KUBERNETES", "SLURM"] | Omit = omit,
|
|
314
|
+
shared_volume: cluster_create_params.SharedVolume | Omit = omit,
|
|
315
|
+
volume_id: str | Omit = omit,
|
|
316
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
317
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
318
|
+
extra_headers: Headers | None = None,
|
|
319
|
+
extra_query: Query | None = None,
|
|
320
|
+
extra_body: Body | None = None,
|
|
321
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
322
|
+
) -> ClusterCreateResponse:
|
|
323
|
+
"""
|
|
324
|
+
Create GPU Cluster
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
cluster_name: Name of the GPU cluster.
|
|
328
|
+
|
|
329
|
+
driver_version: NVIDIA driver version to use in the cluster.
|
|
330
|
+
|
|
331
|
+
duration_days: Duration in days to keep the cluster running.
|
|
332
|
+
|
|
333
|
+
gpu_type: Type of GPU to use in the cluster
|
|
334
|
+
|
|
335
|
+
num_gpus: Number of GPUs to allocate in the cluster. This must be multiple of 8. For
|
|
336
|
+
example, 8, 16 or 24
|
|
337
|
+
|
|
338
|
+
region: Region to create the GPU cluster in. Valid values are us-central-8 and
|
|
339
|
+
us-central-4.
|
|
340
|
+
|
|
341
|
+
extra_headers: Send extra headers
|
|
342
|
+
|
|
343
|
+
extra_query: Add additional query parameters to the request
|
|
344
|
+
|
|
345
|
+
extra_body: Add additional JSON properties to the request
|
|
346
|
+
|
|
347
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
348
|
+
"""
|
|
349
|
+
return await self._post(
|
|
350
|
+
"/clusters",
|
|
351
|
+
body=await async_maybe_transform(
|
|
352
|
+
{
|
|
353
|
+
"billing_type": billing_type,
|
|
354
|
+
"cluster_name": cluster_name,
|
|
355
|
+
"driver_version": driver_version,
|
|
356
|
+
"duration_days": duration_days,
|
|
357
|
+
"gpu_type": gpu_type,
|
|
358
|
+
"num_gpus": num_gpus,
|
|
359
|
+
"region": region,
|
|
360
|
+
"cluster_type": cluster_type,
|
|
361
|
+
"shared_volume": shared_volume,
|
|
362
|
+
"volume_id": volume_id,
|
|
363
|
+
},
|
|
364
|
+
cluster_create_params.ClusterCreateParams,
|
|
365
|
+
),
|
|
366
|
+
options=make_request_options(
|
|
367
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
368
|
+
),
|
|
369
|
+
cast_to=ClusterCreateResponse,
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
async def retrieve(
|
|
373
|
+
self,
|
|
374
|
+
cluster_id: str,
|
|
375
|
+
*,
|
|
376
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
377
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
378
|
+
extra_headers: Headers | None = None,
|
|
379
|
+
extra_query: Query | None = None,
|
|
380
|
+
extra_body: Body | None = None,
|
|
381
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
382
|
+
) -> Cluster:
|
|
383
|
+
"""
|
|
384
|
+
Get GPU cluster by cluster ID
|
|
385
|
+
|
|
386
|
+
Args:
|
|
387
|
+
extra_headers: Send extra headers
|
|
388
|
+
|
|
389
|
+
extra_query: Add additional query parameters to the request
|
|
390
|
+
|
|
391
|
+
extra_body: Add additional JSON properties to the request
|
|
392
|
+
|
|
393
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
394
|
+
"""
|
|
395
|
+
if not cluster_id:
|
|
396
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
397
|
+
return await self._get(
|
|
398
|
+
f"/clusters/{cluster_id}",
|
|
399
|
+
options=make_request_options(
|
|
400
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
401
|
+
),
|
|
402
|
+
cast_to=Cluster,
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
async def update(
|
|
406
|
+
self,
|
|
407
|
+
cluster_id: str,
|
|
408
|
+
*,
|
|
409
|
+
cluster_type: Literal["KUBERNETES", "SLURM"] | Omit = omit,
|
|
410
|
+
num_gpus: int | Omit = omit,
|
|
411
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
412
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
413
|
+
extra_headers: Headers | None = None,
|
|
414
|
+
extra_query: Query | None = None,
|
|
415
|
+
extra_body: Body | None = None,
|
|
416
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
417
|
+
) -> ClusterUpdateResponse:
|
|
418
|
+
"""
|
|
419
|
+
Update a GPU Cluster.
|
|
420
|
+
|
|
421
|
+
Args:
|
|
422
|
+
extra_headers: Send extra headers
|
|
423
|
+
|
|
424
|
+
extra_query: Add additional query parameters to the request
|
|
425
|
+
|
|
426
|
+
extra_body: Add additional JSON properties to the request
|
|
427
|
+
|
|
428
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
429
|
+
"""
|
|
430
|
+
if not cluster_id:
|
|
431
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
432
|
+
return await self._put(
|
|
433
|
+
f"/clusters/{cluster_id}",
|
|
434
|
+
body=await async_maybe_transform(
|
|
435
|
+
{
|
|
436
|
+
"cluster_type": cluster_type,
|
|
437
|
+
"num_gpus": num_gpus,
|
|
438
|
+
},
|
|
439
|
+
cluster_update_params.ClusterUpdateParams,
|
|
440
|
+
),
|
|
441
|
+
options=make_request_options(
|
|
442
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
443
|
+
),
|
|
444
|
+
cast_to=ClusterUpdateResponse,
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
async def list(
|
|
448
|
+
self,
|
|
449
|
+
*,
|
|
450
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
451
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
452
|
+
extra_headers: Headers | None = None,
|
|
453
|
+
extra_query: Query | None = None,
|
|
454
|
+
extra_body: Body | None = None,
|
|
455
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
456
|
+
) -> ClusterListResponse:
|
|
457
|
+
"""List all GPU clusters."""
|
|
458
|
+
return await self._get(
|
|
459
|
+
"/clusters",
|
|
460
|
+
options=make_request_options(
|
|
461
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
462
|
+
),
|
|
463
|
+
cast_to=ClusterListResponse,
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
async def delete(
|
|
467
|
+
self,
|
|
468
|
+
cluster_id: str,
|
|
469
|
+
*,
|
|
470
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
471
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
472
|
+
extra_headers: Headers | None = None,
|
|
473
|
+
extra_query: Query | None = None,
|
|
474
|
+
extra_body: Body | None = None,
|
|
475
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
476
|
+
) -> ClusterDeleteResponse:
|
|
477
|
+
"""
|
|
478
|
+
Delete GPU cluster by cluster ID
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
extra_headers: Send extra headers
|
|
482
|
+
|
|
483
|
+
extra_query: Add additional query parameters to the request
|
|
484
|
+
|
|
485
|
+
extra_body: Add additional JSON properties to the request
|
|
486
|
+
|
|
487
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
488
|
+
"""
|
|
489
|
+
if not cluster_id:
|
|
490
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
491
|
+
return await self._delete(
|
|
492
|
+
f"/clusters/{cluster_id}",
|
|
493
|
+
options=make_request_options(
|
|
494
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
495
|
+
),
|
|
496
|
+
cast_to=ClusterDeleteResponse,
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
async def list_regions(
|
|
500
|
+
self,
|
|
501
|
+
*,
|
|
502
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
503
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
504
|
+
extra_headers: Headers | None = None,
|
|
505
|
+
extra_query: Query | None = None,
|
|
506
|
+
extra_body: Body | None = None,
|
|
507
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
508
|
+
) -> ClusterListRegionsResponse:
|
|
509
|
+
"""List regions and corresponding supported driver versions"""
|
|
510
|
+
return await self._get(
|
|
511
|
+
"/clusters/regions",
|
|
512
|
+
options=make_request_options(
|
|
513
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
514
|
+
),
|
|
515
|
+
cast_to=ClusterListRegionsResponse,
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
class ClustersResourceWithRawResponse:
|
|
520
|
+
def __init__(self, clusters: ClustersResource) -> None:
|
|
521
|
+
self._clusters = clusters
|
|
522
|
+
|
|
523
|
+
self.create = to_raw_response_wrapper(
|
|
524
|
+
clusters.create,
|
|
525
|
+
)
|
|
526
|
+
self.retrieve = to_raw_response_wrapper(
|
|
527
|
+
clusters.retrieve,
|
|
528
|
+
)
|
|
529
|
+
self.update = to_raw_response_wrapper(
|
|
530
|
+
clusters.update,
|
|
531
|
+
)
|
|
532
|
+
self.list = to_raw_response_wrapper(
|
|
533
|
+
clusters.list,
|
|
534
|
+
)
|
|
535
|
+
self.delete = to_raw_response_wrapper(
|
|
536
|
+
clusters.delete,
|
|
537
|
+
)
|
|
538
|
+
self.list_regions = to_raw_response_wrapper(
|
|
539
|
+
clusters.list_regions,
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
@cached_property
|
|
543
|
+
def storage(self) -> StorageResourceWithRawResponse:
|
|
544
|
+
return StorageResourceWithRawResponse(self._clusters.storage)
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
class AsyncClustersResourceWithRawResponse:
|
|
548
|
+
def __init__(self, clusters: AsyncClustersResource) -> None:
|
|
549
|
+
self._clusters = clusters
|
|
550
|
+
|
|
551
|
+
self.create = async_to_raw_response_wrapper(
|
|
552
|
+
clusters.create,
|
|
553
|
+
)
|
|
554
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
555
|
+
clusters.retrieve,
|
|
556
|
+
)
|
|
557
|
+
self.update = async_to_raw_response_wrapper(
|
|
558
|
+
clusters.update,
|
|
559
|
+
)
|
|
560
|
+
self.list = async_to_raw_response_wrapper(
|
|
561
|
+
clusters.list,
|
|
562
|
+
)
|
|
563
|
+
self.delete = async_to_raw_response_wrapper(
|
|
564
|
+
clusters.delete,
|
|
565
|
+
)
|
|
566
|
+
self.list_regions = async_to_raw_response_wrapper(
|
|
567
|
+
clusters.list_regions,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
@cached_property
|
|
571
|
+
def storage(self) -> AsyncStorageResourceWithRawResponse:
|
|
572
|
+
return AsyncStorageResourceWithRawResponse(self._clusters.storage)
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
class ClustersResourceWithStreamingResponse:
|
|
576
|
+
def __init__(self, clusters: ClustersResource) -> None:
|
|
577
|
+
self._clusters = clusters
|
|
578
|
+
|
|
579
|
+
self.create = to_streamed_response_wrapper(
|
|
580
|
+
clusters.create,
|
|
581
|
+
)
|
|
582
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
583
|
+
clusters.retrieve,
|
|
584
|
+
)
|
|
585
|
+
self.update = to_streamed_response_wrapper(
|
|
586
|
+
clusters.update,
|
|
587
|
+
)
|
|
588
|
+
self.list = to_streamed_response_wrapper(
|
|
589
|
+
clusters.list,
|
|
590
|
+
)
|
|
591
|
+
self.delete = to_streamed_response_wrapper(
|
|
592
|
+
clusters.delete,
|
|
593
|
+
)
|
|
594
|
+
self.list_regions = to_streamed_response_wrapper(
|
|
595
|
+
clusters.list_regions,
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
@cached_property
|
|
599
|
+
def storage(self) -> StorageResourceWithStreamingResponse:
|
|
600
|
+
return StorageResourceWithStreamingResponse(self._clusters.storage)
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
class AsyncClustersResourceWithStreamingResponse:
|
|
604
|
+
def __init__(self, clusters: AsyncClustersResource) -> None:
|
|
605
|
+
self._clusters = clusters
|
|
606
|
+
|
|
607
|
+
self.create = async_to_streamed_response_wrapper(
|
|
608
|
+
clusters.create,
|
|
609
|
+
)
|
|
610
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
611
|
+
clusters.retrieve,
|
|
612
|
+
)
|
|
613
|
+
self.update = async_to_streamed_response_wrapper(
|
|
614
|
+
clusters.update,
|
|
615
|
+
)
|
|
616
|
+
self.list = async_to_streamed_response_wrapper(
|
|
617
|
+
clusters.list,
|
|
618
|
+
)
|
|
619
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
620
|
+
clusters.delete,
|
|
621
|
+
)
|
|
622
|
+
self.list_regions = async_to_streamed_response_wrapper(
|
|
623
|
+
clusters.list_regions,
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
@cached_property
|
|
627
|
+
def storage(self) -> AsyncStorageResourceWithStreamingResponse:
|
|
628
|
+
return AsyncStorageResourceWithStreamingResponse(self._clusters.storage)
|