From 73486625b436fc1befe1e4dac5b086085b0adace Mon Sep 17 00:00:00 2001 From: Olga Andreeva <124622579+oandreeva-nv@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:10:58 -0800 Subject: [PATCH] Setting shutdown asyncio event in a thread-safe manner (#78) --- ci/L0_backend_vllm/metrics_test/test.sh | 4 ++-- src/model.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/L0_backend_vllm/metrics_test/test.sh b/ci/L0_backend_vllm/metrics_test/test.sh index 884be62..a9a4db9 100755 --- a/ci/L0_backend_vllm/metrics_test/test.sh +++ b/ci/L0_backend_vllm/metrics_test/test.sh @@ -75,11 +75,11 @@ run_test() { fi fi + set -e + # TODO: Non-graceful shutdown when metrics are enabled. kill $SERVER_PID wait $SERVER_PID - - set -e } RET=0 diff --git a/src/model.py b/src/model.py index 46c35a2..4c351f1 100644 --- a/src/model.py +++ b/src/model.py @@ -800,7 +800,7 @@ def _check_health(self, requests): def finalize(self): self.logger.log_info("[vllm] Issuing finalize to vllm backend") - self._llm_engine_shutdown_event.set() + self._event_loop.call_soon_threadsafe(self._llm_engine_shutdown_event.set) # Shutdown the event thread. if self._event_thread is not None: