diff --git a/lib/render_queue.py b/lib/render_queue.py index eebec25..5be9dd6 100755 --- a/lib/render_queue.py +++ b/lib/render_queue.py @@ -133,6 +133,7 @@ class RenderQueue: scheduled = cls.jobs_with_status(RenderStatus.SCHEDULED, priority_sorted=True) for job in scheduled: if job.scheduled_start <= datetime.now(): + logger.debug(f"Starting scheduled job: {job}") cls.start_job(job) if cls.last_saved_counts != cls.job_counts(): diff --git a/lib/scheduled_job.py b/lib/scheduled_job.py index 7aab6f1..1accc38 100644 --- a/lib/scheduled_job.py +++ b/lib/scheduled_job.py @@ -85,10 +85,12 @@ class ScheduledJob(Base): worker_status = RenderStatus(self.worker_data()['status']) if hasattr(self, 'worker_object'): if self.scheduled_start and worker_status == RenderStatus.NOT_STARTED: - return RenderStatus.SCHEDULED + worker_status = RenderStatus.SCHEDULED else: if worker_status == RenderStatus.RUNNING: - return RenderStatus.ERROR + worker_status = RenderStatus.ERROR + elif worker_status == RenderStatus.NOT_STARTED: + worker_status = RenderStatus.CANCELLED except Exception as e: logger.error(f"Exception fetching render status: {e}") worker_status = RenderStatus.UNDEFINED @@ -142,7 +144,9 @@ class ScheduledJob(Base): def file_list(self): job_dir = os.path.dirname(self.output_path) - return glob.glob(os.path.join(job_dir, '*')) + file_list = glob.glob(os.path.join(job_dir, '*')) + file_list.sort() + return file_list def log_path(self): return os.path.join(os.path.dirname(self.input_path), self.name + '.log')