A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 02:15 UTC
[CI Bug] Fix Async Engine, Inputs, Utils, Worker Test: 'State' object has no attribute 'enable_server_load_tracking' (#20845)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Wentao Ye committed
Jul 11, 2025 at 21:57 UTC
7b828e30d5e56d78a6be1bc61dc0e44f9c8b4ce6
1 file changed
+12
-5
vllm/entrypoints/utils.py
+12
-5
@@ -33,10 +33,12 @@ async def listen_for_disconnect(request: Request) -> None:
33
while True:
34
message = await request.receive()
35
if message["type"] == "http.disconnect":
36
- if request.app.state.enable_server_load_tracking:
37
- # on timeout/cancellation the BackgroundTask in load_aware_call
38
- # cannot decrement the server load metrics.
39
- # Must be decremented by with_cancellation instead.
36
+ # If load tracking is enabled *and* the counter exists, decrement
37
+ # it. Combines the previous nested checks into a single condition
38
+ # to satisfy the linter rule.
39
+ if (getattr(request.app.state, "enable_server_load_tracking",
40
+ False)
41
+ and hasattr(request.app.state, "server_load_metrics")):
42
request.app.state.server_load_metrics -= 1
43
break
44
@@ -101,9 +103,14 @@ def load_aware_call(func):
103
raise ValueError(
104
"raw_request required when server load tracking is enabled")
105
104
- if not raw_request.app.state.enable_server_load_tracking:
106
+ if not getattr(raw_request.app.state, "enable_server_load_tracking",
107
+ False):
108
return await func(*args, **kwargs)
109
110
+ # ensure the counter exists
111
+ if not hasattr(raw_request.app.state, "server_load_metrics"):
112
+ raw_request.app.state.server_load_metrics = 0
113
+
114
raw_request.app.state.server_load_metrics += 1
115
try:
116
response = await func(*args, **kwargs)