- High: It blocks me to complete my task.
I am trying to run ray serve in a docker container on Apple Silicon M1. The image was built from bazel via pip installing ray[serve]==2.34.0
. When I exec into the container, I ran python serve.py
to start a simple server:
# serve.py
import subprocess
from typing import Any
import ray
from ray import serve
from starlette.requests import Request
subprocess.run(["ray", "start", "--head"])
ray.init()
serve.start(detached=True, http_options={"host": "0.0.0.0"})
@serve.deployment
class Hello:
def __init__(self):
pass
async def __call__(self, starlette_request: Request) -> dict[str, Any]:
req = await starlette_request.json()
name = req["name"]
return {"response": f"Hello {name}!"}
serve.run(Hello.bind(), blocking=True)
But I got an error:
2024-08-14 05:18:37,439 INFO worker.py:1596 -- Connecting to existing Ray cluster at address: 172.26.0.2:6379...
2024-08-14 05:18:37,535 INFO worker.py:1772 -- Connected to Ray cluster. View the dashboard at http://127.0.0.1:8265
[2024-08-14 05:18:37,834 E 30 30] core_worker.cc:251: Failed to register worker 01000000ffffffffffffffffffffffffffffffffffffffffffffffff to Raylet. IOError: [RayletClient] Unable to register worker with raylet. No such file or directory
Does my serve.py
look correct? Any tips on how to get around this issue? Thanks!