Skip to content

Commit

Permalink
Bringing back the old isntance type format to satisfy the parser
Browse files Browse the repository at this point in the history
  • Loading branch information
kristopolous committed Jan 31, 2025
1 parent 369b502 commit b7b1889
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sky/clouds/service_catalog/data_fetchers/fetch_vast.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

def create_instance_type(obj: Dict[str, Any]) -> str:
stubify = lambda x: re.sub(r'\s', '_', x)
return '{}x-{}'.format(obj['num_gpus'], stubify(obj['gpu_name']))
return '{}x-{}-{}-{}'.format(obj['num_gpus'], stubify(obj['gpu_name']),
obj['cpu_cores'], obj['cpu_ram'])


def dot_get(d: dict, key: str) -> Any:
Expand All @@ -36,6 +37,7 @@ def dot_get(d: dict, key: str) -> Any:


if __name__ == '__main__':
seen = set()
# InstanceType and gpuInfo are basically just stubs
# so that the dictwriter is happy without weird
# code.
Expand Down Expand Up @@ -134,5 +136,8 @@ def dot_get(d: dict, key: str) -> Any:

maxBid = max([x.get('SpotPrice') for x in toList])
for instance in toList:
instance['SpotPrice'] = '{:.2f}'.format(maxBid)
writer.writerow(instance)
stub = f'{instance["InstanceType"]} {instance["Region"][-2:]}'
if stub not in seen:
instance['SpotPrice'] = '{:.2f}'.format(maxBid)
writer.writerow(instance)
seen.add(stub)

0 comments on commit b7b1889

Please sign in to comment.