Skip to content

Commit

Permalink
remove zone from azure
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Oct 9, 2022
1 parent 42d51d3 commit 54869e2
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions sky/clouds/service_catalog/data_fetchers/fetch_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

USEFUL_COLUMNS = [
'InstanceType', 'AcceleratorName', 'AcceleratorCount', 'vCPUs', 'MemoryGiB',
'GpuInfo', 'Price', 'SpotPrice', 'Region', 'AvailabilityZone', 'Generation',
'GpuInfo', 'Price', 'SpotPrice', 'Region', 'Generation',
'capabilities'
]

Expand Down Expand Up @@ -102,23 +102,14 @@ def get_sku_df() -> pd.DataFrame:
)
print(f'Done fetching SKUs')
items = json.loads(proc.stdout.decode('ascii'))
new_items = []
for item in items:
zones = item['locationInfo'][0]['zones']
# zones = item['locationInfo'][0]['zones']
region = item['locations'][0]
if region not in REGION_SET:
continue
if len(zones) == 0:
# The default zone is '0'.
zones = ['0']
item['Region'] = region

for zone in zones:
new_item = item.copy()
new_item['Region'] = region
new_item['AvailabilityZone'] = f'{region}-{zone}'
new_items.append(new_item)

df = pd.DataFrame(new_items)
df = pd.DataFrame(items)
df = df[(df['resourceType'] == 'virtualMachines')]
return df

Expand Down Expand Up @@ -229,7 +220,7 @@ def get_additional_columns(row):
)

before_drop_len = len(df_ret)
df_ret.dropna(subset=['InstanceType', 'AvailabilityZone'],
df_ret.dropna(subset=['InstanceType'],
inplace=True,
how='all')
after_drop_len = len(df_ret)
Expand Down

0 comments on commit 54869e2

Please sign in to comment.