Skip to content

Commit

Permalink
fix(api): do not move jobs from pending to running until progress is …
Browse files Browse the repository at this point in the history
…reported
  • Loading branch information
ssube committed Mar 26, 2023
1 parent 0af406c commit 27500ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions api/onnx_web/worker/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ def cancel(self, key: str) -> bool:

for job in self.pending_jobs:
if job.name == key:
self.pending_jobs[:] = [
job for job in self.pending_jobs if job.name != key
]
self.pending_jobs.remove(job)
logger.info("cancelled pending job: %s", key)
return True

Expand Down Expand Up @@ -414,7 +412,7 @@ def next_job(self, device: str):
if job.device == device:
logger.debug("enqueuing job %s on device %s", job.name, device)
self.pending[device].put(job, block=False)
self.pending_jobs.remove(job)
# job will be removed from pending queue when progress is updated
return

logger.trace("no pending jobs for device %s", device)
Expand Down

0 comments on commit 27500ec

Please sign in to comment.