feat(grpc): add KV event source discovery (#50033)
Signed-off-by: Connor Carpenter <connorc@nvidia.com> Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
co-authored by
Nick Hill
parent
2ecd8645d8
commit
48fc2e2797
@@ -272,6 +272,10 @@ class EventPublisher(ABC):
|
||||
def shutdown(self) -> None:
|
||||
"""Shutdown the publisher."""
|
||||
|
||||
def get_publisher_config(self) -> KVEventsConfig | None:
|
||||
"""Return the publisher's resolved runtime configuration."""
|
||||
return None
|
||||
|
||||
|
||||
class NullEventPublisher(EventPublisher):
|
||||
"""No-op implementation (default when disabled)."""
|
||||
@@ -335,6 +339,17 @@ class ZmqEventPublisher(EventPublisher):
|
||||
self._replay_endpoint = self.offset_endpoint_port(
|
||||
replay_endpoint, self._dp_rank
|
||||
)
|
||||
assert self._endpoint is not None
|
||||
self._publisher_config = KVEventsConfig(
|
||||
enable_kv_cache_events=True,
|
||||
publisher="zmq",
|
||||
endpoint=self._endpoint,
|
||||
replay_endpoint=self._replay_endpoint,
|
||||
buffer_steps=buffer_steps,
|
||||
hwm=hwm,
|
||||
max_queue_size=max_queue_size,
|
||||
topic=topic,
|
||||
)
|
||||
self._hwm = hwm
|
||||
self._socket_setup()
|
||||
|
||||
@@ -351,6 +366,9 @@ class ZmqEventPublisher(EventPublisher):
|
||||
)
|
||||
self._thread.start()
|
||||
|
||||
def get_publisher_config(self) -> KVEventsConfig:
|
||||
return self._publisher_config
|
||||
|
||||
def publish(self, events: EventBatch) -> None:
|
||||
if not self._running:
|
||||
raise RuntimeError("Publisher is closed")
|
||||
|
||||
Reference in New Issue
Block a user