Skip to content

Commit

Permalink
fix(api): include worker totals in status endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Mar 26, 2023
1 parent 2d2283e commit 36bfcca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/onnx_web/worker/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ def submit(
self.pending_jobs.append(job)

def status(self) -> Dict[str, List[Tuple[str, int, bool, bool, bool, bool]]]:
"""
Returns a tuple of: job/device, progress, progress, finished, cancelled, failed
"""
return {
"cancelled": [],
"finished": [
Expand Down Expand Up @@ -404,6 +407,17 @@ def status(self) -> Dict[str, List[Tuple[str, int, bool, bool, bool, bool]]]:
)
for name, job in self.running_jobs.items()
],
"total": [
(
device,
total,
self.workers[device].is_alive(),
False,
False,
False,
)
for device, total in self.total_jobs.items()
],
}

def next_job(self, device: str):
Expand Down

0 comments on commit 36bfcca

Please sign in to comment.