datacrunch 1.6.0__py3-none-any.whl → 1.7.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 CHANGED
@@ -1 +1 @@
1
- VERSION = '1.6.0'
1
+ VERSION = '1.7.0'
datacrunch/constants.py CHANGED
@@ -13,7 +13,7 @@ class VolumeActions:
13
13
  ATTACH = 'attach'
14
14
  DETACH = 'detach'
15
15
  RENAME = 'rename'
16
- INCREASE_SIZE = 'increase-size'
16
+ INCREASE_SIZE = 'resize'
17
17
  DELETE = 'delete'
18
18
  CLONE = 'clone'
19
19
 
@@ -9,6 +9,7 @@ class InstanceType:
9
9
  id: str,
10
10
  instance_type: str,
11
11
  price_per_hour: float,
12
+ spot_price_per_hour: float,
12
13
  description: str,
13
14
  cpu: dict,
14
15
  gpu: dict,
@@ -23,6 +24,8 @@ class InstanceType:
23
24
  :type instance_type: str
24
25
  :param price_per_hour: price per hour
25
26
  :type price_per_hour: float
27
+ :param spot_price_per_hour: spot price per hour
28
+ :type spot_price_per_hour: float
26
29
  :param description: instance type description
27
30
  :type description: str
28
31
  :param cpu: cpu details
@@ -39,6 +42,7 @@ class InstanceType:
39
42
  self._id = id
40
43
  self._instance_type = instance_type
41
44
  self._price_per_hour = float(price_per_hour)
45
+ self._spot_price_per_hour = float(spot_price_per_hour)
42
46
  self._description = description
43
47
  self._cpu = cpu
44
48
  self._gpu = gpu
@@ -73,6 +77,15 @@ class InstanceType:
73
77
  """
74
78
  return self._price_per_hour
75
79
 
80
+ @property
81
+ def spot_price_per_hour(self) -> float:
82
+ """Get the instance spot price per hour
83
+
84
+ :return: spot price per hour
85
+ :rtype: float
86
+ """
87
+ return self._spot_price_per_hour
88
+
76
89
  @property
77
90
  def description(self) -> str:
78
91
  """Get the instance type description
