datacrunch 1.14.0__py3-none-any.whl → 1.16.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/InferenceClient/inference_client.py +200 -65
- datacrunch/__init__.py +2 -0
- datacrunch/_version.py +6 -0
- datacrunch/authentication/authentication.py +7 -14
- datacrunch/balance/balance.py +1 -3
- datacrunch/constants.py +19 -17
- datacrunch/containers/containers.py +151 -123
- datacrunch/datacrunch.py +18 -18
- datacrunch/helpers.py +7 -2
- datacrunch/http_client/http_client.py +14 -14
- datacrunch/images/images.py +9 -3
- datacrunch/instance_types/instance_types.py +42 -35
- datacrunch/instances/instances.py +74 -53
- datacrunch/locations/locations.py +1 -2
- datacrunch/ssh_keys/ssh_keys.py +3 -4
- datacrunch/startup_scripts/startup_scripts.py +10 -8
- datacrunch/volume_types/volume_types.py +10 -8
- datacrunch/volumes/volumes.py +60 -73
- {datacrunch-1.14.0.dist-info → datacrunch-1.16.0.dist-info}/METADATA +46 -72
- datacrunch-1.16.0.dist-info/RECORD +35 -0
- datacrunch-1.16.0.dist-info/WHEEL +4 -0
- datacrunch/__version__.py +0 -1
- datacrunch-1.14.0.dist-info/RECORD +0 -69
- datacrunch-1.14.0.dist-info/WHEEL +0 -5
- datacrunch-1.14.0.dist-info/licenses/LICENSE +0 -21
- datacrunch-1.14.0.dist-info/top_level.txt +0 -2
- tests/__init__.py +0 -0
- tests/integration_tests/__init__.py +0 -0
- tests/integration_tests/conftest.py +0 -20
- tests/integration_tests/test_instances.py +0 -36
- tests/integration_tests/test_locations.py +0 -65
- tests/integration_tests/test_volumes.py +0 -94
- tests/unit_tests/__init__.py +0 -0
- tests/unit_tests/authentication/__init__.py +0 -0
- tests/unit_tests/authentication/test_authentication.py +0 -202
- tests/unit_tests/balance/__init__.py +0 -0
- tests/unit_tests/balance/test_balance.py +0 -25
- tests/unit_tests/conftest.py +0 -21
- tests/unit_tests/containers/__init__.py +0 -1
- tests/unit_tests/containers/test_containers.py +0 -959
- tests/unit_tests/http_client/__init__.py +0 -0
- tests/unit_tests/http_client/test_http_client.py +0 -193
- tests/unit_tests/images/__init__.py +0 -0
- tests/unit_tests/images/test_images.py +0 -41
- tests/unit_tests/instance_types/__init__.py +0 -0
- tests/unit_tests/instance_types/test_instance_types.py +0 -87
- tests/unit_tests/instances/__init__.py +0 -0
- tests/unit_tests/instances/test_instances.py +0 -483
- tests/unit_tests/ssh_keys/__init__.py +0 -0
- tests/unit_tests/ssh_keys/test_ssh_keys.py +0 -198
- tests/unit_tests/startup_scripts/__init__.py +0 -0
- tests/unit_tests/startup_scripts/test_startup_scripts.py +0 -196
- tests/unit_tests/test_datacrunch.py +0 -65
- tests/unit_tests/test_exceptions.py +0 -33
- tests/unit_tests/volume_types/__init__.py +0 -0
- tests/unit_tests/volume_types/test_volume_types.py +0 -50
- tests/unit_tests/volumes/__init__.py +0 -0
- tests/unit_tests/volumes/test_volumes.py +0 -641
datacrunch/volumes/volumes.py
CHANGED
|
@@ -8,20 +8,21 @@ VOLUMES_ENDPOINT = '/volumes'
|
|
|
8
8
|
class Volume:
|
|
9
9
|
"""A volume model class"""
|
|
10
10
|
|
|
11
|
-
def __init__(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
id: str,
|
|
14
|
+
status: str,
|
|
15
|
+
name: str,
|
|
16
|
+
size: int,
|
|
17
|
+
type: str,
|
|
18
|
+
is_os_volume: bool,
|
|
19
|
+
created_at: str,
|
|
20
|
+
target: str = None,
|
|
21
|
+
location: str = Locations.FIN_03,
|
|
22
|
+
instance_id: str = None,
|
|
23
|
+
ssh_key_ids: List[str] = [],
|
|
24
|
+
deleted_at: str = None,
|
|
25
|
+
) -> None:
|
|
25
26
|
"""Initialize the volume object
|
|
26
27
|
|
|
27
28
|
:param id: volume id
|
|
@@ -40,7 +41,7 @@ class Volume:
|
|
|
40
41
|
:type created_at: str
|
|
41
42
|
:param target: target device e.g. vda
|
|
42
43
|
:type target: str, optional
|
|
43
|
-
:param location: datacenter location, defaults to "FIN-
|
|
44
|
+
:param location: datacenter location, defaults to "FIN-03"
|
|
44
45
|
:type location: str, optional
|
|
45
46
|
:param instance_id: the instance id the volume is attached to, None if detached
|
|
46
47
|
:type instance_id: str
|
|
@@ -181,18 +182,18 @@ class Volume:
|
|
|
181
182
|
"""
|
|
182
183
|
|
|
183
184
|
return cls(
|
|
184
|
-
id
|
|
185
|
-
status
|
|
186
|
-
name
|
|
187
|
-
size
|
|
188
|
-
type
|
|
189
|
-
is_os_volume
|
|
190
|
-
created_at
|
|
191
|
-
target
|
|
192
|
-
location
|
|
193
|
-
instance_id
|
|
194
|
-
ssh_key_ids
|
|
195
|
-
deleted_at
|
|
185
|
+
id=volume_dict['id'],
|
|
186
|
+
status=volume_dict['status'],
|
|
187
|
+
name=volume_dict['name'],
|
|
188
|
+
size=volume_dict['size'],
|
|
189
|
+
type=volume_dict['type'],
|
|
190
|
+
is_os_volume=volume_dict['is_os_volume'],
|
|
191
|
+
created_at=volume_dict['created_at'],
|
|
192
|
+
target=volume_dict['target'],
|
|
193
|
+
location=volume_dict['location'],
|
|
194
|
+
instance_id=volume_dict['instance_id'],
|
|
195
|
+
ssh_key_ids=volume_dict['ssh_key_ids'],
|
|
196
|
+
deleted_at=volume_dict.get('deleted_at'),
|
|
196
197
|
)
|
|
197
198
|
|
|
198
199
|
def __str__(self) -> str:
|
|
@@ -218,8 +219,7 @@ class VolumesService:
|
|
|
218
219
|
:return: list of volume details objects
|
|
219
220
|
:rtype: List[Volume]
|
|
220
221
|
"""
|
|
221
|
-
volumes_dict = self._http_client.get(
|
|
222
|
-
VOLUMES_ENDPOINT, params={'status': status}).json()
|
|
222
|
+
volumes_dict = self._http_client.get(VOLUMES_ENDPOINT, params={'status': status}).json()
|
|
223
223
|
return list(map(Volume.create_from_dict, volumes_dict))
|
|
224
224
|
|
|
225
225
|
def get_by_id(self, id: str) -> Volume:
|
|
@@ -230,8 +230,7 @@ class VolumesService:
|
|
|
230
230
|
:return: Volume details object
|
|
231
231
|
:rtype: Volume
|
|
232
232
|
"""
|
|
233
|
-
volume_dict = self._http_client.get(
|
|
234
|
-
VOLUMES_ENDPOINT + f'/{id}').json()
|
|
233
|
+
volume_dict = self._http_client.get(VOLUMES_ENDPOINT + f'/{id}').json()
|
|
235
234
|
|
|
236
235
|
return Volume.create_from_dict(volume_dict)
|
|
237
236
|
|
|
@@ -241,19 +240,18 @@ class VolumesService:
|
|
|
241
240
|
:return: list of volume details objects
|
|
242
241
|
:rtype: List[Volume]
|
|
243
242
|
"""
|
|
244
|
-
volumes_dicts = self._http_client.get(
|
|
245
|
-
VOLUMES_ENDPOINT + '/trash'
|
|
246
|
-
).json()
|
|
243
|
+
volumes_dicts = self._http_client.get(VOLUMES_ENDPOINT + '/trash').json()
|
|
247
244
|
|
|
248
245
|
return list(map(Volume.create_from_dict, volumes_dicts))
|
|
249
246
|
|
|
250
|
-
def create(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
247
|
+
def create(
|
|
248
|
+
self,
|
|
249
|
+
type: str,
|
|
250
|
+
name: str,
|
|
251
|
+
size: int,
|
|
252
|
+
instance_id: str = None,
|
|
253
|
+
location: str = Locations.FIN_03,
|
|
254
|
+
) -> Volume:
|
|
257
255
|
"""Create new volume
|
|
258
256
|
|
|
259
257
|
:param type: volume type
|
|
@@ -264,17 +262,17 @@ class VolumesService:
|
|
|
264
262
|
:type size: int
|
|
265
263
|
:param instance_id: Instance id to be attached to, defaults to None
|
|
266
264
|
:type instance_id: str, optional
|
|
267
|
-
:param location: datacenter location, defaults to "FIN-
|
|
265
|
+
:param location: datacenter location, defaults to "FIN-03"
|
|
268
266
|
:type location: str, optional
|
|
269
267
|
:return: the new volume object
|
|
270
268
|
:rtype: Volume
|
|
271
269
|
"""
|
|
272
270
|
payload = {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
'type': type,
|
|
272
|
+
'name': name,
|
|
273
|
+
'size': size,
|
|
274
|
+
'instance_id': instance_id,
|
|
275
|
+
'location_code': location,
|
|
278
276
|
}
|
|
279
277
|
id = self._http_client.post(VOLUMES_ENDPOINT, json=payload).text
|
|
280
278
|
volume = self.get_by_id(id)
|
|
@@ -290,9 +288,9 @@ class VolumesService:
|
|
|
290
288
|
:type instance_id: str
|
|
291
289
|
"""
|
|
292
290
|
payload = {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
291
|
+
'id': id_list,
|
|
292
|
+
'action': VolumeActions.ATTACH,
|
|
293
|
+
'instance_id': instance_id,
|
|
296
294
|
}
|
|
297
295
|
|
|
298
296
|
self._http_client.put(VOLUMES_ENDPOINT, json=payload)
|
|
@@ -306,8 +304,8 @@ class VolumesService:
|
|
|
306
304
|
:type id_list: Union[List[str], str]
|
|
307
305
|
"""
|
|
308
306
|
payload = {
|
|
309
|
-
|
|
310
|
-
|
|
307
|
+
'id': id_list,
|
|
308
|
+
'action': VolumeActions.DETACH,
|
|
311
309
|
}
|
|
312
310
|
|
|
313
311
|
self._http_client.put(VOLUMES_ENDPOINT, json=payload)
|
|
@@ -325,20 +323,13 @@ class VolumesService:
|
|
|
325
323
|
:return: the new volume object, or a list of volume objects if cloned mutliple volumes
|
|
326
324
|
:rtype: Volume or List[Volume]
|
|
327
325
|
"""
|
|
328
|
-
payload = {
|
|
329
|
-
"id": id,
|
|
330
|
-
"action": VolumeActions.CLONE,
|
|
331
|
-
"name": name,
|
|
332
|
-
"type": type
|
|
333
|
-
}
|
|
326
|
+
payload = {'id': id, 'action': VolumeActions.CLONE, 'name': name, 'type': type}
|
|
334
327
|
|
|
335
328
|
# clone volume(s)
|
|
336
|
-
volume_ids_array = self._http_client.put(
|
|
337
|
-
VOLUMES_ENDPOINT, json=payload).json()
|
|
329
|
+
volume_ids_array = self._http_client.put(VOLUMES_ENDPOINT, json=payload).json()
|
|
338
330
|
|
|
339
331
|
# map the IDs into Volume objects
|
|
340
|
-
volumes_array = list(
|
|
341
|
-
map(lambda volume_id: self.get_by_id(volume_id), volume_ids_array))
|
|
332
|
+
volumes_array = list(map(lambda volume_id: self.get_by_id(volume_id), volume_ids_array))
|
|
342
333
|
|
|
343
334
|
# if the array has only one element, return that element
|
|
344
335
|
if len(volumes_array) == 1:
|
|
@@ -355,11 +346,7 @@ class VolumesService:
|
|
|
355
346
|
:param name: new name
|
|
356
347
|
:type name: str
|
|
357
348
|
"""
|
|
358
|
-
payload = {
|
|
359
|
-
"id": id_list,
|
|
360
|
-
"action": VolumeActions.RENAME,
|
|
361
|
-
"name": name
|
|
362
|
-
}
|
|
349
|
+
payload = {'id': id_list, 'action': VolumeActions.RENAME, 'name': name}
|
|
363
350
|
|
|
364
351
|
self._http_client.put(VOLUMES_ENDPOINT, json=payload)
|
|
365
352
|
return
|
|
@@ -373,9 +360,9 @@ class VolumesService:
|
|
|
373
360
|
:type size: int
|
|
374
361
|
"""
|
|
375
362
|
payload = {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
363
|
+
'id': id_list,
|
|
364
|
+
'action': VolumeActions.INCREASE_SIZE,
|
|
365
|
+
'size': size,
|
|
379
366
|
}
|
|
380
367
|
|
|
381
368
|
self._http_client.put(VOLUMES_ENDPOINT, json=payload)
|
|
@@ -389,9 +376,9 @@ class VolumesService:
|
|
|
389
376
|
:type id_list: Union[List[str], str]
|
|
390
377
|
"""
|
|
391
378
|
payload = {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
379
|
+
'id': id_list,
|
|
380
|
+
'action': VolumeActions.DELETE,
|
|
381
|
+
'is_permanent': is_permanent,
|
|
395
382
|
}
|
|
396
383
|
|
|
397
384
|
self._http_client.put(VOLUMES_ENDPOINT, json=payload)
|
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: datacrunch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.16.0
|
|
4
4
|
Summary: Official Python SDK for DataCrunch Public API
|
|
5
|
-
Home-page: https://github.com/DataCrunch-io
|
|
6
5
|
Author: DataCrunch Oy
|
|
7
|
-
Author-email: info@datacrunch.io
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
6
|
+
Author-email: DataCrunch Oy <info@datacrunch.io>
|
|
13
7
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
8
|
Classifier: Intended Audience :: Developers
|
|
15
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
10
|
Classifier: Natural Language :: English
|
|
18
|
-
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Dist: requests>=2.25.1,<3
|
|
18
|
+
Requires-Dist: dataclasses-json>=0.6.7
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Project-URL: Changelog, https://datacrunch-python.readthedocs.io/en/latest/changelog.html
|
|
21
|
+
Project-URL: Documentation, https://datacrunch-python.readthedocs.io/
|
|
22
|
+
Project-URL: Homepage, https://github.com/DataCrunch-io
|
|
23
|
+
Project-URL: Repository, https://github.com/DataCrunch-io/datacrunch-python
|
|
19
24
|
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: requests<3,>=2.25.1
|
|
22
|
-
Requires-Dist: dataclasses_json>=0.6.7
|
|
23
|
-
Provides-Extra: dev
|
|
24
|
-
Provides-Extra: test
|
|
25
|
-
Requires-Dist: pytest<7,>=6.2.1; extra == "test"
|
|
26
|
-
Requires-Dist: pytest-cov<3,>=2.10.1; extra == "test"
|
|
27
|
-
Requires-Dist: pytest-responses<1,>=0.4.0; extra == "test"
|
|
28
|
-
Requires-Dist: responses<1,>=0.12.1; extra == "test"
|
|
29
|
-
Dynamic: author
|
|
30
|
-
Dynamic: author-email
|
|
31
|
-
Dynamic: classifier
|
|
32
|
-
Dynamic: description
|
|
33
|
-
Dynamic: description-content-type
|
|
34
|
-
Dynamic: home-page
|
|
35
|
-
Dynamic: license-file
|
|
36
|
-
Dynamic: provides-extra
|
|
37
|
-
Dynamic: requires-dist
|
|
38
|
-
Dynamic: requires-python
|
|
39
|
-
Dynamic: summary
|
|
40
25
|
|
|
41
26
|
# DataCrunch Python SDK
|
|
42
27
|
|
|
@@ -56,10 +41,14 @@ DataCrunch's Public API documentation [is available here](https://api.datacrunch
|
|
|
56
41
|
|
|
57
42
|
## Getting Started - Using the SDK:
|
|
58
43
|
|
|
59
|
-
- Install
|
|
44
|
+
- Install:
|
|
60
45
|
|
|
61
46
|
```bash
|
|
47
|
+
# via pip
|
|
62
48
|
pip3 install datacrunch
|
|
49
|
+
|
|
50
|
+
# via uv
|
|
51
|
+
uv add datacrunch
|
|
63
52
|
```
|
|
64
53
|
|
|
65
54
|
- Generate your client credentials - [instructions in the public API docs](https://api.datacrunch.io/v1/docs#description/quick-start-guide).
|
|
@@ -122,63 +111,53 @@ DataCrunch's Public API documentation [is available here](https://api.datacrunch
|
|
|
122
111
|
|
|
123
112
|
## Development
|
|
124
113
|
|
|
125
|
-
###
|
|
126
|
-
|
|
127
|
-
- Clone the repository:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
git clone
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
- Create local virtual environment:
|
|
114
|
+
### Set up the local development environment
|
|
134
115
|
|
|
135
|
-
|
|
136
|
-
python3 -m venv datacrunch_env && source ./datacrunch_env/bin/activate
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
or if using [fish shell](https://fishshell.com/):
|
|
140
|
-
|
|
141
|
-
```fish
|
|
142
|
-
python3 -m venv datacrunch_env && source ./datacrunch_env/bin/activate.fish
|
|
143
|
-
```
|
|
116
|
+
Prerequisite: install [`uv`](https://docs.astral.sh/uv/).
|
|
144
117
|
|
|
145
|
-
|
|
118
|
+
Clone the repository, create local environment and install dependencies:
|
|
146
119
|
|
|
147
120
|
```bash
|
|
148
|
-
|
|
149
|
-
|
|
121
|
+
git clone git@github.com:DataCrunch-io/datacrunch-python.git
|
|
122
|
+
cd datacrunch-python
|
|
123
|
+
uv sync
|
|
150
124
|
```
|
|
151
125
|
|
|
152
|
-
###
|
|
126
|
+
### Run Tests
|
|
153
127
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
- To execute all tests
|
|
128
|
+
- Execute all tests
|
|
157
129
|
|
|
158
130
|
```bash
|
|
159
|
-
pytest
|
|
131
|
+
uv run pytest
|
|
160
132
|
```
|
|
161
133
|
|
|
162
|
-
-
|
|
134
|
+
- Execute a single test file
|
|
163
135
|
|
|
164
136
|
```bash
|
|
165
|
-
pytest
|
|
137
|
+
uv run pytest tests/unit_tests/test_file.py
|
|
166
138
|
```
|
|
167
139
|
|
|
168
140
|
### Local Manual Testing
|
|
169
141
|
|
|
170
|
-
Create
|
|
142
|
+
Create a file in the root directory of the project:
|
|
171
143
|
|
|
172
144
|
```python
|
|
145
|
+
# example.py
|
|
173
146
|
from datacrunch.datacrunch import DataCrunchClient
|
|
174
147
|
|
|
175
148
|
CLIENT_SECRET = 'secret'
|
|
176
149
|
CLIENT_ID = 'your-id'
|
|
177
150
|
|
|
178
|
-
# Create
|
|
151
|
+
# Create datacrunch client
|
|
179
152
|
datacrunch = DataCrunchClient(CLIENT_ID, CLIENT_SECRET, base_url='http://localhost:3001/v1')
|
|
180
153
|
```
|
|
181
154
|
|
|
155
|
+
Run it:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
uv run python example.py
|
|
159
|
+
```
|
|
160
|
+
|
|
182
161
|
### Generating the documentation
|
|
183
162
|
|
|
184
163
|
If added a new service, create a documentation template under api/services for that service.
|
|
@@ -188,19 +167,14 @@ cd docs
|
|
|
188
167
|
make html
|
|
189
168
|
```
|
|
190
169
|
|
|
191
|
-
###
|
|
192
|
-
|
|
193
|
-
Use autopep8 for auto code formatting:
|
|
170
|
+
### Code style
|
|
194
171
|
|
|
195
172
|
```bash
|
|
196
|
-
#
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
# Apply to an entire directory
|
|
200
|
-
autopep8 directory_name --recursive --in-place --pep8-passes 2000 --verbose
|
|
173
|
+
# Lint
|
|
174
|
+
uv run ruff check
|
|
201
175
|
|
|
202
|
-
#
|
|
203
|
-
|
|
176
|
+
# Format code
|
|
177
|
+
uv run ruff format
|
|
204
178
|
```
|
|
205
179
|
|
|
206
180
|
## Contact
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
datacrunch/InferenceClient/__init__.py,sha256=oe7RQfoKbKJnIFWOt6TNtdzjXk5Gcl4-smO5DjLE6M0,117
|
|
2
|
+
datacrunch/InferenceClient/inference_client.py,sha256=GYjUshs2e2zKKw1B3KU8Dt2jr8kSt8QKRtML-Ce96GE,16907
|
|
3
|
+
datacrunch/__init__.py,sha256=ssI1WpIpRQhdwiO_3kYVtS7h9ePGZ5sgTyRieTYhllU,96
|
|
4
|
+
datacrunch/_version.py,sha256=5vv5w-bgsYeQlFvxgfqpdPWtyGiNYqDZyagqHmT6AwM,165
|
|
5
|
+
datacrunch/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
datacrunch/authentication/authentication.py,sha256=ksjcEKhx6xhbp86EnWuKHqHeFy7of_FAR7x1BS-hMbE,3508
|
|
7
|
+
datacrunch/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
datacrunch/balance/balance.py,sha256=PT-d4JHCRiHJIk0K1Hi0v_R8CeDqa6000zfBSNV4nWE,1215
|
|
9
|
+
datacrunch/constants.py,sha256=p7l9xNByisNVlXwy2jQskCxI1zU9bbTtq1hYgGXz2QE,2432
|
|
10
|
+
datacrunch/containers/__init__.py,sha256=qNxgk3tS9Dx251ugXjmsDWeab2MO7EAFLd6aRo1XpmQ,744
|
|
11
|
+
datacrunch/containers/containers.py,sha256=RJnMsTtQqDbWC_i0GqdKuQDtuFtziPW2kiP13MYuIos,35775
|
|
12
|
+
datacrunch/datacrunch.py,sha256=U7kqcdt2hrG27M8a1dEbCWFo-eL_h71yMSX4vW-K2qA,3454
|
|
13
|
+
datacrunch/exceptions.py,sha256=uOP_YU2HEUi_mcMxQ9WYrIjqWUuUrwdube-RdL1C4Ps,781
|
|
14
|
+
datacrunch/helpers.py,sha256=OOG5B25q1tpDqa_6zen4C-nLEnPbI2sJGGC-btoZiRk,666
|
|
15
|
+
datacrunch/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
datacrunch/http_client/http_client.py,sha256=KjmAKhSgDFdps6Z4z2RqJIHpOannUkwQF8PvvntGHEM,8265
|
|
17
|
+
datacrunch/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
datacrunch/images/images.py,sha256=PmJZrX4qYAyeE4cwcfM2PWwNNN6aSFlAjEo578qP8h8,2260
|
|
19
|
+
datacrunch/instance_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
datacrunch/instance_types/instance_types.py,sha256=cHGLx5nSNGQhLL5WglJN5iYfUDoe9jSgzr9R7pwgIkk,5340
|
|
21
|
+
datacrunch/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
datacrunch/instances/instances.py,sha256=VU7fxMFrT_x9u_xZP_WYrYR6U3Z6jSKlfODXL3KMODc,9813
|
|
23
|
+
datacrunch/locations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
datacrunch/locations/locations.py,sha256=tcmLrvyo6WaR-6YJ0Hr5vf_GqXjDzLTToybl5dYosgo,395
|
|
25
|
+
datacrunch/ssh_keys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
+
datacrunch/ssh_keys/ssh_keys.py,sha256=YD9QnsvWAKC6i2RIxF9fo1u2Z9ayxj3jVZgyUxqvYVs,2894
|
|
27
|
+
datacrunch/startup_scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
datacrunch/startup_scripts/startup_scripts.py,sha256=vqEYOwRf2luaS_m0jrGbLtWu7HZpt-IfzXbhJ7DH_b8,3202
|
|
29
|
+
datacrunch/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
datacrunch/volume_types/volume_types.py,sha256=KPNAUtvlZkYbX1IIBiAELVst8bU71v4MwztxLhKQHlI,1886
|
|
31
|
+
datacrunch/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
+
datacrunch/volumes/volumes.py,sha256=UiuKBRv4dTEsJrEWSTMQyVurb9WZrLJy42pmYGmWL5o,11560
|
|
33
|
+
datacrunch-1.16.0.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
|
|
34
|
+
datacrunch-1.16.0.dist-info/METADATA,sha256=momu6xw9SXypuLyhwtNfoHB6-0NYOMAuQBnuOFBPvqE,5673
|
|
35
|
+
datacrunch-1.16.0.dist-info/RECORD,,
|
datacrunch/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = '1.14.0'
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
datacrunch/__init__.py,sha256=OG-5Avmuq3NXyBs_66GMwyzscUi0c-T6vWW5sRIfnZg,51
|
|
2
|
-
datacrunch/__version__.py,sha256=lLRiU2EiT8DPYMqjavNZRC31t7bJYl4gv8UDuVAqpkk,19
|
|
3
|
-
datacrunch/constants.py,sha256=i0jCX91H2lKp1Uvk4GDsaTeXk0WmjyeSGpMfPs69BB4,2378
|
|
4
|
-
datacrunch/datacrunch.py,sha256=2IqrTY39sLuwtuQ_QP3jCI1d5AaCwriYgAUEFoZZzPU,3488
|
|
5
|
-
datacrunch/exceptions.py,sha256=uOP_YU2HEUi_mcMxQ9WYrIjqWUuUrwdube-RdL1C4Ps,781
|
|
6
|
-
datacrunch/helpers.py,sha256=Eq5htNxpJUCJG9D6QxbnWwch3ppmi2lfi-rFCGXf3fs,634
|
|
7
|
-
datacrunch/InferenceClient/__init__.py,sha256=oe7RQfoKbKJnIFWOt6TNtdzjXk5Gcl4-smO5DjLE6M0,117
|
|
8
|
-
datacrunch/InferenceClient/inference_client.py,sha256=LTn4JD8lYMuQGJLtmmx-fJtRHK1F7WG2uU1tbzeD-Dc,15593
|
|
9
|
-
datacrunch/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
datacrunch/authentication/authentication.py,sha256=CThTxA99jseh7TKIdUR1M9RErIJoXvTB8CbF1VGFPCE,3589
|
|
11
|
-
datacrunch/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
datacrunch/balance/balance.py,sha256=rkqqXC3MLVxk6ym9Hlp9tsLbLWJculIn8q3BYbsme28,1240
|
|
13
|
-
datacrunch/containers/__init__.py,sha256=qNxgk3tS9Dx251ugXjmsDWeab2MO7EAFLd6aRo1XpmQ,744
|
|
14
|
-
datacrunch/containers/containers.py,sha256=BSjPQ-VGvc7z9CYwCKkjVuM5ZV4oVgfOUyTe56BvXMY,35604
|
|
15
|
-
datacrunch/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
datacrunch/http_client/http_client.py,sha256=tmpVd3p7-NAIaTM4E13inFZWUetdVEFZnRE38p5eVk0,8285
|
|
17
|
-
datacrunch/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
datacrunch/images/images.py,sha256=hCAtSzozHcAAJ_UZOvnAbQSEU7BfCuixpIsmcd2RM2k,2167
|
|
19
|
-
datacrunch/instance_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
datacrunch/instance_types/instance_types.py,sha256=NLkUI6UdfXg-zDkMu9j9RzVISLG8jdABhT_R7XpfBdA,5289
|
|
21
|
-
datacrunch/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
datacrunch/instances/instances.py,sha256=GKPpZshn5JBsduR5zyT57fonB0GDdOLkPfPmGqgJQow,9239
|
|
23
|
-
datacrunch/locations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
datacrunch/locations/locations.py,sha256=2f1OF2ObNaqGam_Mm0Btie1GymnAI9UzXulhqSSm7zo,404
|
|
25
|
-
datacrunch/ssh_keys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
datacrunch/ssh_keys/ssh_keys.py,sha256=n8ek3-DigzU-dVnpI2sBjOUQRZhihLMyT7GJWT2J3U4,2907
|
|
27
|
-
datacrunch/startup_scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
-
datacrunch/startup_scripts/startup_scripts.py,sha256=EnWiuT48uN_soVHpbnDMUQ9kab2V_gJSSp0hpV_UBg4,3172
|
|
29
|
-
datacrunch/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
datacrunch/volume_types/volume_types.py,sha256=CNJ8kfd_nxmF99x-UAJeku-uN4Gdh-yg15Aa8WGLgWU,1828
|
|
31
|
-
datacrunch/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
datacrunch/volumes/volumes.py,sha256=aAH4UIVG-7NehjHu-a_4MGSdZ1jmeApV-kKh-X6TB-s,11908
|
|
33
|
-
datacrunch-1.14.0.dist-info/licenses/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
|
|
34
|
-
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
tests/integration_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
tests/integration_tests/conftest.py,sha256=PWf6K1G3NoddebmDIy_Pk02dHQrEKfrNxpWwqE8Eqrk,546
|
|
37
|
-
tests/integration_tests/test_instances.py,sha256=p9Cc9jp-2wFbSP8iZWCE1I51oKQRUJWdKGpD3Squkpw,1249
|
|
38
|
-
tests/integration_tests/test_locations.py,sha256=i4h7OiZG5LHfPRHCO4bOlAZ86Yx64GvYqp-SRZUP77g,2791
|
|
39
|
-
tests/integration_tests/test_volumes.py,sha256=ty5m_nuVyyJ37fvhGgFB6jZDiif9jjW45Yd_eUa7Jps,3194
|
|
40
|
-
tests/unit_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
-
tests/unit_tests/conftest.py,sha256=zXoleTvOtU1pUWCbKowisRgItywjUEcdiCgljVvczeo,592
|
|
42
|
-
tests/unit_tests/test_datacrunch.py,sha256=IWbBncV-XNQAWH7ui2bxOg-7CtThmwJlsmRxq3_JzSs,2090
|
|
43
|
-
tests/unit_tests/test_exceptions.py,sha256=yTCb5TIY8k1MlpbyKtIctq0YhvV7mlvybKTCdK2sLtg,891
|
|
44
|
-
tests/unit_tests/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
tests/unit_tests/authentication/test_authentication.py,sha256=P84VnD9utk8y3ZPhUfO8TT42t_xSiTlyUy4ecAWX5yA,7490
|
|
46
|
-
tests/unit_tests/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
-
tests/unit_tests/balance/test_balance.py,sha256=Cojbjd7wc9-8eRQb_fR0xLXEX7fGqobdQICH3O7WAx4,651
|
|
48
|
-
tests/unit_tests/containers/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
49
|
-
tests/unit_tests/containers/test_containers.py,sha256=lr7Thrpl5hC6iBG91YjBUEpkv6t6CVnXjIzkXmvXg0U,31011
|
|
50
|
-
tests/unit_tests/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
|
-
tests/unit_tests/http_client/test_http_client.py,sha256=JfEy7pADx0gS9KNNwVLVeG-bG4DRRXxze4dQkP_WIvw,6776
|
|
52
|
-
tests/unit_tests/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
tests/unit_tests/images/test_images.py,sha256=Tbsu5U1bUoD66ATibUWmipDmHYvhScI2XRzKtt-I-qg,1204
|
|
54
|
-
tests/unit_tests/instance_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
tests/unit_tests/instance_types/test_instance_types.py,sha256=DHpzSDG91Y8BOT5OVq5sKoO-akKRBK-X04c6_35HtGQ,3310
|
|
56
|
-
tests/unit_tests/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
|
-
tests/unit_tests/instances/test_instances.py,sha256=Gc4Krp0CbqbjA6dIMv5ekw1e4tSlzWF9wZOLZgFp2jU,16920
|
|
58
|
-
tests/unit_tests/ssh_keys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
tests/unit_tests/ssh_keys/test_ssh_keys.py,sha256=PsFSfgIhD2Jfg4w3BPu7LH7g40EnyDUIuE-xxOq7YlI,5741
|
|
60
|
-
tests/unit_tests/startup_scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
-
tests/unit_tests/startup_scripts/test_startup_scripts.py,sha256=D6L0q2NyY1C1kqsBGcXtRL5lUmrlcI3io51N-XgBpXU,6039
|
|
62
|
-
tests/unit_tests/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
|
-
tests/unit_tests/volume_types/test_volume_types.py,sha256=vGuC3dWjhQLD8bTYgw_we3dZ6vlUKRmKZbb9yCfhe0w,1386
|
|
64
|
-
tests/unit_tests/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
|
-
tests/unit_tests/volumes/test_volumes.py,sha256=p53eSIHddWKL7U9oLLTnxo849LrJSoi6A5lpWF6ydHs,20672
|
|
66
|
-
datacrunch-1.14.0.dist-info/METADATA,sha256=5UvJ9tltX7_gMieuowQNONwfDywHpxVtcSNOqeFsyoM,6212
|
|
67
|
-
datacrunch-1.14.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
68
|
-
datacrunch-1.14.0.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
|
|
69
|
-
datacrunch-1.14.0.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 DataCrunch Oy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
tests/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import pytest
|
|
3
|
-
from dotenv import load_dotenv
|
|
4
|
-
from datacrunch.datacrunch import DataCrunchClient
|
|
5
|
-
|
|
6
|
-
"""
|
|
7
|
-
Make sure to run the server and the account has enough balance before running the tests
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
BASE_URL = "http://localhost:3010/v1"
|
|
11
|
-
|
|
12
|
-
# Load env variables, make sure there's an env file with valid client credentials
|
|
13
|
-
load_dotenv()
|
|
14
|
-
CLIENT_SECRET = os.getenv('DATACRUNCH_CLIENT_SECRET')
|
|
15
|
-
CLIENT_ID = os.getenv('DATACRUNCH_CLIENT_ID')
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@pytest.fixture
|
|
19
|
-
def datacrunch_client():
|
|
20
|
-
return DataCrunchClient(CLIENT_ID, CLIENT_SECRET, BASE_URL)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import pytest
|
|
3
|
-
from datacrunch.datacrunch import DataCrunchClient
|
|
4
|
-
from datacrunch.constants import Locations
|
|
5
|
-
|
|
6
|
-
IN_GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@pytest.mark.skipif(IN_GITHUB_ACTIONS, reason="Test doesn't work in Github Actions.")
|
|
10
|
-
@pytest.mark.withoutresponses
|
|
11
|
-
class TestInstances():
|
|
12
|
-
|
|
13
|
-
def test_create_instance(self, datacrunch_client: DataCrunchClient):
|
|
14
|
-
# get ssh key
|
|
15
|
-
ssh_key = datacrunch_client.ssh_keys.get()[0]
|
|
16
|
-
|
|
17
|
-
# create instance
|
|
18
|
-
instance = datacrunch_client.instances.create(
|
|
19
|
-
hostname="test-instance",
|
|
20
|
-
location=Locations.FIN_01,
|
|
21
|
-
instance_type='CPU.4V',
|
|
22
|
-
description="test instance",
|
|
23
|
-
image="ubuntu-18.04",
|
|
24
|
-
ssh_key_ids=[ssh_key.id])
|
|
25
|
-
|
|
26
|
-
# assert instance is created
|
|
27
|
-
assert instance.id is not None
|
|
28
|
-
assert instance.status == datacrunch_client.constants.instance_status.PROVISIONING
|
|
29
|
-
|
|
30
|
-
# delete instance
|
|
31
|
-
datacrunch_client.instances.action(instance.id, "delete")
|
|
32
|
-
|
|
33
|
-
# permanently delete all volumes in trash
|
|
34
|
-
trash = datacrunch_client.volumes.get_in_trash()
|
|
35
|
-
for volume in trash:
|
|
36
|
-
datacrunch_client.volumes.delete(volume.id, is_permanent=True)
|