[serve] Fix nonblocking serve.init() (#8068)

This commit is contained in:
Edward Oakes
2020-04-22 11:51:27 -05:00
committed by GitHub
parent 0204dff1e9
commit f9f41e5a1a
3 changed files with 38 additions and 6 deletions
+5 -4
View File
@@ -26,11 +26,11 @@ class HTTPProxy:
# blocks forever
"""
def __init__(self):
async def fetch_config_from_master(self):
assert ray.is_initialized()
master = ray.util.get_actor(SERVE_MASTER_NAME)
self.route_table, [self.router_handle] = ray.get(
master.get_http_proxy_config.remote())
self.route_table, [self.router_handle
] = await master.get_http_proxy_config.remote()
def set_route_table(self, route_table):
self.route_table = route_table
@@ -163,8 +163,9 @@ class HTTPProxy:
@ray.remote
class HTTPProxyActor:
def __init__(self, host, port):
async def __init__(self, host, port):
self.app = HTTPProxy()
await self.app.fetch_config_from_master()
self.host = host
self.port = port