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
23027e2d
Unverified
Commit
23027e2d
authored
Jun 05, 2025
by
CYJiang
Committed by
GitHub
Jun 04, 2025
Browse files
[Misc] refactor: simplify EngineCoreClient.make_async_mp_client in AsyncLLM (#18817)
Signed-off-by:
googs1025
<
googs1025@gmail.com
>
parent
c3fd4d66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
vllm/v1/engine/async_llm.py
vllm/v1/engine/async_llm.py
+3
-11
vllm/v1/engine/core_client.py
vllm/v1/engine/core_client.py
+19
-6
No files found.
vllm/v1/engine/async_llm.py
View file @
23027e2d
...
@@ -28,8 +28,7 @@ from vllm.transformers_utils.tokenizer_group import init_tokenizer_from_configs
...
@@ -28,8 +28,7 @@ from vllm.transformers_utils.tokenizer_group import init_tokenizer_from_configs
from
vllm.usage.usage_lib
import
UsageContext
from
vllm.usage.usage_lib
import
UsageContext
from
vllm.utils
import
Device
,
cdiv
from
vllm.utils
import
Device
,
cdiv
from
vllm.v1.engine
import
EngineCoreRequest
from
vllm.v1.engine
import
EngineCoreRequest
from
vllm.v1.engine.core_client
import
(
AsyncMPClient
,
DPAsyncMPClient
,
from
vllm.v1.engine.core_client
import
EngineCoreClient
RayDPClient
)
from
vllm.v1.engine.exceptions
import
EngineDeadError
,
EngineGenerateError
from
vllm.v1.engine.exceptions
import
EngineDeadError
,
EngineGenerateError
from
vllm.v1.engine.output_processor
import
(
OutputProcessor
,
from
vllm.v1.engine.output_processor
import
(
OutputProcessor
,
RequestOutputCollector
)
RequestOutputCollector
)
...
@@ -121,15 +120,8 @@ class AsyncLLM(EngineClient):
...
@@ -121,15 +120,8 @@ class AsyncLLM(EngineClient):
log_stats
=
self
.
log_stats
)
log_stats
=
self
.
log_stats
)
# EngineCore (starts the engine in background process).
# EngineCore (starts the engine in background process).
core_client_class
:
type
[
AsyncMPClient
]
if
vllm_config
.
parallel_config
.
data_parallel_size
==
1
:
core_client_class
=
AsyncMPClient
elif
vllm_config
.
parallel_config
.
data_parallel_backend
==
"ray"
:
core_client_class
=
RayDPClient
else
:
core_client_class
=
DPAsyncMPClient
self
.
engine_core
=
c
ore
_c
lient
_class
(
self
.
engine_core
=
EngineC
ore
C
lient
.
make_async_mp_client
(
vllm_config
=
vllm_config
,
vllm_config
=
vllm_config
,
executor_class
=
executor_class
,
executor_class
=
executor_class
,
log_stats
=
self
.
log_stats
,
log_stats
=
self
.
log_stats
,
...
...
vllm/v1/engine/core_client.py
View file @
23027e2d
...
@@ -68,18 +68,31 @@ class EngineCoreClient(ABC):
...
@@ -68,18 +68,31 @@ class EngineCoreClient(ABC):
"is not currently supported."
)
"is not currently supported."
)
if
multiprocess_mode
and
asyncio_mode
:
if
multiprocess_mode
and
asyncio_mode
:
if
vllm_config
.
parallel_config
.
data_parallel_size
>
1
:
return
EngineCoreClient
.
make_async_mp_client
(
if
vllm_config
.
parallel_config
.
data_parallel_backend
==
"ray"
:
vllm_config
,
executor_class
,
log_stats
)
return
RayDPClient
(
vllm_config
,
executor_class
,
log_stats
)
return
DPAsyncMPClient
(
vllm_config
,
executor_class
,
log_stats
)
return
AsyncMPClient
(
vllm_config
,
executor_class
,
log_stats
)
if
multiprocess_mode
and
not
asyncio_mode
:
if
multiprocess_mode
and
not
asyncio_mode
:
return
SyncMPClient
(
vllm_config
,
executor_class
,
log_stats
)
return
SyncMPClient
(
vllm_config
,
executor_class
,
log_stats
)
return
InprocClient
(
vllm_config
,
executor_class
,
log_stats
)
return
InprocClient
(
vllm_config
,
executor_class
,
log_stats
)
@
staticmethod
def
make_async_mp_client
(
vllm_config
:
VllmConfig
,
executor_class
:
type
[
Executor
],
log_stats
:
bool
,
client_addresses
:
Optional
[
dict
[
str
,
str
]]
=
None
,
client_index
:
int
=
0
,
)
->
"MPClient"
:
if
vllm_config
.
parallel_config
.
data_parallel_size
>
1
:
if
vllm_config
.
parallel_config
.
data_parallel_backend
==
"ray"
:
return
RayDPClient
(
vllm_config
,
executor_class
,
log_stats
,
client_addresses
,
client_index
)
return
DPAsyncMPClient
(
vllm_config
,
executor_class
,
log_stats
,
client_addresses
,
client_index
)
return
AsyncMPClient
(
vllm_config
,
executor_class
,
log_stats
,
client_addresses
,
client_index
)
@
abstractmethod
@
abstractmethod
def
shutdown
(
self
):
def
shutdown
(
self
):
...
...
...
...
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