[KV Offload] Implement shutdown() in OffloadingConnector and related classes (#39182)
Signed-off-by: Ronen Schaffer <ronen.schaffer@ibm.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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__(
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user