Skip to content

Commit

Permalink
[Catalog] Fix aws catalog fetcher for removed offerings (#2610)
Browse files Browse the repository at this point in the history
* Fix aws catalog fetcher for removed offerings

* lint
  • Loading branch information
Michaelvll authored Sep 27, 2023
1 parent f2e6f1e commit 8184f2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sky/clouds/service_catalog/data_fetchers/fetch_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit 8184f2a

Please sign in to comment.