11# SPDX-License-Identifier: Apache-2.0
22# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3- import time
4- from collections .abc import Iterable
5- from typing import TYPE_CHECKING , Any , Optional
3+ from typing import TYPE_CHECKING , Any
64
75import torch
86from lmcache .integration .vllm .vllm_v1_adapter import (
97 LMCacheConnectorV1Impl as LMCacheConnectorLatestImpl ,
108)
119
1210from vllm .config import VllmConfig
13- from vllm .distributed .kv_events import BlockStored , KVCacheEvent , KVEventBatch
1411from vllm .distributed .kv_transfer .kv_connector .v1 .base import (
1512 KVConnectorBase_V1 ,
1613 KVConnectorMetadata ,
1714 KVConnectorRole ,
1815)
1916from vllm .logger import init_logger
2017from vllm .v1 .core .sched .output import SchedulerOutput
21- from vllm .v1 .outputs import KVConnectorOutput
2218
2319if TYPE_CHECKING :
2420 from vllm .attention .backends .abstract import AttentionMetadata
@@ -58,8 +54,6 @@ def __init__(
5854
5955 self ._lmcache_engine = cls (vllm_config , role , self )
6056
61- self ._kv_events : list [KVCacheEvent ] = []
62-
6357 # ==============================
6458 # Worker-side methods
6559 # ==============================
@@ -228,25 +222,6 @@ def build_connector_meta(
228222 """
229223 return self ._lmcache_engine .build_connector_meta (scheduler_output )
230224
231- def update_connector_output (self , connector_output : KVConnectorOutput ):
232- """
233- Update KVConnector state from worker-side connectors output.
234-
235- Args:
236- connector_output (KVConnectorOutput): the worker-side
237- connectors output.
238- """
239- # Get the KV events
240- kv_events = connector_output .kv_cache_events
241- if (
242- not kv_events
243- or not isinstance (kv_events , KVEventBatch )
244- or not kv_events .events
245- ):
246- return
247- self ._kv_events .extend (kv_events .events )
248- return
249-
250225 def request_finished (
251226 self ,
252227 request : "Request" ,
@@ -263,14 +238,3 @@ def request_finished(
263238 returned by the engine.
264239 """
265240 return self ._lmcache_engine .request_finished (request , block_ids )
266-
267- def take_events (self ) -> Iterable ["KVCacheEvent" ]:
268- """
269- Take the KV cache events from the connector.
270-
271- Yields:
272- New KV cache events since the last call.
273- """
274- if self ._kv_events is not None :
275- yield from self ._kv_events
276- self ._kv_events .clear ()
0 commit comments