Skip to content

Commit

Permalink
fix: allow unknown flavors in cost estimation (#1377)
Browse files Browse the repository at this point in the history
  • Loading branch information
davdhacs authored Sep 9, 2024
1 parent 80cea0b commit 7f1c863
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/cost-estimation/render_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
DAILY_COST_MAP = {
"demo": 33,
"gke-default": 10,
"ibmroks": 56,
"openshift-4": 29,
"openshift-4-demo": 53,
"openshift-4-perf-scale": 70,
"openshift-multi": 10,
"osd-on-gcp": 35,
"qa-demo": 33,
"osd-on-aws": 50,
"rosa": 97,
"rosa": 40,
"rosahcp": 23,
"eks": 13,
"aks": 17,
"aro": 53,
"unknown": 25,
}

def read_usage_from_stdin():
Expand All @@ -39,7 +42,10 @@ def calculate_costs(usage):
"total usage (days)": x["total_days_consumed"],
}

current["cost (usd)"] = float(x["total_days_consumed"]) * DAILY_COST_MAP[x["flavor"]]
try:
current["cost (usd)"] = float(x["total_days_consumed"]) * DAILY_COST_MAP[x["flavor"]]
except KeyError:
current["cost (usd)"] = float(x["total_days_consumed"]) * DAILY_COST_MAP["unknown"]
costs.append(current)

return costs
Expand Down

0 comments on commit 7f1c863

Please sign in to comment.