From ed2e15a67ec018b85690cd1057487d0facf16bb0 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 4 Feb 2023 16:54:44 -0600 Subject: [PATCH] fix(api): exclude finished jobs when load balancing --- api/onnx_web/device_pool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/onnx_web/device_pool.py b/api/onnx_web/device_pool.py index 9f04dfbf..825fa68d 100644 --- a/api/onnx_web/device_pool.py +++ b/api/onnx_web/device_pool.py @@ -139,7 +139,7 @@ class DevicePoolExecutor: if len(self.jobs) == 0: return 0 - job_devices = [job.context.device_index.value for job in self.jobs] + job_devices = [job.context.device_index.value for job in self.jobs if not job.future.done()] job_counts = Counter(range(len(self.devices))) job_counts.update(job_devices)