[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
|
||||
|
||||
Reference in New Issue
Block a user