Skip to content

Commit 9301d36

Browse files
authored
fix: ulimit in ray.sub respect hard limit (#1011)
Signed-off-by: Terry Kong <[email protected]>
1 parent 157b254 commit 9301d36

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ray.sub

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ DASHBOARD_AGENT_LISTEN_PORT=${DASHBOARD_AGENT_LISTEN_PORT:-52365}
6969
# Setting ulimit is recommended by ray best practices page
7070
# @ https://docs.ray.io/en/latest/cluster/vms/user-guides/large-cluster-best-practices.html
7171
# It's session based and won't affect the system outside the script
72-
ulimit -Sn 65535
72+
# Ensure that the soft limit isn't above the hard limit
73+
if [[ $(ulimit -Hn) == "unlimited" ]] || [[ 65535 -lt $(ulimit -Hn) ]]; then
74+
ulimit -Sn 65535
75+
elif [[ $(ulimit -Hn) != "unlimited" ]] && [[ $(ulimit -Hn) -lt 65535 ]]; then
76+
echo "[WARNING]: Cannot increase ulimit on file descriptors to 65535 according ray recommendation: https://docs.ray.io/en/latest/cluster/vms/user-guides/large-cluster-best-practices.html. Speak to cluster admins to increase, otherwise ray may crash unexpectedly."
77+
fi
7378

7479
# On our clusters, the largest port range on an idle worker appeared between 52369-64607
7580
# (not including the other ports set by this script). So this range is chosen to be

0 commit comments

Comments
 (0)