mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-18 07:26:58 +08:00
[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>
This commit is contained in:
parent
5f0af36af5
commit
7b828e30d5
@ -33,10 +33,12 @@ async def listen_for_disconnect(request: Request) -> None:
|
|||||||
while True:
|
while True:
|
||||||
message = await request.receive()
|
message = await request.receive()
|
||||||
if message["type"] == "http.disconnect":
|
if message["type"] == "http.disconnect":
|
||||||
if request.app.state.enable_server_load_tracking:
|
# If load tracking is enabled *and* the counter exists, decrement
|
||||||
# on timeout/cancellation the BackgroundTask in load_aware_call
|
# it. Combines the previous nested checks into a single condition
|
||||||
# cannot decrement the server load metrics.
|
# to satisfy the linter rule.
|
||||||
# Must be decremented by with_cancellation instead.
|
if (getattr(request.app.state, "enable_server_load_tracking",
|
||||||
|
False)
|
||||||
|
and hasattr(request.app.state, "server_load_metrics")):
|
||||||
request.app.state.server_load_metrics -= 1
|
request.app.state.server_load_metrics -= 1
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -101,9 +103,14 @@ def load_aware_call(func):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
"raw_request required when server load tracking is enabled")
|
"raw_request required when server load tracking is enabled")
|
||||||
|
|
||||||
if not raw_request.app.state.enable_server_load_tracking:
|
if not getattr(raw_request.app.state, "enable_server_load_tracking",
|
||||||
|
False):
|
||||||
return await func(*args, **kwargs)
|
return await func(*args, **kwargs)
|
||||||
|
|
||||||
|
# ensure the counter exists
|
||||||
|
if not hasattr(raw_request.app.state, "server_load_metrics"):
|
||||||
|
raw_request.app.state.server_load_metrics = 0
|
||||||
|
|
||||||
raw_request.app.state.server_load_metrics += 1
|
raw_request.app.state.server_load_metrics += 1
|
||||||
try:
|
try:
|
||||||
response = await func(*args, **kwargs)
|
response = await func(*args, **kwargs)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user