datacrunch 1.8.0__py3-none-any.whl → 1.8.2__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/containers/containers.py +61 -15
- {datacrunch-1.8.0.dist-info → datacrunch-1.8.2.dist-info}/METADATA +5 -5
- {datacrunch-1.8.0.dist-info → datacrunch-1.8.2.dist-info}/RECORD +8 -8
- {datacrunch-1.8.0.dist-info → datacrunch-1.8.2.dist-info}/WHEEL +1 -1
- tests/unit_tests/containers/test_containers.py +10 -9
- {datacrunch-1.8.0.dist-info → datacrunch-1.8.2.dist-info}/licenses/LICENSE +0 -0
- {datacrunch-1.8.0.dist-info → datacrunch-1.8.2.dist-info}/top_level.txt +0 -0
datacrunch/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = '1.8.
|
|
1
|
+
VERSION = '1.8.2'
|
|
@@ -97,9 +97,31 @@ class VolumeMount:
|
|
|
97
97
|
@dataclass_json
|
|
98
98
|
@dataclass
|
|
99
99
|
class Container:
|
|
100
|
+
"""Container configuration for deployment creation and updates.
|
|
101
|
+
This class omits the name field which is managed by the system.
|
|
102
|
+
|
|
103
|
+
:param image: Container image to use
|
|
104
|
+
:param exposed_port: Port to expose from the container
|
|
105
|
+
:param healthcheck: Optional health check configuration
|
|
106
|
+
:param entrypoint_overrides: Optional entrypoint override settings
|
|
107
|
+
:param env: Optional list of environment variables
|
|
108
|
+
:param volume_mounts: Optional list of volume mounts
|
|
109
|
+
"""
|
|
110
|
+
image: str
|
|
111
|
+
exposed_port: int
|
|
112
|
+
healthcheck: Optional[HealthcheckSettings] = None
|
|
113
|
+
entrypoint_overrides: Optional[EntrypointOverridesSettings] = None
|
|
114
|
+
env: Optional[List[EnvVar]] = None
|
|
115
|
+
volume_mounts: Optional[List[VolumeMount]] = None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@dataclass_json
|
|
119
|
+
@dataclass
|
|
120
|
+
class ContainerInfo:
|
|
100
121
|
"""Container configuration for deployments.
|
|
122
|
+
This class is read-only and includes the system-managed name field.
|
|
101
123
|
|
|
102
|
-
:param name: Name of the container
|
|
124
|
+
:param name: Name of the container (system-managed)
|
|
103
125
|
:param image: Container image to use
|
|
104
126
|
:param exposed_port: Port to expose from the container
|
|
105
127
|
:param healthcheck: Optional health check configuration
|
|
@@ -224,7 +246,31 @@ class ScalingOptions:
|
|
|
224
246
|
@dataclass_json(undefined=Undefined.EXCLUDE)
|
|
225
247
|
@dataclass
|
|
226
248
|
class Deployment:
|
|
249
|
+
"""Configuration for creating or updating a container deployment.
|
|
250
|
+
This class uses Container instead of ContainerInfo to prevent name setting.
|
|
251
|
+
|
|
252
|
+
:param name: Name of the deployment
|
|
253
|
+
:param container_registry_settings: Settings for accessing container registry
|
|
254
|
+
:param containers: List of container specifications in the deployment
|
|
255
|
+
:param compute: Compute resource configuration
|
|
256
|
+
:param is_spot: Whether is spot deployment
|
|
257
|
+
:param endpoint_base_url: Optional base URL for the deployment endpoint
|
|
258
|
+
:param scaling: Optional scaling configuration
|
|
259
|
+
"""
|
|
260
|
+
name: str
|
|
261
|
+
container_registry_settings: ContainerRegistrySettings
|
|
262
|
+
containers: List[Container]
|
|
263
|
+
compute: ComputeResource
|
|
264
|
+
is_spot: bool = False
|
|
265
|
+
endpoint_base_url: Optional[str] = None
|
|
266
|
+
scaling: Optional[ScalingOptions] = None
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
@dataclass_json(undefined=Undefined.EXCLUDE)
|
|
270
|
+
@dataclass
|
|
271
|
+
class DeploymentInfo:
|
|
227
272
|
"""Configuration for a container deployment.
|
|
273
|
+
This class is read-only and includes system-managed fields.
|
|
228
274
|
|
|
229
275
|
:param name: Name of the deployment
|
|
230
276
|
:param container_registry_settings: Settings for accessing container registry
|
|
@@ -237,7 +283,7 @@ class Deployment:
|
|
|
237
283
|
"""
|
|
238
284
|
name: str
|
|
239
285
|
container_registry_settings: ContainerRegistrySettings
|
|
240
|
-
containers: List[
|
|
286
|
+
containers: List[ContainerInfo]
|
|
241
287
|
compute: ComputeResource
|
|
242
288
|
is_spot: bool = False
|
|
243
289
|
endpoint_base_url: Optional[str] = None
|
|
@@ -359,59 +405,59 @@ class ContainersService:
|
|
|
359
405
|
"""
|
|
360
406
|
self.client = http_client
|
|
361
407
|
|
|
362
|
-
def get_deployments(self) -> List[
|
|
408
|
+
def get_deployments(self) -> List[DeploymentInfo]:
|
|
363
409
|
"""Get all deployments
|
|
364
410
|
|
|
365
411
|
:return: list of deployments
|
|
366
|
-
:rtype: List[
|
|
412
|
+
:rtype: List[DeploymentInfo]
|
|
367
413
|
"""
|
|
368
414
|
response = self.client.get(CONTAINER_DEPLOYMENTS_ENDPOINT)
|
|
369
|
-
return [
|
|
415
|
+
return [DeploymentInfo.from_dict(deployment, infer_missing=True) for deployment in response.json()]
|
|
370
416
|
|
|
371
|
-
def get_deployment_by_name(self, deployment_name: str) ->
|
|
417
|
+
def get_deployment_by_name(self, deployment_name: str) -> DeploymentInfo:
|
|
372
418
|
"""Get a deployment by name
|
|
373
419
|
|
|
374
420
|
:param deployment_name: name of the deployment
|
|
375
421
|
:type deployment_name: str
|
|
376
422
|
:return: deployment
|
|
377
|
-
:rtype:
|
|
423
|
+
:rtype: DeploymentInfo
|
|
378
424
|
"""
|
|
379
425
|
response = self.client.get(
|
|
380
426
|
f"{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}")
|
|
381
|
-
return
|
|
427
|
+
return DeploymentInfo.from_dict(response.json(), infer_missing=True)
|
|
382
428
|
|
|
383
429
|
def create_deployment(
|
|
384
430
|
self,
|
|
385
431
|
deployment: Deployment
|
|
386
|
-
) ->
|
|
432
|
+
) -> DeploymentInfo:
|
|
387
433
|
"""Create a new deployment
|
|
388
434
|
|
|
389
435
|
:param deployment: deployment configuration
|
|
390
436
|
:type deployment: Deployment
|
|
391
437
|
:return: created deployment
|
|
392
|
-
:rtype:
|
|
438
|
+
:rtype: DeploymentInfo
|
|
393
439
|
"""
|
|
394
440
|
response = self.client.post(
|
|
395
441
|
CONTAINER_DEPLOYMENTS_ENDPOINT,
|
|
396
442
|
deployment.to_dict()
|
|
397
443
|
)
|
|
398
|
-
return
|
|
444
|
+
return DeploymentInfo.from_dict(response.json(), infer_missing=True)
|
|
399
445
|
|
|
400
|
-
def update_deployment(self, deployment_name: str, deployment:
|
|
446
|
+
def update_deployment(self, deployment_name: str, deployment: DeploymentInfo) -> DeploymentInfo:
|
|
401
447
|
"""Update an existing deployment
|
|
402
448
|
|
|
403
449
|
:param deployment_name: name of the deployment to update
|
|
404
450
|
:type deployment_name: str
|
|
405
451
|
:param deployment: updated deployment
|
|
406
|
-
:type deployment:
|
|
452
|
+
:type deployment: DeploymentInfo
|
|
407
453
|
:return: updated deployment
|
|
408
|
-
:rtype:
|
|
454
|
+
:rtype: DeploymentInfo
|
|
409
455
|
"""
|
|
410
456
|
response = self.client.patch(
|
|
411
457
|
f"{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}",
|
|
412
458
|
deployment.to_dict()
|
|
413
459
|
)
|
|
414
|
-
return
|
|
460
|
+
return DeploymentInfo.from_dict(response.json(), infer_missing=True)
|
|
415
461
|
|
|
416
462
|
def delete_deployment(self, deployment_name: str) -> None:
|
|
417
463
|
"""Delete a deployment
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datacrunch
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.2
|
|
4
4
|
Summary: Official Python SDK for DataCrunch Public API
|
|
5
5
|
Home-page: https://github.com/DataCrunch-io
|
|
6
6
|
Author: DataCrunch Oy
|
|
7
7
|
Author-email: info@datacrunch.io
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
16
15
|
Classifier: Intended Audience :: Developers
|
|
17
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
18
17
|
Classifier: Operating System :: OS Independent
|
|
19
18
|
Classifier: Natural Language :: English
|
|
20
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.9
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
21
|
License-File: LICENSE
|
|
23
22
|
Requires-Dist: requests<3,>=2.25.1
|
|
23
|
+
Requires-Dist: dataclasses_json>=0.6.7
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Provides-Extra: test
|
|
26
26
|
Requires-Dist: pytest<7,>=6.2.1; extra == "test"
|
|
@@ -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=O4T0tK2yUSk7eJbkIEIYAvXiL4jxBQ2Vs5t1MmaRVOw,18
|
|
3
3
|
datacrunch/constants.py,sha256=uBtS1kTe6ip5oWzA4SKAVftdapkKwUU45GdLYOuBzAA,2354
|
|
4
4
|
datacrunch/datacrunch.py,sha256=lRDasgf_PG_RUFLxSSJZQ4zdV8N-TNlJ1moAwUXYqqI,3141
|
|
5
5
|
datacrunch/exceptions.py,sha256=uOP_YU2HEUi_mcMxQ9WYrIjqWUuUrwdube-RdL1C4Ps,781
|
|
@@ -9,7 +9,7 @@ datacrunch/authentication/authentication.py,sha256=CThTxA99jseh7TKIdUR1M9RErIJoX
|
|
|
9
9
|
datacrunch/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
datacrunch/balance/balance.py,sha256=rkqqXC3MLVxk6ym9Hlp9tsLbLWJculIn8q3BYbsme28,1240
|
|
11
11
|
datacrunch/containers/__init__.py,sha256=T9ROCN-a3rQfboTk3mol4OUhi6FMo5wUqahJZOBg0uw,675
|
|
12
|
-
datacrunch/containers/containers.py,sha256=
|
|
12
|
+
datacrunch/containers/containers.py,sha256=lFTxgTMRAnlYxTFUFbnY1uTiDgNhQVHOgqosm2I1iP4,24147
|
|
13
13
|
datacrunch/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
datacrunch/http_client/http_client.py,sha256=tmpVd3p7-NAIaTM4E13inFZWUetdVEFZnRE38p5eVk0,8285
|
|
15
15
|
datacrunch/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -28,7 +28,7 @@ datacrunch/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
28
28
|
datacrunch/volume_types/volume_types.py,sha256=CNJ8kfd_nxmF99x-UAJeku-uN4Gdh-yg15Aa8WGLgWU,1828
|
|
29
29
|
datacrunch/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
datacrunch/volumes/volumes.py,sha256=aAH4UIVG-7NehjHu-a_4MGSdZ1jmeApV-kKh-X6TB-s,11908
|
|
31
|
-
datacrunch-1.8.
|
|
31
|
+
datacrunch-1.8.2.dist-info/licenses/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
|
|
32
32
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
tests/integration_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
tests/integration_tests/conftest.py,sha256=PWf6K1G3NoddebmDIy_Pk02dHQrEKfrNxpWwqE8Eqrk,546
|
|
@@ -44,7 +44,7 @@ tests/unit_tests/authentication/test_authentication.py,sha256=P84VnD9utk8y3ZPhUf
|
|
|
44
44
|
tests/unit_tests/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
tests/unit_tests/balance/test_balance.py,sha256=Cojbjd7wc9-8eRQb_fR0xLXEX7fGqobdQICH3O7WAx4,651
|
|
46
46
|
tests/unit_tests/containers/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
47
|
-
tests/unit_tests/containers/test_containers.py,sha256=
|
|
47
|
+
tests/unit_tests/containers/test_containers.py,sha256=7pIzHDqZAt3whgqRHSXW3ecwZnWddAj3dc4xUuDMEMI,28499
|
|
48
48
|
tests/unit_tests/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
49
|
tests/unit_tests/http_client/test_http_client.py,sha256=JfEy7pADx0gS9KNNwVLVeG-bG4DRRXxze4dQkP_WIvw,6776
|
|
50
50
|
tests/unit_tests/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -61,7 +61,7 @@ tests/unit_tests/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
61
61
|
tests/unit_tests/volume_types/test_volume_types.py,sha256=vGuC3dWjhQLD8bTYgw_we3dZ6vlUKRmKZbb9yCfhe0w,1386
|
|
62
62
|
tests/unit_tests/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
63
|
tests/unit_tests/volumes/test_volumes.py,sha256=p53eSIHddWKL7U9oLLTnxo849LrJSoi6A5lpWF6ydHs,20672
|
|
64
|
-
datacrunch-1.8.
|
|
65
|
-
datacrunch-1.8.
|
|
66
|
-
datacrunch-1.8.
|
|
67
|
-
datacrunch-1.8.
|
|
64
|
+
datacrunch-1.8.2.dist-info/METADATA,sha256=Fu99nCBQdcQdQzsHd1-lh-s8P6eI3cHbXxF_XSOcNhE,6089
|
|
65
|
+
datacrunch-1.8.2.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
|
|
66
|
+
datacrunch-1.8.2.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
|
|
67
|
+
datacrunch-1.8.2.dist-info/RECORD,,
|
|
@@ -8,10 +8,12 @@ from datacrunch.containers.containers import (
|
|
|
8
8
|
SECRETS_ENDPOINT,
|
|
9
9
|
SERVERLESS_COMPUTE_RESOURCES_ENDPOINT,
|
|
10
10
|
Container,
|
|
11
|
+
ContainerInfo,
|
|
11
12
|
ContainerDeploymentStatus,
|
|
12
13
|
ContainerRegistrySettings,
|
|
13
14
|
ContainersService,
|
|
14
15
|
Deployment,
|
|
16
|
+
DeploymentInfo,
|
|
15
17
|
EnvVar,
|
|
16
18
|
EnvVarType,
|
|
17
19
|
EntrypointOverridesSettings,
|
|
@@ -213,10 +215,10 @@ class TestContainersService:
|
|
|
213
215
|
# assert
|
|
214
216
|
assert type(deployments) == list
|
|
215
217
|
assert len(deployments) == 1
|
|
216
|
-
assert type(deployment) ==
|
|
218
|
+
assert type(deployment) == DeploymentInfo
|
|
217
219
|
assert deployment.name == DEPLOYMENT_NAME
|
|
218
220
|
assert len(deployment.containers) == 1
|
|
219
|
-
assert type(deployment.containers[0]) ==
|
|
221
|
+
assert type(deployment.containers[0]) == ContainerInfo
|
|
220
222
|
assert type(deployment.compute) == ComputeResource
|
|
221
223
|
assert deployment.compute.name == COMPUTE_RESOURCE_NAME
|
|
222
224
|
assert responses.assert_call_count(deployments_endpoint, 1) is True
|
|
@@ -236,7 +238,7 @@ class TestContainersService:
|
|
|
236
238
|
deployment = containers_service.get_deployment_by_name(DEPLOYMENT_NAME)
|
|
237
239
|
|
|
238
240
|
# assert
|
|
239
|
-
assert type(deployment) ==
|
|
241
|
+
assert type(deployment) == DeploymentInfo
|
|
240
242
|
assert deployment.name == DEPLOYMENT_NAME
|
|
241
243
|
assert len(deployment.containers) == 1
|
|
242
244
|
assert deployment.containers[0].name == CONTAINER_NAME
|
|
@@ -273,9 +275,7 @@ class TestContainersService:
|
|
|
273
275
|
status=200
|
|
274
276
|
)
|
|
275
277
|
|
|
276
|
-
# create deployment object
|
|
277
278
|
container = Container(
|
|
278
|
-
name=CONTAINER_NAME,
|
|
279
279
|
image="nginx:latest",
|
|
280
280
|
exposed_port=80,
|
|
281
281
|
healthcheck=HealthcheckSettings(
|
|
@@ -292,6 +292,7 @@ class TestContainersService:
|
|
|
292
292
|
container_registry_settings = ContainerRegistrySettings(
|
|
293
293
|
is_private=False)
|
|
294
294
|
|
|
295
|
+
# create deployment object
|
|
295
296
|
deployment = Deployment(
|
|
296
297
|
name=DEPLOYMENT_NAME,
|
|
297
298
|
container_registry_settings=container_registry_settings,
|
|
@@ -304,7 +305,7 @@ class TestContainersService:
|
|
|
304
305
|
created_deployment = containers_service.create_deployment(deployment)
|
|
305
306
|
|
|
306
307
|
# assert
|
|
307
|
-
assert type(created_deployment) ==
|
|
308
|
+
assert type(created_deployment) == DeploymentInfo
|
|
308
309
|
assert created_deployment.name == DEPLOYMENT_NAME
|
|
309
310
|
assert len(created_deployment.containers) == 1
|
|
310
311
|
assert created_deployment.containers[0].name == CONTAINER_NAME
|
|
@@ -323,7 +324,7 @@ class TestContainersService:
|
|
|
323
324
|
)
|
|
324
325
|
|
|
325
326
|
# create deployment object
|
|
326
|
-
container =
|
|
327
|
+
container = ContainerInfo(
|
|
327
328
|
name=CONTAINER_NAME,
|
|
328
329
|
image="nginx:latest",
|
|
329
330
|
exposed_port=80
|
|
@@ -334,7 +335,7 @@ class TestContainersService:
|
|
|
334
335
|
|
|
335
336
|
compute = ComputeResource(name=COMPUTE_RESOURCE_NAME, size=1)
|
|
336
337
|
|
|
337
|
-
deployment =
|
|
338
|
+
deployment = DeploymentInfo(
|
|
338
339
|
name=DEPLOYMENT_NAME,
|
|
339
340
|
container_registry_settings=container_registry_settings,
|
|
340
341
|
containers=[container],
|
|
@@ -346,7 +347,7 @@ class TestContainersService:
|
|
|
346
347
|
DEPLOYMENT_NAME, deployment)
|
|
347
348
|
|
|
348
349
|
# assert
|
|
349
|
-
assert type(updated_deployment) ==
|
|
350
|
+
assert type(updated_deployment) == DeploymentInfo
|
|
350
351
|
assert updated_deployment.name == DEPLOYMENT_NAME
|
|
351
352
|
assert len(updated_deployment.containers) == 1
|
|
352
353
|
assert updated_deployment.containers[0].name == CONTAINER_NAME
|
|
File without changes
|
|
File without changes
|