File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 22# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33
44
5+ from typing import Literal
6+
7+ from pydantic import Field
58from pydantic .dataclasses import dataclass
69
710from vllm .config .utils import config
@@ -17,7 +20,7 @@ class KVEventsConfig:
1720 Events can be published externally by zmq using the event publisher config.
1821 """
1922
20- publisher : str = "null"
23+ publisher : Literal [ "null" , "zmq" ] = Field ( default = None )
2124 """The publisher to use for publishing kv events. Can be "null", "zmq".
2225 """
2326
@@ -47,3 +50,7 @@ class KVEventsConfig:
4750 """The topic to use for the event publisher. Consumers can subscribe to
4851 this topic to receive events.
4952 """
53+
54+ def __post_init__ (self ):
55+ if self .publisher is None :
56+ self .publisher = "zmq" if self .enable_kv_cache_events else "null"
Original file line number Diff line number Diff line change @@ -353,12 +353,12 @@ def create(
353353 cls , config : KVEventsConfig | None , data_parallel_rank : int = 0
354354 ) -> EventPublisher :
355355 """Create publisher from a config mapping."""
356- if not config :
356+ if config is None or config . publisher == "null" :
357357 return NullEventPublisher ()
358358
359359 config_dict = asdict (config )
360360
361- kind = config_dict .pop ("publisher" , "null" )
361+ kind = config_dict .pop ("publisher" )
362362 config_dict .pop ("enable_kv_cache_events" )
363363 try :
364364 constructor = cls ._registry [kind ]
You can’t perform that action at this time.
0 commit comments