无法将ray serve http代理绑定到“127.0.0.1:8000”

5m1hhzi4  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(436)

已使用以下命令启动光线头节点:

ray start \
       --head \
       --port=6379 \
       --object-manager-port=8076 \
     --include-dashboard=true \
       --dashboard-host=0.0.0.0 \
      --dashboard-port=8266

输出:

local node IP: 100.2.1.49
2021-07-10 20:58:01,607 INFO services.py:1245 -- View the Ray dashboard at http://100.2.1.49:8266

--------------------
Ray runtime started.
--------------------

Next steps
  To connect to this Ray runtime from another node, run
    ray start --address='localhost:PORT' --redis-password='xxxx'

  Alternatively, use the following Python code:
    import ray
    ray.init(address='auto', _redis_password='xxxx')

  If connection fails, check your firewall settings and network configuration.

  To terminate the Ray runtime, run
    ray stop

之后,在fastapi上编写了一个小python代码:

import ray
from ray import serve

from fastapi import FastAPI

app = FastAPI()

serve_handle = None

@app.on_event("startup") # Code to be run when the server starts.
async def startup_event():
    ray.init(address='auto', _redis_password='5241590000000000')
    client = serve.start()
    for _ in range(100):
        x.append(1)
    print(x)

但当我用命令运行scrit时:
uvicorn py_代码:应用程序
出现以下错误:

ValueError: Failed to bind Ray Serve HTTP proxy to '127.0.0.1:8000'.
Please make sure your http-host and http-port are specified correctly.

有人能解释一下我该怎么做吗。非常感谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题