mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Fix issue where dead jobs try to be started after restarting
This commit is contained in:
@@ -133,6 +133,7 @@ class RenderQueue:
|
|||||||
scheduled = cls.jobs_with_status(RenderStatus.SCHEDULED, priority_sorted=True)
|
scheduled = cls.jobs_with_status(RenderStatus.SCHEDULED, priority_sorted=True)
|
||||||
for job in scheduled:
|
for job in scheduled:
|
||||||
if job.scheduled_start <= datetime.now():
|
if job.scheduled_start <= datetime.now():
|
||||||
|
logger.debug(f"Starting scheduled job: {job}")
|
||||||
cls.start_job(job)
|
cls.start_job(job)
|
||||||
|
|
||||||
if cls.last_saved_counts != cls.job_counts():
|
if cls.last_saved_counts != cls.job_counts():
|
||||||
|
|||||||
@@ -85,10 +85,12 @@ class ScheduledJob(Base):
|
|||||||
worker_status = RenderStatus(self.worker_data()['status'])
|
worker_status = RenderStatus(self.worker_data()['status'])
|
||||||
if hasattr(self, 'worker_object'):
|
if hasattr(self, 'worker_object'):
|
||||||
if self.scheduled_start and worker_status == RenderStatus.NOT_STARTED:
|
if self.scheduled_start and worker_status == RenderStatus.NOT_STARTED:
|
||||||
return RenderStatus.SCHEDULED
|
worker_status = RenderStatus.SCHEDULED
|
||||||
else:
|
else:
|
||||||
if worker_status == RenderStatus.RUNNING:
|
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:
|
except Exception as e:
|
||||||
logger.error(f"Exception fetching render status: {e}")
|
logger.error(f"Exception fetching render status: {e}")
|
||||||
worker_status = RenderStatus.UNDEFINED
|
worker_status = RenderStatus.UNDEFINED
|
||||||
@@ -142,7 +144,9 @@ class ScheduledJob(Base):
|
|||||||
|
|
||||||
def file_list(self):
|
def file_list(self):
|
||||||
job_dir = os.path.dirname(self.output_path)
|
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):
|
def log_path(self):
|
||||||
return os.path.join(os.path.dirname(self.input_path), self.name + '.log')
|
return os.path.join(os.path.dirname(self.input_path), self.name + '.log')
|
||||||
|
|||||||
Reference in New Issue
Block a user