From 36bfccae09e29383c6c9b23f4edd0217f7eb6e15 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 26 Mar 2023 15:49:43 -0500 Subject: [PATCH] fix(api): include worker totals in status endpoint --- api/onnx_web/worker/pool.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/onnx_web/worker/pool.py b/api/onnx_web/worker/pool.py index c8e96c65..58a00f15 100644 --- a/api/onnx_web/worker/pool.py +++ b/api/onnx_web/worker/pool.py @@ -369,6 +369,9 @@ class DevicePoolExecutor: 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": [ @@ -404,6 +407,17 @@ class DevicePoolExecutor: ) 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):