我想在有多个节点的集群上运行ray。我只能向集群提交非交互式作业,因此我不确定如何在作业运行时以编程方式获取redis地址。
我非常确定在多个节点上启动ray的方法是这样的:
ray start --head
for host in $(srun hostname | grep -v $(hostname)); do
ssh $host ray start --redis-address=$redis_address
done但我需要知道头节点的redis地址。当您启动head节点时,它会打印:
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这样的输出,然后在redis_address.txt中使用greping来查找redis地址,但似乎这部分输出在redis_address.txt中没有捕获,我查看了由ray会话创建的临时目录中的所有.out和.err文件,但它们都没有。
肯定有更好的方法来做到这一点。查找头节点的redis端口的预期方式是什么?
发布于 2019-05-05 13:51:08
感谢罗伯特的帮助so I'm going to post the code that I used based on his advice.,在评论中解决了
似乎最好的方法就是选择一个恒定的端口。唯一的潜在问题是同一台机器上的另一个用户/进程是否正在使用相同的端口。在这种情况下,您可能希望尝试生成端口,直到找到一个未使用的端口。
我建议使用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
donesetup_node.sh在哪里
# any required setup
# ...
ray start --redis-address=$1您需要一些东西来获取IP地址列表,就像我在上面使用srun hostname的地方一样。
https://stackoverflow.com/questions/55876925
复制相似问题