diff --git a/sky/backends/cloud_vm_ray_backend.py b/sky/backends/cloud_vm_ray_backend.py index 813605e82d8..cfb333c6e4d 100644 --- a/sky/backends/cloud_vm_ray_backend.py +++ b/sky/backends/cloud_vm_ray_backend.py @@ -3034,11 +3034,13 @@ def _setup(self, handle: CloudVmRayResourceHandle, task: task_lib.Task, if task.setup is None: return - + stable_cluster_internal_ips = handle.internal_ips() sky_env_vars_dict = {} - sky_env_vars_dict["SKYPILOT_NODE_IPS"] = "\\n".join(stable_cluster_internal_ips) - sky_env_vars_dict["SKYPILOT_NODE_RANK"] = """$(expr $(printf ${SKYPILOT_NODE_IPS} | grep -n "$(hostname -i)" | awk -F: '{print $1}') - 1)""" + sky_env_vars_dict["SKYPILOT_NODE_IPS"] = "\\n".join( + stable_cluster_internal_ips) + sky_env_vars_dict[ + "SKYPILOT_NODE_RANK"] = """$(expr $(printf ${SKYPILOT_NODE_IPS} | grep -n "$(hostname -i)" | awk -F: '{print $1}') - 1)""" env_vars = {**task.envs, **sky_env_vars_dict} setup_script = log_lib.make_task_bash_script(task.setup, env_vars=env_vars)