From e8cdd8a9285cfe5c1193b45e1ab06dee6758b59c Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Fri, 26 Nov 2021 16:53:05 -0500 Subject: [PATCH] job_queue: add "automatic_transition" option When set to true, the queue will automatically transition to the next job in the queue upon completion of the current job. When false the queue will pause between jobs, requiring that the user manually resume. Signed-off-by: Eric Callahan --- moonraker/components/job_queue.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moonraker/components/job_queue.py b/moonraker/components/job_queue.py index 7777fa2..39c7bd6 100644 --- a/moonraker/components/job_queue.py +++ b/moonraker/components/job_queue.py @@ -31,6 +31,7 @@ class JobQueue: self.queue_state: str = "ready" self.lock = asyncio.Lock() self.load_on_start = config.getboolean("load_on_startup", False) + self.automatic = config.getboolean("automatic_transition", False) self.job_delay = config.getfloat("job_transition_delay", 0.01) if self.job_delay <= 0.: raise config.error( @@ -129,8 +130,8 @@ class JobQueue: self.queued_jobs.pop(uid, None) if self.queue_state == "starting": # If the queue was not paused while starting the print, - # reset state to "ready" - self.queue_state = "ready" + set_ready = not self.queued_jobs or self.automatic + self.queue_state = "ready" if set_ready else "paused" async def _check_can_print(self) -> bool: # Query the latest stats