[EC Connector] Add shutdown API to EC Connector. (#42423)
Signed-off-by: omerpaz95 <omerpaz95@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
from vllm.distributed.ec_transfer.ec_transfer_state import (
|
||||
ensure_ec_transfer_initialized,
|
||||
ensure_ec_transfer_shutdown,
|
||||
get_ec_transfer,
|
||||
has_ec_transfer,
|
||||
)
|
||||
@@ -10,5 +11,6 @@ from vllm.distributed.ec_transfer.ec_transfer_state import (
|
||||
__all__ = [
|
||||
"get_ec_transfer",
|
||||
"ensure_ec_transfer_initialized",
|
||||
"ensure_ec_transfer_shutdown",
|
||||
"has_ec_transfer",
|
||||
]
|
||||
|
||||
@@ -79,6 +79,14 @@ class ECConnectorBase(ABC):
|
||||
def is_consumer(self) -> bool:
|
||||
return self._is_consumer
|
||||
|
||||
def shutdown(self) -> None:
|
||||
"""
|
||||
Shutdown the connector. This is called when the process
|
||||
is shutting down to ensure that all the async operations are
|
||||
completed and the connector is cleaned up properly.
|
||||
"""
|
||||
return None
|
||||
|
||||
# ==============================
|
||||
# Worker-side methods
|
||||
# ==============================
|
||||
|
||||
@@ -40,3 +40,10 @@ def ensure_ec_transfer_initialized(vllm_config: "VllmConfig") -> None:
|
||||
_EC_CONNECTOR_AGENT = ECConnectorFactory.create_connector(
|
||||
config=vllm_config, role=ECConnectorRole.WORKER
|
||||
)
|
||||
|
||||
|
||||
def ensure_ec_transfer_shutdown() -> None:
|
||||
global _EC_CONNECTOR_AGENT
|
||||
if _EC_CONNECTOR_AGENT is not None:
|
||||
_EC_CONNECTOR_AGENT.shutdown()
|
||||
_EC_CONNECTOR_AGENT = None
|
||||
|
||||
@@ -2041,6 +2041,8 @@ class Scheduler(SchedulerInterface):
|
||||
self.kv_event_publisher.shutdown()
|
||||
if self.connector is not None:
|
||||
self.connector.shutdown()
|
||||
if self.ec_connector is not None:
|
||||
self.ec_connector.shutdown()
|
||||
|
||||
########################################################################
|
||||
# KV Connector Related Methods
|
||||
|
||||
@@ -23,7 +23,10 @@ from vllm.distributed import (
|
||||
init_distributed_environment,
|
||||
set_custom_all_reduce,
|
||||
)
|
||||
from vllm.distributed.ec_transfer import ensure_ec_transfer_initialized
|
||||
from vllm.distributed.ec_transfer import (
|
||||
ensure_ec_transfer_initialized,
|
||||
ensure_ec_transfer_shutdown,
|
||||
)
|
||||
from vllm.distributed.eplb.eplb_utils import override_envs_for_eplb
|
||||
from vllm.distributed.kv_transfer import (
|
||||
ensure_kv_transfer_initialized,
|
||||
@@ -1101,6 +1104,8 @@ class Worker(WorkerBase):
|
||||
# has_kv_transfer_group can be None during interpreter shutdown.
|
||||
if ensure_kv_transfer_shutdown is not None:
|
||||
ensure_kv_transfer_shutdown()
|
||||
if ensure_ec_transfer_shutdown is not None:
|
||||
ensure_ec_transfer_shutdown()
|
||||
if self.profiler is not None:
|
||||
self.profiler.shutdown()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user