@mytec: iter2.4.2 start
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
import asyncio
|
||||
import multiprocessing as mp
|
||||
from fastapi import APIRouter
|
||||
|
||||
@@ -42,3 +44,17 @@ async def get_system_info():
|
||||
"gpu": gpu_info,
|
||||
"gpu_available": gpu_info.get("available", False),
|
||||
}
|
||||
|
||||
|
||||
@router.post("/shutdown")
|
||||
async def shutdown():
|
||||
"""Graceful shutdown endpoint. Kills worker processes and exits."""
|
||||
from app.services.parallel_coverage_service import _kill_worker_processes
|
||||
|
||||
killed = _kill_worker_processes()
|
||||
|
||||
# Schedule hard exit after response is sent
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.call_later(0.5, lambda: os._exit(0))
|
||||
|
||||
return {"status": "shutting down", "workers_killed": killed}
|
||||
|
||||
Reference in New Issue
Block a user