[Bugfix][KV Offload] Skip cleaned-up async lookup batches (#55075)
Signed-off-by: Alex <jihui.huang@daocloud.io> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: Or Ozeri <oro@il.ibm.com>
This commit is contained in:
co-authored by
OpenAI Codex
Or Ozeri
parent
a1541f5742
commit
9afb878a55
@@ -158,9 +158,16 @@ class AsyncLookupManager(ABC):
|
||||
step's drain_results(). Safe to call with an empty batch (no-op).
|
||||
"""
|
||||
self._need_to_drain = True
|
||||
if self._lookup_batch:
|
||||
self._lookup_queue.put(self._lookup_batch)
|
||||
self._lookup_batch = []
|
||||
batch = self._lookup_batch
|
||||
self._lookup_batch = []
|
||||
batch = [
|
||||
(key, req_context, generation)
|
||||
for key, req_context, generation in batch
|
||||
if (state := self._lookup_state.get(key)) is not None
|
||||
and state.generation == generation
|
||||
]
|
||||
if batch:
|
||||
self._lookup_queue.put(batch)
|
||||
|
||||
def drain_results(self) -> None:
|
||||
"""Apply pending worker results to _lookup_state.
|
||||
|
||||
Reference in New Issue
Block a user