Skip to content

Commit

Permalink
Vast: ordering the ports
Browse files Browse the repository at this point in the history
  • Loading branch information
kristopolous committed Nov 22, 2024
1 parent 3e7a963 commit 00c1432
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sky/provision/vast/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,18 @@ def get_ssh_ports(cluster_name) -> List[int]:

for instance in instances.values():
if instance['name'] in possible_names:
ssh_ports.append(instance['ssh_port'])
ssh_ports.append((instance['name'], instance['ssh_port']))
assert ssh_ports, (
f'Could not find any instances for cluster {cluster_name}.')

# So now we have
# [(name, port) ... ]
#
# We want to put head first and otherwise sort numerically
# and then extract the ports.
ssh_ports = list(
x[1]
for x in sorted(ssh_ports,
key=lambda x: -1
if x[0].endswith('head') else int(x[0].split('-')[-1])))
return ssh_ports

0 comments on commit 00c1432

Please sign in to comment.