[P/D] Add a shutdown method to the Connector API (#22699)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -2,11 +2,12 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from vllm.distributed.kv_transfer.kv_transfer_state import (
|
||||
KVConnectorBaseType, ensure_kv_transfer_initialized, get_kv_transfer_group,
|
||||
has_kv_transfer_group, is_v1_kv_transfer_group)
|
||||
KVConnectorBaseType, ensure_kv_transfer_initialized,
|
||||
ensure_kv_transfer_shutdown, get_kv_transfer_group, has_kv_transfer_group,
|
||||
is_v1_kv_transfer_group)
|
||||
|
||||
__all__ = [
|
||||
"get_kv_transfer_group", "has_kv_transfer_group",
|
||||
"is_v1_kv_transfer_group", "ensure_kv_transfer_initialized",
|
||||
"KVConnectorBaseType"
|
||||
"ensure_kv_transfer_shutdown", "KVConnectorBaseType"
|
||||
]
|
||||
|
||||
@@ -226,6 +226,14 @@ class KVConnectorBase_V1(ABC):
|
||||
"""
|
||||
return None, None
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
Shutdown the connector. This is called when the worker process
|
||||
is shutting down to ensure that all the async operations are
|
||||
completed and the connector is cleaned up properly.
|
||||
"""
|
||||
return None
|
||||
|
||||
# ==============================
|
||||
# Scheduler-side methods
|
||||
# ==============================
|
||||
|
||||
@@ -64,3 +64,10 @@ def ensure_kv_transfer_initialized(vllm_config: "VllmConfig") -> None:
|
||||
config=vllm_config, role=KVConnectorRole.WORKER)
|
||||
else:
|
||||
raise ValueError("V0 is no longer supported")
|
||||
|
||||
|
||||
def ensure_kv_transfer_shutdown() -> None:
|
||||
global _KV_CONNECTOR_AGENT
|
||||
if _KV_CONNECTOR_AGENT is not None:
|
||||
_KV_CONNECTOR_AGENT.shutdown()
|
||||
_KV_CONNECTOR_AGENT = None
|
||||
|
||||
Reference in New Issue
Block a user