Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core][RunPod] Fix list instances in RunPod Provisioner #3878

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sky/provision/runpod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ def list_instances() -> Dict[str, Dict[str, Any]]:
info['name'] = instance['name']
info['port2endpoint'] = {}

if instance['desiredStatus'] == 'RUNNING' and instance.get('runtime'):
# Sometimes when the cluster is in the process of being created,
# the `port` field in the runtime is None and we need to check for it.
if (instance['desiredStatus'] == 'RUNNING' and
instance.get('runtime') and
instance.get('runtime').get('ports')):
Comment on lines +80 to +84
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, do we need to retry until the port is available, instead of just skipping it? Otherwise, our provision may stuck?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually already have such logic in the provision lib:

# Wait for instances to be ready.
while True:
instances = _filter_instances(cluster_name_on_cloud, ['RUNNING'])
ready_instance_cnt = 0
for instance_id, instance in instances.items():
if instance.get('ssh_port') is not None:
ready_instance_cnt += 1
logger.info('Waiting for instances to be ready: '
f'({ready_instance_cnt}/{config.count}).')
if ready_instance_cnt == config.count:
break

for port in instance['runtime']['ports']:
if port['isIpPublic']:
if port['privatePort'] == 22:
Expand Down
Loading