From 8184f2afbdd3dbcfdaa6e42002087ad59c882731 Mon Sep 17 00:00:00 2001 From: Zhanghao Wu Date: Tue, 26 Sep 2023 18:39:42 -0700 Subject: [PATCH] [Catalog] Fix aws catalog fetcher for removed offerings (#2610) * Fix aws catalog fetcher for removed offerings * lint --- sky/clouds/service_catalog/data_fetchers/fetch_aws.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sky/clouds/service_catalog/data_fetchers/fetch_aws.py b/sky/clouds/service_catalog/data_fetchers/fetch_aws.py index fdd63ef6144..745e4ad94f3 100644 --- a/sky/clouds/service_catalog/data_fetchers/fetch_aws.py +++ b/sky/clouds/service_catalog/data_fetchers/fetch_aws.py @@ -10,6 +10,7 @@ import subprocess import sys import textwrap +import traceback from typing import Dict, List, Optional, Set, Tuple, Union import numpy as np @@ -265,7 +266,12 @@ def get_acc_info(row) -> Tuple[Optional[str], float]: def get_vcpus(row) -> float: if not np.isnan(row['vCPU']): return float(row['vCPU']) - return float(row['VCpuInfo']['DefaultVCpus']) + try: + return float(row['VCpuInfo']['DefaultVCpus']) + except Exception as e: # pylint: disable=broad-except + print('Error occured for row:', row) + print('Error:', e) + raise def get_memory_gib(row) -> float: if isinstance(row['MemoryInfo'], dict): @@ -303,7 +309,7 @@ def get_additional_columns(row) -> pd.Series: df = df.merge(spot_pricing_df, left_on=['InstanceType', 'AvailabilityZoneName'], right_index=True, - how='outer') + how='left') # Extract vCPUs, memory, and accelerator info from the columns. df = pd.concat( @@ -316,6 +322,7 @@ def get_additional_columns(row) -> pd.Series: df['GpuInfo'] = np.nan df = df[USEFUL_COLUMNS] except Exception as e: # pylint: disable=broad-except + print(traceback.format_exc()) print(f'{region} failed with {e}', file=sys.stderr) return region return df