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
c528b900
Unverified
Commit
c528b900
authored
Oct 24, 2025
by
usberkeley
Committed by
GitHub
Oct 24, 2025
Browse files
Fix EventPublisherFactory logic for disabled KV cache events (#27419)
Signed-off-by:
Bradley
<
bradley.b.pitt@gmail.com
>
parent
85fee74b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
tests/distributed/test_events.py
tests/distributed/test_events.py
+49
-0
vllm/distributed/kv_events.py
vllm/distributed/kv_events.py
+5
-1
No files found.
tests/distributed/test_events.py
View file @
c528b900
...
@@ -263,3 +263,52 @@ def test_data_parallel_rank_tagging(publisher_config):
...
@@ -263,3 +263,52 @@ def test_data_parallel_rank_tagging(publisher_config):
pub_1
.
shutdown
()
pub_1
.
shutdown
()
sub_0
.
close
()
sub_0
.
close
()
sub_1
.
close
()
sub_1
.
close
()
def
test_event_publisher_factory
():
"""Test event publisher factory creation behavior under different configurations"""
from
vllm.config.kv_events
import
KVEventsConfig
from
vllm.distributed.kv_events
import
ZmqEventPublisher
# test config is None
publisher
=
EventPublisherFactory
.
create
(
None
,
DP_RANK
)
assert
isinstance
(
publisher
,
NullEventPublisher
)
publisher
.
shutdown
()
# test disable kv cache events
config
=
KVEventsConfig
(
enable_kv_cache_events
=
False
,
publisher
=
"zmq"
,
# Even if zmq is specified, should return NullEventPublisher
endpoint
=
"tcp://localhost:5557"
,
)
publisher
=
EventPublisherFactory
.
create
(
config
,
DP_RANK
)
assert
isinstance
(
publisher
,
NullEventPublisher
)
publisher
.
shutdown
()
# test zmq publisher
config
=
KVEventsConfig
(
enable_kv_cache_events
=
True
,
publisher
=
"zmq"
,
endpoint
=
"inproc://test-factory-true"
,
)
publisher
=
EventPublisherFactory
.
create
(
config
,
DP_RANK
)
assert
isinstance
(
publisher
,
ZmqEventPublisher
)
publisher
.
shutdown
()
# test unknown publisher
with
pytest
.
raises
(
ValueError
,
match
=
"Input should be"
):
KVEventsConfig
(
enable_kv_cache_events
=
True
,
publisher
=
"unknown_publisher"
,
endpoint
=
"tcp://localhost:5557"
,
)
# test publisher not specified
config
=
KVEventsConfig
(
enable_kv_cache_events
=
True
,
# publisher not specified, should default to "zmq"
endpoint
=
"tcp://localhost:5557"
,
)
publisher
=
EventPublisherFactory
.
create
(
config
,
DP_RANK
)
assert
isinstance
(
publisher
,
ZmqEventPublisher
)
publisher
.
shutdown
()
vllm/distributed/kv_events.py
View file @
c528b900
...
@@ -353,7 +353,11 @@ class EventPublisherFactory:
...
@@ -353,7 +353,11 @@ class EventPublisherFactory:
cls
,
config
:
KVEventsConfig
|
None
,
data_parallel_rank
:
int
=
0
cls
,
config
:
KVEventsConfig
|
None
,
data_parallel_rank
:
int
=
0
)
->
EventPublisher
:
)
->
EventPublisher
:
"""Create publisher from a config mapping."""
"""Create publisher from a config mapping."""
if
config
is
None
or
config
.
publisher
==
"null"
:
if
(
config
is
None
or
not
config
.
enable_kv_cache_events
or
config
.
publisher
==
"null"
):
return
NullEventPublisher
()
return
NullEventPublisher
()
config_dict
=
asdict
(
config
)
config_dict
=
asdict
(
config
)
...
...
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