summaryrefslogtreecommitdiff
path: root/buildstream/_scheduler/scheduler.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-03 22:05:15 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-03 22:05:15 +0900
commitc3ef5b226cc51bafd04842693ec8dd3a68413b11 (patch)
tree0bc216bb7df0f7934fb7f9f688e24a003f4137e7 /buildstream/_scheduler/scheduler.py
parent027ee783f7ce9686cd623f5aa5e8e37f4a9e25e4 (diff)
downloadbuildstream-c3ef5b226cc51bafd04842693ec8dd3a68413b11.tar.gz
scheduler.py: Prioritize the last queues first when scheduling.
This avoids starvation when we're trying to pull things, but the fetch queue isnt budging so we dont start building until we've failed to pull every element in the pipeline.
Diffstat (limited to 'buildstream/_scheduler/scheduler.py')
-rw-r--r--buildstream/_scheduler/scheduler.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py
index 8530f96e2..52d898a48 100644
--- a/buildstream/_scheduler/scheduler.py
+++ b/buildstream/_scheduler/scheduler.py
@@ -331,7 +331,15 @@ class Scheduler():
elements = list(elements)
# Kickoff whatever processes can be processed at this time
- for queue in self.queues:
+ #
+ # We start by queuing from the last queue first, because we want to
+ # give priority to queues later in the scheduling process in the case
+ # that multiple queues share the same token type.
+ #
+ # This avoids starvation situations where we dont move on to fetch
+ # tasks for elements which failed to pull, and thus need all the pulls
+ # to complete before ever starting a build
+ for queue in reversed(self.queues):
queue.process_ready()
# If nothings ticking, time to bail out