YTShortMakerArchx commited on
Commit
6b52518
Β·
verified Β·
1 Parent(s): e2cc168

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -913,10 +913,18 @@ async def queue_status():
913
  queued_job = next(
914
  (jid for jid, info in jobs.items() if info["status"] == JobStatus.QUEUED), None
915
  )
 
 
 
 
916
  return {
917
- "can_submit": running_job is None and queued_job is None,
918
- "slot_available": running_job is None,
919
- "queue_full": running_job is not None and queued_job is not None,
 
 
 
 
920
  "running_job_id": running_job,
921
  "queued_job_id": queued_job,
922
  "worker_ready": _worker_ready,
 
913
  queued_job = next(
914
  (jid for jid, info in jobs.items() if info["status"] == JobStatus.QUEUED), None
915
  )
916
+
917
+ running_count = 1 if running_job else 0
918
+ waiting_count = 1 if queued_job else 0
919
+
920
  return {
921
+ # ── NEW: integer counts the controller reads ──────────────────────
922
+ "running": running_count,
923
+ "waiting": waiting_count,
924
+ # ── Existing fields kept for backwards compat ─────────────────────
925
+ "can_submit": running_count == 0 and waiting_count == 0,
926
+ "slot_available": running_count == 0,
927
+ "queue_full": running_count == 1 and waiting_count == 1,
928
  "running_job_id": running_job,
929
  "queued_job_id": queued_job,
930
  "worker_ready": _worker_ready,