[serve] Refactor BackendConfig (#8202)

This commit is contained in:
Edward Oakes
2020-04-30 22:31:07 -05:00
committed by GitHub
parent 95d187e556
commit 6373c70661
33 changed files with 406 additions and 310 deletions
+6 -7
View File
@@ -163,8 +163,8 @@ class Router:
backend_configs = retry_actor_failures(
master_actor.get_backend_configs)
for backend, backend_config_dict in backend_configs.items():
await self.set_backend_config(backend, backend_config_dict)
for backend, backend_config in backend_configs.items():
await self.set_backend_config(backend, backend_config)
def is_ready(self):
return True
@@ -260,10 +260,10 @@ class Router:
if service in self.traffic:
del self.traffic[service]
async def set_backend_config(self, backend, config_dict):
async def set_backend_config(self, backend, config):
logger.debug("Setting backend config for "
"backend {} to {}".format(backend, config_dict))
self.backend_info[backend] = config_dict
"backend {} to {}.".format(backend, config))
self.backend_info[backend] = config
async def remove_backend(self, backend):
logger.debug("Removing backend {}".format(backend))
@@ -330,8 +330,7 @@ class Router:
max_batch_size = None
if backend in self.backend_info:
max_batch_size = self.backend_info[backend][
"max_batch_size"]
max_batch_size = self.backend_info[backend].max_batch_size
await self._assign_query_to_worker(
backend, buffer_queue, worker_queue, max_batch_size)