diff --git a/nemo_run/run/ray/templates/ray.sub.j2 b/nemo_run/run/ray/templates/ray.sub.j2 index 292bff0b..bdc917b7 100644 --- a/nemo_run/run/ray/templates/ray.sub.j2 +++ b/nemo_run/run/ray/templates/ray.sub.j2 @@ -88,7 +88,7 @@ nodes_array=($nodes) ip_addresses_array=() for node in $nodes; do - ip_address=$(host $node | awk '/has address/ { print $4 }') + ip_address=$(getent hosts "$node" | awk '{print $1}' | head -n1) # Add the IP address to the array ip_addresses_array+=("$ip_address") done diff --git a/test/core/execution/artifacts/expected_ray_cluster.sub b/test/core/execution/artifacts/expected_ray_cluster.sub index bdefc288..ef0d1367 100644 --- a/test/core/execution/artifacts/expected_ray_cluster.sub +++ b/test/core/execution/artifacts/expected_ray_cluster.sub @@ -90,7 +90,7 @@ nodes_array=($nodes) ip_addresses_array=() for node in $nodes; do - ip_address=$(host $node | awk '/has address/ { print $4 }') + ip_address=$(getent hosts "$node" | awk '{print $1}' | head -n1) # Add the IP address to the array ip_addresses_array+=("$ip_address") done diff --git a/test/core/execution/artifacts/expected_ray_cluster_ssh.sub b/test/core/execution/artifacts/expected_ray_cluster_ssh.sub index 948cd6ea..cb12ffaa 100644 --- a/test/core/execution/artifacts/expected_ray_cluster_ssh.sub +++ b/test/core/execution/artifacts/expected_ray_cluster_ssh.sub @@ -91,7 +91,7 @@ nodes_array=($nodes) ip_addresses_array=() for node in $nodes; do - ip_address=$(host $node | awk '/has address/ { print $4 }') + ip_address=$(getent hosts "$node" | awk '{print $1}' | head -n1) # Add the IP address to the array ip_addresses_array+=("$ip_address") done