update issues of freeze
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user