Ron Au commited on
Commit
67f60f6
1 Parent(s): c6fcf99

refactor(place_in_queue): Rename to be clearer

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -17,7 +17,7 @@ app.mount("/static", StaticFiles(directory="static"), name="static")
17
  tasks = {}
18
 
19
 
20
- def place_in_queue(task_id):
21
 
22
  pending_tasks = list(task for task in tasks.values()
23
  if task["status"] == "pending")
@@ -55,12 +55,12 @@ def create_task(prompt: str = "покемон"):
55
  "task_id": task_id,
56
  "created_at": created_at,
57
  "prompt": prompt,
58
- "initial_place_in_queue": place_in_queue(task_id),
59
  "status": "pending",
60
  "poll_count": 0,
61
  }
62
 
63
- print("Place in queue: ", place_in_queue(task_id))
64
  print("ETA: ", calculate_eta(task_id))
65
 
66
  return tasks[task_id]
 
17
  tasks = {}
18
 
19
 
20
+ def get_place_in_queue(task_id):
21
 
22
  pending_tasks = list(task for task in tasks.values()
23
  if task["status"] == "pending")
 
55
  "task_id": task_id,
56
  "created_at": created_at,
57
  "prompt": prompt,
58
+ "initial_place_in_queue": get_place_in_queue(task_id),
59
  "status": "pending",
60
  "poll_count": 0,
61
  }
62
 
63
+ print("Place in queue: ", get_place_in_queue(task_id))
64
  print("ETA: ", calculate_eta(task_id))
65
 
66
  return tasks[task_id]