We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4c9aff9 commit 2b3e658Copy full SHA for 2b3e658
sky/provision/vast/utils.py
@@ -93,8 +93,18 @@ def get_ssh_ports(cluster_name) -> List[int]:
93
94
for instance in instances.values():
95
if instance['name'] in possible_names:
96
- ssh_ports.append(instance['ssh_port'])
+ ssh_ports.append((instance['name'], instance['ssh_port']))
97
assert ssh_ports, (
98
f'Could not find any instances for cluster {cluster_name}.')
99
100
+ # So now we have
101
+ # [(name, port) ... ]
102
+ #
103
+ # We want to put head first and otherwise sort numerically
104
+ # and then extract the ports.
105
+ ssh_ports = list(
106
+ x[1]
107
+ for x in sorted(ssh_ports,
108
+ key=lambda x: -1
109
+ if x[0].endswith('head') else int(x[0].split('-')[-1])))
110
return ssh_ports
0 commit comments