Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cblmemo committed Mar 2, 2023
1 parent b70f86f commit b7548ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions sky/clouds/service_catalog/data_fetchers/fetch_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def get_additional_columns(row):


def get_all_regions_storage_df(region_set: Set[str]):
df_storage = get_all_regions_pricing_df.remote('Storage', region_set)
df_storage = ray.get([get_all_regions_pricing_df.remote('Storage', region_set)])[0]
df_storage.drop_duplicates(inplace=True)
df_storage = df_storage[df_storage['unitPrice'] > 0]
# only default storage is used by sky
Expand All @@ -265,11 +265,14 @@ def __init__(self) -> None:
# name -> (region, tiered_price_dict)
storage_dict: Dict[str, DiskInfo] = collections.defaultdict(DiskInfo)
for _, row in df_storage.iterrows():
name = row['meterId']
name = row['skuId']
region = row['armRegionName']
price = row['unitPrice']
tier_minimum = row['tierMinimumUnits']
storage_dict[name].region = region
tier_minimum = int(row['tierMinimumUnits'])
if storage_dict[name].region == '':
storage_dict[name].region = region
else:
assert storage_dict[name].region == region
storage_dict[name].price[tier_minimum] = price
df = pd.DataFrame(columns=['Name', 'Region', 'Price'])
for name, info in storage_dict.items():
Expand Down
2 changes: 1 addition & 1 deletion sky/clouds/service_catalog/data_fetchers/fetch_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _get_tired_price(unit_price: Dict[str, Any]) -> float:
# tierMinimumUnits -> unitPrice
price: Dict[int, float] = dict()
for tier in pricing_info['tieredRates']:
price[tier['startUsageAmount']] = _get_tired_price(tier['unitPrice'])
price[int(tier['startUsageAmount'])] = _get_tired_price(tier['unitPrice'])
return str(price)


Expand Down

0 comments on commit b7548ab

Please sign in to comment.