ray學習筆記

  • head node
sudo apt install redis
sudo service redis stop # 裝好redis之後守護進程自動運行。ray會再開一個守護進程,爲了避免不必要的麻煩停掉redis
pip uninstall numpy
pip install numpy==1.16.0
ray start --head --redis-port=6379 

打印:

Started Ray on this node. You can add additional nodes to the cluster by calling               
                                                                                               
    ray start --address='192.168.1.129:6379' --redis-password='5241590000000000'               
                                                                                               
from the node you wish to add. You can connect a driver to the cluster from Python by running  
                                                                                               
    import ray                                                                                 
    ray.init(address='auto', redis_password='5241590000000000')                                
                                                                                               
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 stop
  • slaves

嘗試在子節點打開ray

ray start --address=192.168.1.129:6379

但是報錯

Exception: Version mismatch: The cluster was started with:
    Ray: 0.8.1
    Python: 3.6.8
    Pyarrow: 0.14.0.RAY
This process on node 192.168.1.116 was started with:
    Ray: 0.8.1
    Python: 3.6.10
    Pyarrow: 0.14.0.RAY

於是

conda install python=3.6.8
In [3]: ray.init(address='auto', redis_password='5241590000000000')
2020-02-10 13:02:58,376 WARNING worker.py:682 -- WARNING: Not updating worker name since `setproctitle` is not installed. Install this with `pip install setproctitle` (or ray[debug]) to enable monitoring of worker processes.
Out[3]: 
{'node_ip_address': '192.168.1.129',
 'redis_address': '192.168.1.129:6379',
 'object_store_address': '/tmp/ray/session_2020-02-10_12-36-11_167736_31237/sockets/plasma_store',
 'raylet_socket_name': '/tmp/ray/session_2020-02-10_12-36-11_167736_31237/sockets/raylet',
 'webui_url': None,
 'session_dir': '/tmp/ray/session_2020-02-10_12-36-11_167736_31237'}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章