[serve] Split out metadata for checkpointing (#11533)

This commit is contained in:
Ian Rodney 2020-11-03 12:41:24 -08:00 committed by GitHub
parent 39ce0eadbe
commit c3074f559c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 511 additions and 439 deletions

View file

@ -226,7 +226,7 @@ class Client:
will be sent to a replica of this backend without receiving a
response.
"""
if backend_tag in self.list_backends():
if backend_tag in self.list_backends().keys():
raise ValueError(
"Cannot create backend. "
"Backend '{}' is already registered.".format(backend_tag))
@ -255,10 +255,10 @@ class Client:
replica_config))
@_ensure_connected
def list_backends(self) -> Dict[str, Dict[str, Any]]:
def list_backends(self) -> Dict[str, BackendConfig]:
"""Returns a dictionary of all registered backends.
Dictionary maps backend tags to backend configs.
Dictionary maps backend tags to backend config objects.
"""
return ray.get(self._controller.get_all_backends.remote())

File diff suppressed because it is too large Load diff

View file

@ -31,5 +31,5 @@ def serve_instance(_shared_serve_instance):
# Clear all state between tests to avoid naming collisions.
for endpoint in ray.get(controller.get_all_endpoints.remote()):
_shared_serve_instance.delete_endpoint(endpoint)
for backend in ray.get(controller.get_all_backends.remote()):
for backend in ray.get(controller.get_all_backends.remote()).keys():
_shared_serve_instance.delete_backend(backend)

View file

@ -567,7 +567,7 @@ def test_list_backends(serve_instance, use_legacy_config):
backends = client.list_backends()
assert len(backends) == 1
assert "backend" in backends
assert backends["backend"]["max_batch_size"] == 10
assert backends["backend"].max_batch_size == 10
config2 = {
"num_replicas": 10
@ -575,7 +575,7 @@ def test_list_backends(serve_instance, use_legacy_config):
client.create_backend("backend2", f, config=config2)
backends = client.list_backends()
assert len(backends) == 2
assert backends["backend2"]["num_replicas"] == 10
assert backends["backend2"].num_replicas == 10
client.delete_backend("backend")
backends = client.list_backends()
@ -751,13 +751,13 @@ def test_connect(serve_instance):
client.create_endpoint("endpoint", backend="connect_in_backend")
handle = client.get_handle("endpoint")
assert ray.get(handle.remote()) == client._controller_name
assert "backend-ception" in client.list_backends()
assert "backend-ception" in client.list_backends().keys()
client3.create_backend("connect_in_backend", connect_in_backend)
client3.create_endpoint("endpoint", backend="connect_in_backend")
handle = client3.get_handle("endpoint")
assert ray.get(handle.remote()) == client3._controller_name
assert "backend-ception" in client3.list_backends()
assert "backend-ception" in client3.list_backends().keys()
def test_serve_metrics(serve_instance):