Skip to content

Commit 41adf7a

Browse files
committed
Added spot price to instance types
1 parent 0bb4ce6 commit 41adf7a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.rst

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

4+
* Added spot price to instance types
5+
46
v1.6.0 (2023-09-15)
57
-------------------
68

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'],

0 commit comments

Comments
 (0)