verda 1.18.0__tar.gz → 1.20.0__tar.gz
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.
- {verda-1.18.0 → verda-1.20.0}/PKG-INFO +1 -1
- {verda-1.18.0 → verda-1.20.0}/pyproject.toml +1 -1
- {verda-1.18.0 → verda-1.20.0}/verda/clusters/_clusters.py +22 -1
- verda-1.20.0/verda/instances/__init__.py +8 -0
- {verda-1.18.0 → verda-1.20.0}/verda/instances/_instances.py +36 -4
- verda-1.18.0/verda/instances/__init__.py +0 -1
- {verda-1.18.0 → verda-1.20.0}/README.md +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/_verda.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/_version.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/authentication/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/authentication/_authentication.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/balance/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/balance/_balance.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/clusters/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/constants.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/containers/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/containers/_containers.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/exceptions.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/helpers.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/http_client/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/http_client/_http_client.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/images/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/images/_images.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/inference_client/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/inference_client/_inference_client.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/instance_types/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/instance_types/_instance_types.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/locations/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/locations/_locations.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/ssh_keys/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/ssh_keys/_ssh_keys.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/startup_scripts/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/startup_scripts/_startup_scripts.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/volume_types/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/volume_types/_volume_types.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/volumes/__init__.py +0 -0
- {verda-1.18.0 → verda-1.20.0}/verda/volumes/_volumes.py +0 -0
|
@@ -6,6 +6,7 @@ from dataclasses_json import dataclass_json
|
|
|
6
6
|
|
|
7
7
|
from verda.constants import Actions, ClusterStatus, ErrorCodes, Locations
|
|
8
8
|
from verda.exceptions import APIException
|
|
9
|
+
from verda.http_client import HTTPClient
|
|
9
10
|
|
|
10
11
|
CLUSTERS_ENDPOINT = '/clusters'
|
|
11
12
|
|
|
@@ -31,6 +32,24 @@ class ClusterWorkerNode:
|
|
|
31
32
|
private_ip: str
|
|
32
33
|
|
|
33
34
|
|
|
35
|
+
@dataclass_json
|
|
36
|
+
@dataclass
|
|
37
|
+
class SharedVolume:
|
|
38
|
+
"""Represents a shared volume in a cluster.
|
|
39
|
+
|
|
40
|
+
Attributes:
|
|
41
|
+
id: Unique identifier for the volume.
|
|
42
|
+
name: Name of the volume.
|
|
43
|
+
size_in_gigabytes: Size of the volume in gigabytes.
|
|
44
|
+
mount_point: Mount point of the volume.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
id: str
|
|
48
|
+
name: str
|
|
49
|
+
size_in_gigabytes: int
|
|
50
|
+
mount_point: str | None = None
|
|
51
|
+
|
|
52
|
+
|
|
34
53
|
@dataclass_json
|
|
35
54
|
@dataclass
|
|
36
55
|
class Cluster:
|
|
@@ -59,7 +78,9 @@ class Cluster:
|
|
|
59
78
|
location: str
|
|
60
79
|
cluster_type: str
|
|
61
80
|
worker_nodes: list[ClusterWorkerNode]
|
|
81
|
+
shared_volumes: list[SharedVolume]
|
|
62
82
|
ssh_key_ids: list[str]
|
|
83
|
+
|
|
63
84
|
image: str | None = None
|
|
64
85
|
startup_script_id: str | None = None
|
|
65
86
|
ip: str | None = None
|
|
@@ -71,7 +92,7 @@ class ClustersService:
|
|
|
71
92
|
This service provides methods to create, retrieve, and manage compute clusters.
|
|
72
93
|
"""
|
|
73
94
|
|
|
74
|
-
def __init__(self, http_client) -> None:
|
|
95
|
+
def __init__(self, http_client: HTTPClient) -> None:
|
|
75
96
|
"""Initializes the ClustersService with an HTTP client.
|
|
76
97
|
|
|
77
98
|
Args:
|
|
@@ -3,7 +3,7 @@ import time
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Literal
|
|
5
5
|
|
|
6
|
-
from dataclasses_json import dataclass_json
|
|
6
|
+
from dataclasses_json import Undefined, dataclass_json
|
|
7
7
|
|
|
8
8
|
from verda.constants import InstanceStatus, Locations
|
|
9
9
|
|
|
@@ -11,6 +11,27 @@ INSTANCES_ENDPOINT = '/instances'
|
|
|
11
11
|
|
|
12
12
|
Contract = Literal['LONG_TERM', 'PAY_AS_YOU_GO', 'SPOT']
|
|
13
13
|
Pricing = Literal['DYNAMIC_PRICE', 'FIXED_PRICE']
|
|
14
|
+
OnSpotDiscontinue = Literal['keep_detached', 'move_to_trash', 'delete_permanently']
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass_json(undefined=Undefined.EXCLUDE)
|
|
18
|
+
@dataclass
|
|
19
|
+
class OSVolume:
|
|
20
|
+
"""Represents an operating system volume.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
name: Name of the volume.
|
|
24
|
+
size: Size of the volume in GB.
|
|
25
|
+
on_spot_discontinue: What to do with the volume on spot discontinue.
|
|
26
|
+
- keep_detached: Keep the volume detached.
|
|
27
|
+
- move_to_trash: Move the volume to trash.
|
|
28
|
+
- delete_permanently: Delete the volume permanently.
|
|
29
|
+
Defaults to keep_detached.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
name: str
|
|
33
|
+
size: int
|
|
34
|
+
on_spot_discontinue: OnSpotDiscontinue | None = None
|
|
14
35
|
|
|
15
36
|
|
|
16
37
|
@dataclass_json
|
|
@@ -123,7 +144,7 @@ class InstancesService:
|
|
|
123
144
|
startup_script_id: str | None = None,
|
|
124
145
|
volumes: list[dict] | None = None,
|
|
125
146
|
existing_volumes: list[str] | None = None,
|
|
126
|
-
os_volume: dict | None = None,
|
|
147
|
+
os_volume: OSVolume | dict | None = None,
|
|
127
148
|
is_spot: bool = False,
|
|
128
149
|
contract: Contract | None = None,
|
|
129
150
|
pricing: Pricing | None = None,
|
|
@@ -170,7 +191,7 @@ class InstancesService:
|
|
|
170
191
|
'hostname': hostname,
|
|
171
192
|
'description': description,
|
|
172
193
|
'location_code': location,
|
|
173
|
-
'os_volume': os_volume,
|
|
194
|
+
'os_volume': os_volume.to_dict() if isinstance(os_volume, OSVolume) else os_volume,
|
|
174
195
|
'volumes': volumes or [],
|
|
175
196
|
'existing_volumes': existing_volumes or [],
|
|
176
197
|
'is_spot': is_spot,
|
|
@@ -204,6 +225,7 @@ class InstancesService:
|
|
|
204
225
|
id_list: list[str] | str,
|
|
205
226
|
action: str,
|
|
206
227
|
volume_ids: list[str] | None = None,
|
|
228
|
+
delete_permanently: bool = False,
|
|
207
229
|
) -> None:
|
|
208
230
|
"""Performs an action on one or more instances.
|
|
209
231
|
|
|
@@ -211,6 +233,9 @@ class InstancesService:
|
|
|
211
233
|
id_list: Single instance ID or list of instance IDs to act upon.
|
|
212
234
|
action: Action to perform on the instances.
|
|
213
235
|
volume_ids: Optional list of volume IDs to delete.
|
|
236
|
+
delete_permanently: When deleting (or discontinuing), delete the
|
|
237
|
+
given volume IDs permanently. Only applicable when volume_ids
|
|
238
|
+
is also provided.
|
|
214
239
|
|
|
215
240
|
Raises:
|
|
216
241
|
HTTPError: If the action fails or other API error occurs.
|
|
@@ -218,7 +243,14 @@ class InstancesService:
|
|
|
218
243
|
if type(id_list) is str:
|
|
219
244
|
id_list = [id_list]
|
|
220
245
|
|
|
221
|
-
payload = {
|
|
246
|
+
payload = {
|
|
247
|
+
'id': id_list,
|
|
248
|
+
'action': action,
|
|
249
|
+
'volume_ids': volume_ids,
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if delete_permanently:
|
|
253
|
+
payload['delete_permanently'] = True
|
|
222
254
|
|
|
223
255
|
self._http_client.put(INSTANCES_ENDPOINT, json=payload)
|
|
224
256
|
return
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from ._instances import Contract, Instance, InstancesService, Pricing
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|