[BugFix] fix cache port and zmq close bugs (#4371)
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled

* Update common_engine.py

* Update zmq_client.py

* Update expert_service.py

---------

Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
This commit is contained in:
ltd0924
2025-10-15 10:29:30 +08:00
committed by GitHub
parent bc7193f21d
commit dd425b89ed
3 changed files with 25 additions and 8 deletions

View File

@@ -63,6 +63,7 @@ class EngineSevice:
cfg (Config): Config object containing all the configuration parameters. cfg (Config): Config object containing all the configuration parameters.
""" """
self.cfg = cfg self.cfg = cfg
if cfg.splitwise_role != "mixed" or cfg.cache_config.enable_prefix_caching:
if isinstance(self.cfg.cache_config.cache_queue_port, str): if isinstance(self.cfg.cache_config.cache_queue_port, str):
self.cfg.cache_config.cache_queue_port = self.cfg.cache_config.cache_queue_port.split(",") self.cfg.cache_config.cache_queue_port = self.cfg.cache_config.cache_queue_port.split(",")
if isinstance(self.cfg.cache_config.cache_queue_port, list): if isinstance(self.cfg.cache_config.cache_queue_port, list):

View File

@@ -116,8 +116,6 @@ class ExpertService:
self.cache_manager_processes = self.engine.start_cache_service( self.cache_manager_processes = self.engine.start_cache_service(
self.cfg.local_device_ids, ipc_signal_suffix_cache self.cfg.local_device_ids, ipc_signal_suffix_cache
) )
if self.cfg.splitwise_role != "mixed":
self.engine.split_mode_get_tasks()
if self.cfg.scheduler_config.name == "splitwise": if self.cfg.scheduler_config.name == "splitwise":
self.cfg.init_cache_info() self.cfg.init_cache_info()

View File

@@ -18,6 +18,8 @@ from abc import ABC, abstractmethod
import zmq import zmq
from fastdeploy.utils import llm_logger
class ZmqClientBase(ABC): class ZmqClientBase(ABC):
""" """
@@ -89,3 +91,19 @@ class ZmqIpcClient(ZmqClientBase):
def connect(self): def connect(self):
self._ensure_socket() self._ensure_socket()
self.socket.connect(f"ipc://{self.file_name}") self.socket.connect(f"ipc://{self.file_name}")
def close(self):
"""
Close the socket and context.
"""
llm_logger.info("ZMQ client is closing connection...")
try:
if self.socket is not None and not self.socket.closed:
self.socket.setsockopt(zmq.LINGER, 0)
self.socket.close()
if self.context is not None:
self.context.term()
except Exception as e:
llm_logger.warning(f"ZMQ client failed to close connection - {e}")
return