[KV Offload] Implement shutdown() in OffloadingConnector and related classes (#39182)

Signed-off-by: Ronen Schaffer <ronen.schaffer@ibm.com>
This commit is contained in:
Ronen Schaffer
2026-04-10 08:06:22 +03:00
committed by GitHub
parent c48b2b83bd
commit a5b17fba8f
6 changed files with 39 additions and 0 deletions
+4
View File
@@ -178,3 +178,7 @@ class OffloadingManager(ABC):
New OffloadingEvents collected since the last call.
"""
return ()
def shutdown(self) -> None:
"""Shutdown the manager and release any resources."""
return
+8
View File
@@ -274,6 +274,14 @@ class SingleDirectionOffloadingHandler(OffloadingHandler):
if event is not None:
event.synchronize()
def shutdown(self) -> None:
while self._transfers:
transfer = self._transfers.popleft()
transfer.end_event.synchronize()
self._transfer_events.clear()
self._stream_pool.clear()
self._event_pool.clear()
class CpuGpuOffloadingHandlers:
def __init__(
+8
View File
@@ -69,6 +69,10 @@ class OffloadingHandler(ABC):
job_ids: The set of job IDs to wait for.
"""
def shutdown(self) -> None:
"""Shutdown the handler and release any resources."""
return
class OffloadingWorker:
"""
@@ -166,3 +170,7 @@ class OffloadingWorker:
"""
for handler in self.handlers:
handler.wait(job_ids)
def shutdown(self) -> None:
for handler in self.handlers:
handler.shutdown()