From 75f73ef7e02d42bdded2f8e59579ea57a393e8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Mon, 12 Feb 2018 14:51:57 +0100 Subject: scheduler.py: Do not prematurely terminate loop after skipping jobs It is possible that Queue.process_ready() skips jobs without starting a job. Pull the skipped jobs forward through the queues and process them instead of prematurely terminating the loop due to lack of active jobs. Fixes #236 --- buildstream/_scheduler/scheduler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py index f8852e1f8..574cabc83 100644 --- a/buildstream/_scheduler/scheduler.py +++ b/buildstream/_scheduler/scheduler.py @@ -317,7 +317,9 @@ class Scheduler(): def sched(self): - if self.queue_jobs: + process_queues = True + + while self.queue_jobs and process_queues: # Pull elements forward through queues elements = [] @@ -341,6 +343,10 @@ class Scheduler(): for queue in reversed(self.queues): queue.process_ready() + # process_ready() may have skipped jobs, adding them to the done_queue. + # Pull these skipped elements forward to the next queue and process them. + process_queues = sum([len(q.done_queue) for q in self.queues]) > 0 + # If nothings ticking, time to bail out ticking = 0 for queue in self.queues: -- cgit v1.2.1