Skip to content

Commit

Permalink
Throw error gracefully when instance type definitions are not present
Browse files Browse the repository at this point in the history
  • Loading branch information
Ram Srivatsa Kannan committed Nov 2, 2023
1 parent 241ec5b commit 8a212ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions service_capacity_modeling/capacity_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,25 @@ def _set_instance_objects(
):
if desires.current_clusters:
for zonal_cluster_capacity in desires.current_clusters.zonal:
zonal_cluster_capacity.cluster_instance = hardware.instances[
zonal_cluster_capacity.cluster_instance_name
]
if zonal_cluster_capacity.cluster_instance_name in hardware.instances:
zonal_cluster_capacity.cluster_instance = hardware.instances[
zonal_cluster_capacity.cluster_instance_name
]
else:
raise ValueError(
f"Model not trained to right size cass clusters that are of "
f"instance types {zonal_cluster_capacity.cluster_instance_name}"
)
for regional_cluster_capacity in desires.current_clusters.regional:
regional_cluster_capacity.cluster_instance = hardware.instances[
regional_cluster_capacity.cluster_instance_name
]
if regional_cluster_capacity.cluster_instance_name in hardware.instances:
regional_cluster_capacity.cluster_instance = hardware.instances[
regional_cluster_capacity.cluster_instance_name
]
else:
raise ValueError(
f"Model not trained to right size cass clusters that are of "
f"instance types {regional_cluster_capacity.cluster_instance_name}"
)


def _allow_instance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"m5.2xlarge": {"annual_cost": 1264.6},
"m5.4xlarge": {"annual_cost": 2529.7},
"m5.8xlarge": {"annual_cost": 5059.33},
"m5.12xlarge": {"annual_cost": 7589.1},
"m6i.large": {"annual_cost": 332.0},
"m6i.xlarge": {"annual_cost": 664.0},
"m6i.2xlarge": {"annual_cost": 1328.00},
Expand Down Expand Up @@ -45,7 +46,6 @@
"m5d.2xlarge": {"annual_cost": 1488.6},
"m5d.4xlarge": {"annual_cost": 2977.7},
"m5d.8xlarge": {"annual_cost": 5955},
"m5d.12xlarge": {"annual_cost": 8933.1},
"m6id.large": {"annual_cost": 390.67},
"m6id.xlarge": {"annual_cost": 781.66},
"m6id.2xlarge": {"annual_cost": 1563.32},
Expand Down

0 comments on commit 8a212ca

Please sign in to comment.