mirror of
				https://github.com/PaddlePaddle/FastDeploy.git
				synced 2025-10-31 20:02:53 +08:00 
			
		
		
		
	[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
				
			
		
		
	
	
				
					
				
			
		
			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:
		| @@ -63,6 +63,7 @@ class EngineSevice: | ||||
|             cfg (Config): Config object containing all the configuration parameters. | ||||
|         """ | ||||
|         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): | ||||
|                 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): | ||||
|   | ||||
| @@ -116,8 +116,6 @@ class ExpertService: | ||||
|             self.cache_manager_processes = self.engine.start_cache_service( | ||||
|                 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": | ||||
|             self.cfg.init_cache_info() | ||||
|   | ||||
| @@ -18,6 +18,8 @@ from abc import ABC, abstractmethod | ||||
|  | ||||
| import zmq | ||||
|  | ||||
| from fastdeploy.utils import llm_logger | ||||
|  | ||||
|  | ||||
| class ZmqClientBase(ABC): | ||||
|     """ | ||||
| @@ -89,3 +91,19 @@ class ZmqIpcClient(ZmqClientBase): | ||||
|     def connect(self): | ||||
|         self._ensure_socket() | ||||
|         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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ltd0924
					ltd0924