File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ class EngineInstancePool:
2020 def __init__ (self , engine ):
2121 from lmdeploy .pytorch .engine import Engine
2222 self .engine : Engine = engine
23- self .num_instance = self .engine .engine_config .max_batch_size
23+ # enlarge `num_instance`, otherwise an sequence cannot be stopped in time
24+ self .num_instance = self .engine .engine_config .max_batch_size * 2
2425 self .pool = None
2526
2627 def create_instance_pool (self , num_instance : int ):
Original file line number Diff line number Diff line change @@ -448,12 +448,14 @@ async def stop_all_session(self):
448448 """Stop all running sessions."""
449449 logger .info ('stop all sessions' )
450450 tasks = []
451+ session_ids = []
451452 for session_id in list (self .id2inst .keys ()):
452453 generator = self .id2inst .get (session_id )
453454 if generator :
455+ session_ids .append (session_id )
454456 tasks .append (generator .async_cancel (session_id ))
455457 await asyncio .gather (* tasks )
456- logger .info ('all sessions stopped' )
458+ logger .info (f 'all { len ( session_ids ) } sessions stopped' )
457459
458460 async def stop_session (self , session_id : int ):
459461 """Stop a session by a session_id."""
You can’t perform that action at this time.
0 commit comments