Add debug logging to queue manager

parent be00cb97
...@@ -128,21 +128,23 @@ class QueueManager: ...@@ -128,21 +128,23 @@ class QueueManager:
def _process_queue(self) -> None: def _process_queue(self) -> None:
"""Background thread to process queued jobs.""" """Background thread to process queued jobs."""
print("Queue manager started", flush=True)
while self.running: while self.running:
try: try:
with self.lock: with self.lock:
if self.active_jobs < self.max_concurrent: if self.active_jobs < self.max_concurrent:
pending = get_pending_queue_items() pending = get_pending_queue_items()
if pending: if pending:
print(f"Found {len(pending)} pending job(s)", flush=True)
job = pending[0] # Get highest priority job job = pending[0] # Get highest priority job
if self._can_start_job(job): if self._can_start_job(job):
self._start_job(job) self._start_job(job)
else: else:
print(f"Job {job['id']} waiting for available workers") print(f"Job {job['id']} waiting for available workers", flush=True)
time.sleep(1) # Check every second time.sleep(1) # Check every second
except Exception as e: except Exception as e:
print(f"Queue processing error: {e}") print(f"Queue processing error: {e}", flush=True)
time.sleep(5) time.sleep(5)
def _start_job(self, job: Dict[str, Any]) -> None: def _start_job(self, job: Dict[str, Any]) -> None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment