From 0450622db5ff4a9b765f7d34fbc77080ab1557ff Mon Sep 17 00:00:00 2001 From: Robert Samoilescu Date: Fri, 7 Jun 2024 10:20:41 +0100 Subject: [PATCH 1/2] Bumped uvicorn to 0.30.1 --- poetry.lock | 8 ++++---- runtimes/alibi-detect/poetry.lock | 8 ++++---- runtimes/alibi-explain/poetry.lock | 8 ++++---- runtimes/catboost/poetry.lock | 6 +++--- runtimes/huggingface/poetry.lock | 8 ++++---- runtimes/lightgbm/poetry.lock | 6 +++--- runtimes/mlflow/poetry.lock | 8 ++++---- runtimes/mllib/poetry.lock | 6 +++--- runtimes/sklearn/poetry.lock | 6 +++--- runtimes/xgboost/poetry.lock | 6 +++--- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/poetry.lock b/poetry.lock index 79098183e..61d5846c2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "absl-py" @@ -7660,13 +7660,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.28.0" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.28.0-py3-none-any.whl", hash = "sha256:6623abbbe6176204a4226e67607b4d52cc60ff62cda0ff177613645cefa2ece1"}, - {file = "uvicorn-0.28.0.tar.gz", hash = "sha256:cab4473b5d1eaeb5a0f6375ac4bc85007ffc75c3cc1768816d9e5d589857b067"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/alibi-detect/poetry.lock b/runtimes/alibi-detect/poetry.lock index 11f5e29a5..eab1a5707 100644 --- a/runtimes/alibi-detect/poetry.lock +++ b/runtimes/alibi-detect/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "absl-py" @@ -4131,13 +4131,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.29.0" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.29.0-py3-none-any.whl", hash = "sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de"}, - {file = "uvicorn-0.29.0.tar.gz", hash = "sha256:6a69214c0b6a087462412670b3ef21224fa48cae0e452b5883e8e8bdfdd11dd0"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/alibi-explain/poetry.lock b/runtimes/alibi-explain/poetry.lock index d9d73a7c7..64ca9b9aa 100644 --- a/runtimes/alibi-explain/poetry.lock +++ b/runtimes/alibi-explain/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "absl-py" @@ -4715,13 +4715,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.29.0" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.29.0-py3-none-any.whl", hash = "sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de"}, - {file = "uvicorn-0.29.0.tar.gz", hash = "sha256:6a69214c0b6a087462412670b3ef21224fa48cae0e452b5883e8e8bdfdd11dd0"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/catboost/poetry.lock b/runtimes/catboost/poetry.lock index 872fc7efb..ae6ad3387 100644 --- a/runtimes/catboost/poetry.lock +++ b/runtimes/catboost/poetry.lock @@ -2537,13 +2537,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/huggingface/poetry.lock b/runtimes/huggingface/poetry.lock index 35e4e81cf..31c205377 100644 --- a/runtimes/huggingface/poetry.lock +++ b/runtimes/huggingface/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "absl-py" @@ -4090,13 +4090,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/lightgbm/poetry.lock b/runtimes/lightgbm/poetry.lock index ef314c10e..7b9c112d5 100644 --- a/runtimes/lightgbm/poetry.lock +++ b/runtimes/lightgbm/poetry.lock @@ -2054,13 +2054,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/mlflow/poetry.lock b/runtimes/mlflow/poetry.lock index c21e45385..9d2eb5295 100644 --- a/runtimes/mlflow/poetry.lock +++ b/runtimes/mlflow/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "aiofiles" @@ -3755,13 +3755,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/mllib/poetry.lock b/runtimes/mllib/poetry.lock index c64147ce3..92e5eed21 100644 --- a/runtimes/mllib/poetry.lock +++ b/runtimes/mllib/poetry.lock @@ -2019,13 +2019,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/sklearn/poetry.lock b/runtimes/sklearn/poetry.lock index 154e39ca3..76e86b38c 100644 --- a/runtimes/sklearn/poetry.lock +++ b/runtimes/sklearn/poetry.lock @@ -2094,13 +2094,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] diff --git a/runtimes/xgboost/poetry.lock b/runtimes/xgboost/poetry.lock index 521437325..064ce972a 100644 --- a/runtimes/xgboost/poetry.lock +++ b/runtimes/xgboost/poetry.lock @@ -2094,13 +2094,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.27.1" +version = "0.30.1" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.27.1-py3-none-any.whl", hash = "sha256:5c89da2f3895767472a35556e539fd59f7edbe9b1e9c0e1c99eebeadc61838e4"}, - {file = "uvicorn-0.27.1.tar.gz", hash = "sha256:3d9a267296243532db80c83a959a3400502165ade2c1338dea4e67915fd4745a"}, + {file = "uvicorn-0.30.1-py3-none-any.whl", hash = "sha256:cd17daa7f3b9d7a24de3617820e634d0933b69eed8e33a516071174427238c81"}, + {file = "uvicorn-0.30.1.tar.gz", hash = "sha256:d46cd8e0fd80240baffbcd9ec1012a712938754afcf81bce56c024c1656aece8"}, ] [package.dependencies] From aa4fe7cfb0bd33da96a0927aa779529dacf24d34 Mon Sep 17 00:00:00 2001 From: Robert Samoilescu Date: Fri, 7 Jun 2024 10:24:07 +0100 Subject: [PATCH 2/2] Initialize sig when stop server --- mlserver/metrics/server.py | 6 ++++++ mlserver/rest/server.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/mlserver/metrics/server.py b/mlserver/metrics/server.py index d87ad54e0..348db7d21 100644 --- a/mlserver/metrics/server.py +++ b/mlserver/metrics/server.py @@ -1,5 +1,6 @@ import uvicorn import os +import signal from typing import Optional, TYPE_CHECKING @@ -72,5 +73,10 @@ def _get_config(self): return uvicorn.Config(self._app, **kwargs) async def stop(self, sig: Optional[int] = None): + if sig is None: + # `sig` is no longer optional for `handle_exit` in + # latest `uvicorn` + sig = signal.SIGINT + await stop_metrics(self._settings, os.getpid()) self._server.handle_exit(sig=sig, frame=None) diff --git a/mlserver/rest/server.py b/mlserver/rest/server.py index 86632965d..8336e6f58 100644 --- a/mlserver/rest/server.py +++ b/mlserver/rest/server.py @@ -1,4 +1,5 @@ import uvicorn +import signal from ..settings import Settings from ..handlers import DataPlane, ModelRepositoryHandlers, get_custom_handlers @@ -96,4 +97,9 @@ def _get_config(self): return uvicorn.Config(self._app, **kwargs) async def stop(self, sig: Optional[int] = None): + if sig is None: + # `sig` is no longer optional for `handle_exit` in + # latest `uvicorn` + sig = signal.SIGINT + self._server.handle_exit(sig=sig, frame=None)