Fix: do not try to re-map assigned and pending jobs

This commit is contained in:
Reid 'arrdem' McKenzie 2023-07-20 00:18:03 -06:00
parent ec10fa359d
commit 0ed2b90d99
2 changed files with 6 additions and 0 deletions

View file

@ -84,6 +84,7 @@ SELECT
, j.cancelled_at , j.cancelled_at
, j.finished_at , j.finished_at
, j.user_id , j.user_id
, j.printer_id
FROM jobs j FROM jobs j
INNER JOIN files f INNER JOIN files f
ON j.file_id = f.id ON j.file_id = f.id

View file

@ -152,6 +152,11 @@ def assign_jobs(app: App, db: Db) -> None:
"""Assign jobs to printers. Uploading files and job state management is handled separately.""" """Assign jobs to printers. Uploading files and job state management is handled separately."""
for job in db.list_job_queue(uid=None): for job in db.list_job_queue(uid=None):
# FIXME: Jobs which have been mapped are still in the "queue" until they finish
# Ignore such as they have already been mapped
if job.printer_id:
continue
for printer in db.list_idle_printers(): for printer in db.list_idle_printers():
if ( if (
job.analysis_id is not None job.analysis_id is not None