Fix stop_profile does not wait for finishing (#4741)

This commit is contained in:
fzyzcjy
2025-05-18 08:06:15 +08:00
committed by GitHub
parent e3b8a72291
commit 01d2838c0f
4 changed files with 19 additions and 11 deletions

View File

@@ -321,7 +321,8 @@ class Engine(EngineBase):
loop.run_until_complete(self.tokenizer_manager.start_profile())
def stop_profile(self):
self.tokenizer_manager.stop_profile()
loop = asyncio.get_event_loop()
loop.run_until_complete(self.tokenizer_manager.stop_profile())
def get_server_info(self):
loop = asyncio.get_event_loop()

View File

@@ -355,7 +355,7 @@ async def start_profile_async(obj: Optional[ProfileReqInput] = None):
@app.api_route("/stop_profile", methods=["GET", "POST"])
async def stop_profile_async():
"""Stop profiling."""
_global_state.tokenizer_manager.stop_profile()
await _global_state.tokenizer_manager.stop_profile()
return Response(
content="Stop profiling. This will take some time.\n",
status_code=200,