Skip to content

Commit 0e6f5ef

Browse files
committed
replasing asyncio event with threading event
1 parent cd4cf06 commit 0e6f5ef

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ci/L0_backend_vllm/metrics_test/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ run_test() {
7575
fi
7676
fi
7777

78+
set -e
79+
7880
# TODO: Non-graceful shutdown when metrics are enabled.
7981
kill $SERVER_PID
8082
wait $SERVER_PID
81-
82-
set -e
8383
}
8484

8585
RET=0

src/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def _init_engine(self):
228228
# Run the engine in a separate thread running the AsyncIO event loop.
229229
self._llm_engine = None
230230
self._llm_engine_start_cv = threading.Condition()
231-
self._llm_engine_shutdown_event = asyncio.Event()
231+
self._llm_engine_shutdown_event = threading.Event()
232232
self._event_thread = threading.Thread(
233233
target=asyncio.run, args=(self._run_llm_engine(),)
234234
)
@@ -268,7 +268,8 @@ async def _run_llm_engine(self):
268268
self._llm_engine_start_cv.notify_all()
269269

270270
# Wait for the engine shutdown signal.
271-
await self._llm_engine_shutdown_event.wait()
271+
while not self._llm_engine_shutdown_event.is_set():
272+
await asyncio.sleep(0.1) # Prevent busy-waiting
272273

273274
# Wait for the ongoing requests to complete.
274275
while self._ongoing_request_count > 0:

0 commit comments

Comments
 (0)