Ray获取头节点Redis地址
Ray Get Head Node Redis Address
我想 运行 对具有多个节点的集群进行 ray。我只能向集群提交非交互式作业,所以我不确定如何在作业 运行ning.
期间以编程方式获取 redis 地址
我很确定在多个节点上启动ray的方式是这样的:
ray start --head
for host in $(srun hostname | grep -v $(hostname)); do
ssh $host ray start --redis-address=$redis_address
done
但是我需要知道头节点的redis地址。当您启动头节点时,它会打印:
Started Ray on this node. You can add additional nodes to the cluster by calling
ray start --redis-address 8.8.8.8:59465
from the node you wish to add. You can connect a driver to the cluster from Python by running
import ray
ray.init(redis_address="8.8.8.8:59465")
If you have trouble connecting from a different machine, check that your firewall is configured properly. If you wish to terminate the processes that have been started, run
我正计划捕获 ray start --head &> tee redis_port.txt
之类的输出,然后 grep
在 redis_address.txt
中查找 redis 地址,但似乎没有捕获到那部分输出在 redis_address.txt
中,我查看了 ray 会话创建的临时目录中的所有 .out
和 .err
文件,其中 none 也有。
一定有更好的方法来做到这一点。找到头节点的redis端口的预期方法是什么?
在 Robert 的帮助下在评论中解决了 so I'm going to post the code that I used based on his advice.
似乎最好的方法就是选择一个常量端口。唯一的潜在问题是同一台机器上的另一个 user/process 是否正在使用同一个端口。在那种情况下,您可能想尝试生成端口,直到找到一个未使用的端口。
我建议使用 ray start
命令将每个节点所需的任何设置放入脚本中,例如
redis_address="$(hostname --ip-address)"
redis_address="$redis_address:59465"
ray start --head --redis-port=59465
for host in $(srun hostname | grep -v $(hostname)); do
ssh $host ./setup_node.sh $redis_address
done
其中 setup_node.sh
是
# any required setup
# ...
ray start --redis-address=
您需要一些东西来获取 IP 地址列表,就像我在上面使用 srun hostname
的地方一样。
我想 运行 对具有多个节点的集群进行 ray。我只能向集群提交非交互式作业,所以我不确定如何在作业 运行ning.
期间以编程方式获取 redis 地址我很确定在多个节点上启动ray的方式是这样的:
ray start --head
for host in $(srun hostname | grep -v $(hostname)); do
ssh $host ray start --redis-address=$redis_address
done
但是我需要知道头节点的redis地址。当您启动头节点时,它会打印:
Started Ray on this node. You can add additional nodes to the cluster by calling
ray start --redis-address 8.8.8.8:59465
from the node you wish to add. You can connect a driver to the cluster from Python by running
import ray
ray.init(redis_address="8.8.8.8:59465")
If you have trouble connecting from a different machine, check that your firewall is configured properly. If you wish to terminate the processes that have been started, run
我正计划捕获 ray start --head &> tee redis_port.txt
之类的输出,然后 grep
在 redis_address.txt
中查找 redis 地址,但似乎没有捕获到那部分输出在 redis_address.txt
中,我查看了 ray 会话创建的临时目录中的所有 .out
和 .err
文件,其中 none 也有。
一定有更好的方法来做到这一点。找到头节点的redis端口的预期方法是什么?
在 Robert 的帮助下在评论中解决了 so I'm going to post the code that I used based on his advice.
似乎最好的方法就是选择一个常量端口。唯一的潜在问题是同一台机器上的另一个 user/process 是否正在使用同一个端口。在那种情况下,您可能想尝试生成端口,直到找到一个未使用的端口。
我建议使用 ray start
命令将每个节点所需的任何设置放入脚本中,例如
redis_address="$(hostname --ip-address)"
redis_address="$redis_address:59465"
ray start --head --redis-port=59465
for host in $(srun hostname | grep -v $(hostname)); do
ssh $host ./setup_node.sh $redis_address
done
其中 setup_node.sh
是
# any required setup
# ...
ray start --redis-address=
您需要一些东西来获取 IP 地址列表,就像我在上面使用 srun hostname
的地方一样。