Skip to content

Commit

Permalink
Fix logging default (SeldonIO#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Gonzalez-Martin authored May 9, 2022
1 parent 9153c57 commit 47ae828
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mlserver/rest/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,22 @@ async def delete_custom_handlers(self, model: MLModel):
handlers.pop(j)

async def start(self):
cfg = uvicorn.Config(
self._app,
host=self._settings.host,
port=self._settings.http_port,
log_config=self._settings.logging_settings,
)
cfg = self._get_config()
self._server = _NoSignalServer(cfg)
await self._server.serve()

def _get_config(self):
kwargs = {
"host": self._settings.host,
"port": self._settings.http_port,
}

if self._settings.logging_settings:
# If not None, use ours. Otherwise, let Uvicorn fall back on its
# own config.
kwargs["log_config"] = self._settings.logging_settings

return uvicorn.Config(self._app, **kwargs)

async def stop(self):
self._server.handle_exit(sig=None, frame=None)

0 comments on commit 47ae828

Please sign in to comment.