datacrunch 1.14.0__py3-none-any.whl → 1.15.0__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.
- datacrunch/__version__.py +1 -1
- datacrunch/instances/instances.py +18 -9
- {datacrunch-1.14.0.dist-info → datacrunch-1.15.0.dist-info}/METADATA +1 -1
- {datacrunch-1.14.0.dist-info → datacrunch-1.15.0.dist-info}/RECORD +7 -7
- {datacrunch-1.14.0.dist-info → datacrunch-1.15.0.dist-info}/WHEEL +0 -0
- {datacrunch-1.14.0.dist-info → datacrunch-1.15.0.dist-info}/licenses/LICENSE +0 -0
- {datacrunch-1.14.0.dist-info → datacrunch-1.15.0.dist-info}/top_level.txt +0 -0
datacrunch/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = '1.
|
|
1
|
+
VERSION = '1.15.0'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import time
|
|
2
|
+
import itertools
|
|
2
3
|
from typing import List, Union, Optional, Dict, Literal
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
from dataclasses_json import dataclass_json
|
|
@@ -123,7 +124,12 @@ class InstancesService:
|
|
|
123
124
|
is_spot: bool = False,
|
|
124
125
|
contract: Optional[Contract] = None,
|
|
125
126
|
pricing: Optional[Pricing] = None,
|
|
126
|
-
coupon: Optional[str] = None
|
|
127
|
+
coupon: Optional[str] = None,
|
|
128
|
+
*,
|
|
129
|
+
max_wait_time: float = 180,
|
|
130
|
+
initial_interval: float = 0.5,
|
|
131
|
+
max_interval: float = 5,
|
|
132
|
+
backoff_coefficient: float = 2.0) -> Instance:
|
|
127
133
|
"""Creates and deploys a new cloud instance.
|
|
128
134
|
|
|
129
135
|
Args:
|
|
@@ -141,6 +147,10 @@ class InstancesService:
|
|
|
141
147
|
contract: Optional contract type for the instance.
|
|
142
148
|
pricing: Optional pricing model for the instance.
|
|
143
149
|
coupon: Optional coupon code for discounts.
|
|
150
|
+
max_wait_time: Maximum total wait for the instance to start provisioning, in seconds (default: 180)
|
|
151
|
+
initial_interval: Initial interval, in seconds (default: 0.5)
|
|
152
|
+
max_interval: The longest single delay allowed between retries, in seconds (default: 5)
|
|
153
|
+
backoff_coefficient: Coefficient to calculate the next retry interval (default 2.0)
|
|
144
154
|
|
|
145
155
|
Returns:
|
|
146
156
|
The newly created instance object.
|
|
@@ -169,20 +179,19 @@ class InstancesService:
|
|
|
169
179
|
id = self._http_client.post(INSTANCES_ENDPOINT, json=payload).text
|
|
170
180
|
|
|
171
181
|
# Wait for instance to enter provisioning state with timeout
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
start_time = time.time()
|
|
176
|
-
while True:
|
|
182
|
+
deadline = time.monotonic() + max_wait_time
|
|
183
|
+
for i in itertools.count():
|
|
177
184
|
instance = self.get_by_id(id)
|
|
178
185
|
if instance.status != InstanceStatus.ORDERED:
|
|
179
186
|
return instance
|
|
180
187
|
|
|
181
|
-
|
|
188
|
+
now = time.monotonic()
|
|
189
|
+
if now >= deadline:
|
|
182
190
|
raise TimeoutError(
|
|
183
|
-
f"Instance {id} did not enter provisioning state within {
|
|
191
|
+
f"Instance {id} did not enter provisioning state within {max_wait_time:.1f} seconds")
|
|
184
192
|
|
|
185
|
-
|
|
193
|
+
interval = min(initial_interval * backoff_coefficient ** i, max_interval, deadline - now)
|
|
194
|
+
time.sleep(interval)
|
|
186
195
|
|
|
187
196
|
def action(self, id_list: Union[List[str], str], action: str, volume_ids: Optional[List[str]] = None) -> None:
|
|
188
197
|
"""Performs an action on one or more instances.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
datacrunch/__init__.py,sha256=OG-5Avmuq3NXyBs_66GMwyzscUi0c-T6vWW5sRIfnZg,51
|
|
2
|
-
datacrunch/__version__.py,sha256=
|
|
2
|
+
datacrunch/__version__.py,sha256=v0NuAYy8C6njG7SDCjPG68hLvRFV00bt7g3lqwOYITU,19
|
|
3
3
|
datacrunch/constants.py,sha256=i0jCX91H2lKp1Uvk4GDsaTeXk0WmjyeSGpMfPs69BB4,2378
|
|
4
4
|
datacrunch/datacrunch.py,sha256=2IqrTY39sLuwtuQ_QP3jCI1d5AaCwriYgAUEFoZZzPU,3488
|
|
5
5
|
datacrunch/exceptions.py,sha256=uOP_YU2HEUi_mcMxQ9WYrIjqWUuUrwdube-RdL1C4Ps,781
|
|
@@ -19,7 +19,7 @@ datacrunch/images/images.py,sha256=hCAtSzozHcAAJ_UZOvnAbQSEU7BfCuixpIsmcd2RM2k,2
|
|
|
19
19
|
datacrunch/instance_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
datacrunch/instance_types/instance_types.py,sha256=NLkUI6UdfXg-zDkMu9j9RzVISLG8jdABhT_R7XpfBdA,5289
|
|
21
21
|
datacrunch/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
datacrunch/instances/instances.py,sha256=
|
|
22
|
+
datacrunch/instances/instances.py,sha256=fHHQdJcdudE3-Nee3NWAeCjN2c43mlgtfpJ-1Lfm6x4,9862
|
|
23
23
|
datacrunch/locations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
datacrunch/locations/locations.py,sha256=2f1OF2ObNaqGam_Mm0Btie1GymnAI9UzXulhqSSm7zo,404
|
|
25
25
|
datacrunch/ssh_keys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -30,7 +30,7 @@ datacrunch/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
30
30
|
datacrunch/volume_types/volume_types.py,sha256=CNJ8kfd_nxmF99x-UAJeku-uN4Gdh-yg15Aa8WGLgWU,1828
|
|
31
31
|
datacrunch/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
datacrunch/volumes/volumes.py,sha256=aAH4UIVG-7NehjHu-a_4MGSdZ1jmeApV-kKh-X6TB-s,11908
|
|
33
|
-
datacrunch-1.
|
|
33
|
+
datacrunch-1.15.0.dist-info/licenses/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
|
|
34
34
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
35
|
tests/integration_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
36
|
tests/integration_tests/conftest.py,sha256=PWf6K1G3NoddebmDIy_Pk02dHQrEKfrNxpWwqE8Eqrk,546
|
|
@@ -63,7 +63,7 @@ tests/unit_tests/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
63
63
|
tests/unit_tests/volume_types/test_volume_types.py,sha256=vGuC3dWjhQLD8bTYgw_we3dZ6vlUKRmKZbb9yCfhe0w,1386
|
|
64
64
|
tests/unit_tests/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
65
|
tests/unit_tests/volumes/test_volumes.py,sha256=p53eSIHddWKL7U9oLLTnxo849LrJSoi6A5lpWF6ydHs,20672
|
|
66
|
-
datacrunch-1.
|
|
67
|
-
datacrunch-1.
|
|
68
|
-
datacrunch-1.
|
|
69
|
-
datacrunch-1.
|
|
66
|
+
datacrunch-1.15.0.dist-info/METADATA,sha256=NYPMZAHvH2JmTs7fY37EXJM8hIamIT9rlZ_UgEljito,6212
|
|
67
|
+
datacrunch-1.15.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
68
|
+
datacrunch-1.15.0.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
|
|
69
|
+
datacrunch-1.15.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|