Spaces:
Running
Running
feat: background analysis jobs servisi ile queueing ve progress tracking eklendi
Browse files
app/services/analysis_jobs.py
CHANGED
|
@@ -241,7 +241,12 @@ class Job:
|
|
| 241 |
}
|
| 242 |
position = cpu_gate.position(self.id)
|
| 243 |
if not self.finished and position is not None:
|
| 244 |
-
data["queue"] = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
if self.cached:
|
| 246 |
data["cached"] = True
|
| 247 |
return data
|
|
|
|
| 241 |
}
|
| 242 |
position = cpu_gate.position(self.id)
|
| 243 |
if not self.finished and position is not None:
|
| 244 |
+
data["queue"] = {
|
| 245 |
+
"position": position,
|
| 246 |
+
# Everyone in line before you, plus whoever is on the CPU now.
|
| 247 |
+
"ahead": position - 1 + cpu_gate.busy,
|
| 248 |
+
"estimatedWaitSec": cpu_gate.estimated_wait(position),
|
| 249 |
+
}
|
| 250 |
if self.cached:
|
| 251 |
data["cached"] = True
|
| 252 |
return data
|