From f73debf610c1d1cdcb5febf9246cb92212b17359 Mon Sep 17 00:00:00 2001 From: Tian Xia Date: Wed, 28 Aug 2024 10:00:15 -0700 Subject: [PATCH] [Core][RunPod] Fix list instances in RunPod Provisioner (#3878) * fix * simplify * Revert "simplify" This reverts commit 1057b907755fbb77c2d3ce7ad92dd1ab01e21f8b. --- sky/provision/runpod/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sky/provision/runpod/utils.py b/sky/provision/runpod/utils.py index 24af263f13c..f1587463e84 100644 --- a/sky/provision/runpod/utils.py +++ b/sky/provision/runpod/utils.py @@ -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')): for port in instance['runtime']['ports']: if port['isIpPublic']: if port['privatePort'] == 22: