mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[serve] Better validation for arguments to client.start() (#14327)
This commit is contained in:
parent
60a8b67488
commit
e40dc3a3e9
2 changed files with 9 additions and 2 deletions
|
@ -211,7 +211,14 @@ class HTTPProxyActor:
|
|||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
if hasattr(socket, "SO_REUSEPORT"):
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
||||
sock.bind((self.host, self.port))
|
||||
|
||||
try:
|
||||
sock.bind((self.host, self.port))
|
||||
except OSError:
|
||||
# The OS failed to bind a socket to the given host and port.
|
||||
raise ValueError(
|
||||
f"""Failed to bind Ray Serve HTTP proxy to '{self.host}:{self.port}'.
|
||||
Please make sure your http-host and http-port are specified correctly.""")
|
||||
|
||||
# Note(simon): we have to use lower level uvicorn Config and Server
|
||||
# class because we want to run the server as a coroutine. The only
|
||||
|
|
|
@ -162,7 +162,7 @@ def test_middleware():
|
|||
|
||||
def test_http_proxy_fail_loudly():
|
||||
# Test that if the http server fail to start, serve.start should fail.
|
||||
with pytest.raises(socket.gaierror):
|
||||
with pytest.raises(ValueError):
|
||||
serve.start(http_options={"host": "bad.ip.address"})
|
||||
|
||||
ray.shutdown()
|
||||
|
|
Loading…
Add table
Reference in a new issue