@@ -136,6 +149,7 @@ class InstanceType:
136
149
  return (f'id: {self._id}\n'
137
150
  f'instance type: {self._instance_type}\n'
138
151
  f'price_per_hour: ${self._price_per_hour}\n'
152
+ f'spot_price_per_hour: ${self._spot_price_per_hour}\n'
139
153
  f'description: {self._description}\n'
140
154
  f'cpu: {self._cpu}\n'
141
155
  f'gpu: {self._gpu}\n'
@@ -162,6 +176,7 @@ class InstanceTypesService:
162
176
  id=instance_type['id'],
163
177
  instance_type=instance_type['instance_type'],
164
178
  price_per_hour=instance_type['price_per_hour'],
179
+ spot_price_per_hour=instance_type['spot_price'],
165
180
  description=instance_type['description'],
166
181
  cpu=instance_type['cpu'],
167
182
  gpu=instance_type['gpu'],
@@ -179,7 +179,21 @@ class Volume:
179
179
  :return: Volume
180
180
  :rtype: Volume
181
181
  """
182
- return cls(**volume_dict)
182
+
183
+ return cls(
184
+ id = volume_dict['id'],
185
+ status = volume_dict['status'],
186
+ name = volume_dict['name'],
187
+ size = volume_dict['size'],
188
+ type = volume_dict['type'],
189
+ is_os_volume = volume_dict['is_os_volume'],
190
+ created_at = volume_dict['created_at'],
191
+ target = volume_dict['target'],
192
+ location = volume_dict['location'],
193
+ instance_id = volume_dict['instance_id'],
194
+ ssh_key_ids = volume_dict['ssh_key_ids'],
195
+ deleted_at = volume_dict.get('deleted_at'),
196
+ )
183
197
 
184
198
  def __str__(self) -> str:
185
199
  """Returns a string of the json representation of the volume
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datacrunch
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Official Python SDK for DataCrunch Public API
5
5
  Home-page: https://github.com/DataCrunch-io
6
6
  Author: DataCrunch Oy
@@ -20,13 +20,13 @@ Classifier: Natural Language :: English
20
20
  Requires-Python: >=3.6
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
- Requires-Dist: requests <3,>=2.25.1
23
+ Requires-Dist: requests<3,>=2.25.1
24
24
  Provides-Extra: dev
25
25
  Provides-Extra: test
26
- Requires-Dist: pytest <7,>=6.2.1 ; extra == 'test'
27
- Requires-Dist: pytest-cov <3,>=2.10.1 ; extra == 'test'
28
- Requires-Dist: pytest-responses <1,>=0.4.0 ; extra == 'test'
29
- Requires-Dist: responses <1,>=0.12.1 ; extra == 'test'
26
+ Requires-Dist: pytest<7,>=6.2.1; extra == "test"
27
+ Requires-Dist: pytest-cov<3,>=2.10.1; extra == "test"
28
+ Requires-Dist: pytest-responses<1,>=0.4.0; extra == "test"
29
+ Requires-Dist: responses<1,>=0.12.1; extra == "test"
30
30
 
31
31
  # DataCrunch Python SDK
32
32
 
@@ -1,6 +1,6 @@
1
1
  datacrunch/__init__.py,sha256=OG-5Avmuq3NXyBs_66GMwyzscUi0c-T6vWW5sRIfnZg,51
2
- datacrunch/__version__.py,sha256=2Sgdn0cIyeJqQJLhe7xBocPdlxnfeDXK0xpKZZBnf64,18
3
- datacrunch/constants.py,sha256=QxV-xp0fa8Q52idsEknwuexYnXTN9wNlzAjs3mG9ICE,2361
2
+ datacrunch/__version__.py,sha256=QQ5zfyEqpDHVIxQknvlXhMcoyjCpps5a0drNyuuGZO8,18
3
+ datacrunch/constants.py,sha256=uBtS1kTe6ip5oWzA4SKAVftdapkKwUU45GdLYOuBzAA,2354
4
4
  datacrunch/datacrunch.py,sha256=dFSaeh1_xrfAc4lOqu1vGxxUtRpn7BdAbnW2mHKAHgU,2898
5
5
  datacrunch/exceptions.py,sha256=uOP_YU2HEUi_mcMxQ9WYrIjqWUuUrwdube-RdL1C4Ps,781
6
6
  datacrunch/helpers.py,sha256=Eq5htNxpJUCJG9D6QxbnWwch3ppmi2lfi-rFCGXf3fs,634
@@ -13,7 +13,7 @@ datacrunch/http_client/http_client.py,sha256=6A35jNH6BHRZCL_3yst8ud82lsnpM-GFore
13
13
  datacrunch/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  datacrunch/images/images.py,sha256=hCAtSzozHcAAJ_UZOvnAbQSEU7BfCuixpIsmcd2RM2k,2167
15
15
  datacrunch/instance_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- datacrunch/instance_types/instance_types.py,sha256=ywrlzJQrvic8nB6Ax4ryf_KxxqcpMqWHSMrP9GZBaO8,4732
16
+ datacrunch/instance_types/instance_types.py,sha256=NLkUI6UdfXg-zDkMu9j9RzVISLG8jdABhT_R7XpfBdA,5289
17
17
  datacrunch/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  datacrunch/instances/instances.py,sha256=jkaVfSMiXpeSZcP1pOFZq1rkn2_2T4lfhT-NDr-7j0A,15306
19
19
  datacrunch/locations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -25,7 +25,7 @@ datacrunch/startup_scripts/startup_scripts.py,sha256=EnWiuT48uN_soVHpbnDMUQ9kab2
25
25
  datacrunch/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  datacrunch/volume_types/volume_types.py,sha256=CNJ8kfd_nxmF99x-UAJeku-uN4Gdh-yg15Aa8WGLgWU,1828
27
27
  datacrunch/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- datacrunch/volumes/volumes.py,sha256=X6vxwp05QHS0iFZbLjYV78NubHvsUiZdoCavpjnMP60,11347
28
+ datacrunch/volumes/volumes.py,sha256=aAH4UIVG-7NehjHu-a_4MGSdZ1jmeApV-kKh-X6TB-s,11908
29
29
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  tests/integration_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  tests/integration_tests/conftest.py,sha256=PWf6K1G3NoddebmDIy_Pk02dHQrEKfrNxpWwqE8Eqrk,546
@@ -45,7 +45,7 @@ tests/unit_tests/http_client/test_http_client.py,sha256=JfEy7pADx0gS9KNNwVLVeG-b
45
45
  tests/unit_tests/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  tests/unit_tests/images/test_images.py,sha256=Tbsu5U1bUoD66ATibUWmipDmHYvhScI2XRzKtt-I-qg,1204
47
47
  tests/unit_tests/instance_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- tests/unit_tests/instance_types/test_instance_types.py,sha256=y0J7OEr5hCiz7F9_qycsbMcTN2ViHMn5D9wFJsxpzuI,3178
48
+ tests/unit_tests/instance_types/test_instance_types.py,sha256=DHpzSDG91Y8BOT5OVq5sKoO-akKRBK-X04c6_35HtGQ,3310
49
49
  tests/unit_tests/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  tests/unit_tests/instances/test_instances.py,sha256=UYClrgJV76IX32Y-ATUgorCoKjjqIsa9MQ04If6RXM4,16892
51
51
  tests/unit_tests/ssh_keys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -56,8 +56,8 @@ tests/unit_tests/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
56
56
  tests/unit_tests/volume_types/test_volume_types.py,sha256=vGuC3dWjhQLD8bTYgw_we3dZ6vlUKRmKZbb9yCfhe0w,1386
57
57
  tests/unit_tests/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  tests/unit_tests/volumes/test_volumes.py,sha256=p53eSIHddWKL7U9oLLTnxo849LrJSoi6A5lpWF6ydHs,20672
59
- datacrunch-1.6.0.dist-info/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
60
- datacrunch-1.6.0.dist-info/METADATA,sha256=XbE82VGp4UvNVm9Z_laIUAzNChKrwmfch-CCSuabXH8,5941
61
- datacrunch-1.6.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
62
- datacrunch-1.6.0.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
63
- datacrunch-1.6.0.dist-info/RECORD,,
59
+ datacrunch-1.7.0.dist-info/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
60
+ datacrunch-1.7.0.dist-info/METADATA,sha256=P9QVlSJlKOssEJARerj90R54NGe-B64LUXM985uT7wg,5932
61
+ datacrunch-1.7.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
62
+ datacrunch-1.7.0.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
63
+ datacrunch-1.7.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -15,6 +15,7 @@ STORAGE_DESCRIPTION = "1800GB NVME"
15
15
  STORAGE_SIZE = 1800
16
16
  INSTANCE_TYPE_DESCRIPTION = "Dedicated Bare metal Server"
17
17
  PRICE_PER_HOUR = 5.0
18
+ SPOT_PRICE_PER_HOUR = 2.5
18
19
  INSTANCE_TYPE = "8V100.48M"
19
20
 
20
21
 
@@ -48,6 +49,7 @@ def test_instance_types(http_client):
48
49
  },
49
50
  "description": INSTANCE_TYPE_DESCRIPTION,
50
51
  "price_per_hour": "5.00",
52
+ "spot_price": "2.50",
51
53
  "instance_type": INSTANCE_TYPE
52
54
  }
53
55
  ],
@@ -67,6 +69,7 @@ def test_instance_types(http_client):
67
69
  assert instance_type.id == TYPE_ID
68
70
  assert instance_type.description == INSTANCE_TYPE_DESCRIPTION
69
71
  assert instance_type.price_per_hour == PRICE_PER_HOUR
72
+ assert instance_type.spot_price_per_hour == SPOT_PRICE_PER_HOUR
70
73
  assert instance_type.instance_type == INSTANCE_TYPE
71
74
  assert type(instance_type.cpu) == dict
72
75
  assert type(instance_type.gpu) == dict