update issues of freeze

This commit is contained in:
2026-01-04 14:54:35 +01:00
parent bb80a65346
commit 2c43e719e3
7 changed files with 161 additions and 6 deletions

View File

@@ -158,6 +158,26 @@ async def delete_queue(id: str, db: Session = Depends(database.get_db)):
raise HTTPException(status_code=404, detail="ID not found")
@app.get("/api/system/status")
async def system_status():
"""Check the status of system services"""
services = ["testarena-app", "testarena-worker", "nginx"]
status = {}
for service in services:
try:
# Use systemctl is-active for a quick check
res = os.system(f"systemctl is-active --quiet {service}")
status[service] = "online" if res == 0 else "offline"
except:
status[service] = "unknown"
return status
@app.get("/api/queue/{id}/tasks")
async def get_queue_tasks(id: str, db: Session = Depends(database.get_db)):
"""Get all tasks for a specific queue"""
tasks = db.query(models.Task).filter(models.Task.queue_id == id).all()
return tasks
@app.get("/")
async def root():
return FileResponse(os.path.join(static_dir, "index.html"))