Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
0f83ddd4
Unverified
Commit
0f83ddd4
authored
Jun 05, 2024
by
Alex Wu
Committed by
GitHub
Jun 05, 2024
Browse files
[Bugfix][Frontend/Core] Don't log exception when AsyncLLMEngine gracefully shuts down. (#5290)
parent
065aff6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
vllm/engine/async_llm_engine.py
vllm/engine/async_llm_engine.py
+19
-11
No files found.
vllm/engine/async_llm_engine.py
View file @
0f83ddd4
...
...
@@ -29,23 +29,32 @@ class AsyncEngineDeadError(RuntimeError):
pass
def
_raise_exception_on_finish
(
task
:
asyncio
.
Task
,
error_callback
:
Callable
[[
Exception
],
None
])
->
None
:
msg
=
(
"Task finished unexpectedly. This should never happen! "
"Please open an issue on Github."
)
def
_log_task_completion
(
task
:
asyncio
.
Task
,
error_callback
:
Callable
[[
Exception
],
None
])
->
None
:
"""This function is only intended for the `engine.run_engine_loop()` task.
In particular, that task runs a `while True` loop that can only exit if
there is an exception.
"""
exception
=
None
try
:
task
.
result
()
# NOTE: This will be thrown if task exits normally (which it should not)
raise
AsyncEngineDeadError
(
msg
)
return_value
=
task
.
result
()
raise
AssertionError
(
f
"The engine background task should never finish without an "
f
"exception.
{
return_value
}
"
)
except
asyncio
.
exceptions
.
CancelledError
:
# We assume that if the task is cancelled, we are gracefully shutting
# down. This should only happen on program exit.
logger
.
info
(
"Engine is gracefully shutting down."
)
except
Exception
as
e
:
exception
=
e
logger
.
error
(
"Engine background task failed"
,
exc_info
=
e
)
error_callback
(
exception
)
raise
AsyncEngineDeadError
(
msg
+
" See stack trace above for the actual cause."
)
from
e
"Task finished unexpectedly. This should never happen! "
"Please open an issue on Github. See stack trace above for the"
"actual cause."
)
from
e
class
AsyncStream
:
...
...
@@ -438,8 +447,7 @@ class AsyncLLMEngine:
self
.
_background_loop_unshielded
=
asyncio
.
get_event_loop
(
).
create_task
(
self
.
run_engine_loop
())
self
.
_background_loop_unshielded
.
add_done_callback
(
partial
(
_raise_exception_on_finish
,
error_callback
=
self
.
_error_callback
))
partial
(
_log_task_completion
,
error_callback
=
self
.
_error_callback
))
self
.
background_loop
=
asyncio
.
shield
(
self
.
_background_loop_unshielded
)
def
_init_engine
(
self
,
*
args
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment