diff options
author | Jürg Billeter <j@bitron.ch> | 2018-02-12 14:51:57 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-02-12 21:43:54 +0100 |
commit | 75f73ef7e02d42bdded2f8e59579ea57a393e8e5 (patch) | |
tree | 9b11ac52d47d1d7f0a388a6e630f4ebde9c75eab | |
parent | e52f2e42776e1f0900b1087d1f468fd300af2126 (diff) | |
download | buildstream-75f73ef7e02d42bdded2f8e59579ea57a393e8e5.tar.gz |
scheduler.py: Do not prematurely terminate loop after skipping jobsjuerg/scheduler
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
-rw-r--r-- | buildstream/_scheduler/scheduler.py | 8 |
1 files changed, 7 insertions, 1 deletions
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: |