Skip to content

Commit e9c374c

Browse files
committed
Merge branch 'release/1.6.1'
2 parents 29c2560 + ed174ae commit e9c374c

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
v1.6.1 (2023-10-02)
5+
-------------------
6+
7+
* Added spot price to instance types
8+
49
v1.6.0 (2023-09-15)
510
-------------------
611

datacrunch/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '1.6.0'
1+
VERSION = '1.6.1'

datacrunch/instance_types/instance_types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def __init__(self,
99
id: str,
1010
instance_type: str,
1111
price_per_hour: float,
12+
spot_price_per_hour: float,
1213
description: str,
1314
cpu: dict,
1415
gpu: dict,
@@ -23,6 +24,8 @@ def __init__(self,
2324
:type instance_type: str
2425
:param price_per_hour: price per hour
2526
:type price_per_hour: float
27+
:param spot_price_per_hour: spot price per hour
28+
:type spot_price_per_hour: float
2629
:param description: instance type description
2730
:type description: str
2831
:param cpu: cpu details
@@ -39,6 +42,7 @@ def __init__(self,
3942
self._id = id
4043
self._instance_type = instance_type
4144
self._price_per_hour = float(price_per_hour)
45+
self._spot_price_per_hour = float(spot_price_per_hour)
4246
self._description = description
4347
self._cpu = cpu
4448
self._gpu = gpu
@@ -73,6 +77,15 @@ def price_per_hour(self) -> float:
7377
"""
7478
return self._price_per_hour
7579

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+
7689
@property
7790
def description(self) -> str:
7891
"""Get the instance type description
@@ -136,6 +149,7 @@ def __str__(self) -> str:
136149
return (f'id: {self._id}\n'
137150
f'instance type: {self._instance_type}\n'
138151
f'price_per_hour: ${self._price_per_hour}\n'
152+
f'spot_price_per_hour: ${self._spot_price_per_hour}\n'
139153
f'description: {self._description}\n'
140154
f'cpu: {self._cpu}\n'
141155
f'gpu: {self._gpu}\n'
@@ -162,6 +176,7 @@ def get(self) -> List[InstanceType]:
162176
id=instance_type['id'],
163177
instance_type=instance_type['instance_type'],
164178
price_per_hour=instance_type['price_per_hour'],
179+
spot_price_per_hour=instance_type['spot_price'],
165180
description=instance_type['description'],
166181
cpu=instance_type['cpu'],
167182
gpu=instance_type['gpu'],

tests/unit_tests/instance_types/test_instance_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
STORAGE_SIZE = 1800
1616
INSTANCE_TYPE_DESCRIPTION = "Dedicated Bare metal Server"
1717
PRICE_PER_HOUR = 5.0
18+
SPOT_PRICE_PER_HOUR = 2.5
1819
INSTANCE_TYPE = "8V100.48M"
1920

2021

@@ -48,6 +49,7 @@ def test_instance_types(http_client):
4849
},
4950
"description": INSTANCE_TYPE_DESCRIPTION,
5051
"price_per_hour": "5.00",
52+
"spot_price": "2.50",
5153
"instance_type": INSTANCE_TYPE
5254
}
5355
],
@@ -67,6 +69,7 @@ def test_instance_types(http_client):
6769
assert instance_type.id == TYPE_ID
6870
assert instance_type.description == INSTANCE_TYPE_DESCRIPTION
6971
assert instance_type.price_per_hour == PRICE_PER_HOUR
72+
assert instance_type.spot_price_per_hour == SPOT_PRICE_PER_HOUR
7073
assert instance_type.instance_type == INSTANCE_TYPE
7174
assert type(instance_type.cpu) == dict
7275
assert type(instance_type.gpu) == dict

0 commit comments

Comments
 (0)