python ray框架ulimit 报错
- 问题描述:
In [1]: import ray
In [2]: ray.init()
File descriptor limit 2560 is too low for production servers and may result in connection errors. At least 8192 is recommended. --- Fix with 'ulimit -n 8192'
2021-03-05 18:55:06,750 INFO services.py:1174 -- View the Ray dashboard at http://127.0.0.1:8265
Out[2]:
{'node_ip_address': '192.168.43.42',
'raylet_ip_address': '192.168.43.42',
'redis_address': '192.168.43.42:53487',
'object_store_address': '/tmp/ray/session_2021-03-05_18-55-06_102502_36950/sockets/plasma_store',
'raylet_socket_name': '/tmp/ray/session_2021-03-05_18-55-06_102502_36950/sockets/raylet',
'webui_url': '127.0.0.1:8265',
'session_dir': '/tmp/ray/session_2021-03-05_18-55-06_102502_36950',
'metrics_export_port': 63568,
'node_id': '80533a2ed6f7b1fa83b81184798c49a1b0c384e06c170b3f25d61193'}
-
目前已经在这里提供了解释: 点击Github链接
-
总而言之,简单解决如下:
# before starting the ipython, type the following line:
$ ulimit -Sn 8192
#and it works. Now the soft limit is 8192..
# 注意,报错提示的 ulimit -n 8192, 在mac电脑中不起作用
原作者也提供了一种解决方案:
$ ulimit -n 8192 ipython
- 另外tips, 为了可以远程访问Ray Dashboard, 我们可以这样在服务器中声明 dashboard的ip地址:
$ray start --head --port=8265 --dashboard-host=0.0.0.0
# 正常运行后,会出现如下提示:
2021-03-15 10:33:11,691 INFO services.py:1174 -- View the Ray dashboard at http://10.163.40.13:8266
--------------------
Ray runtime started.
--------------------
Next steps
To connect to this Ray runtime from another node, run
ray start --address='10.163.40.13:8265' --redis-password='5241590000000000'
Alternatively, use the following Python code:
import ray
ray.init(address='auto', _redis_password='5241590000000000')
If connection fails, check your firewall settings and network configuration.
To terminate the Ray runtime, run
ray stop