aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-07-22 10:54:58 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-03 14:03:41 +0100
commite6b6767369f6d0caa7a9efe32ccd4ed514bb3148 (patch)
tree0f17ad55a46246c5e5885e0f86ace2932a9818ad /bitbake
parent29b4c2945f50e94a444303241b638ad5a54c0dbc (diff)
downloadopenembedded-core-contrib-e6b6767369f6d0caa7a9efe32ccd4ed514bb3148.tar.gz
Let the runqueue find the user selected scheduler dynamically
Searches the module (bb.runqueue) for any new style classes which are instances of RunQueueScheduler, and uses the one whose 'name' attribute matches the value of BB_SCHEDULER. (Bitbake rev: 6497cedf9cfc03201250af816995dd2bd85c36ef) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/runqueue.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 2830bc4ad9..f8440dbccc 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -70,10 +70,12 @@ runQueueCleanUp = 7
runQueueComplete = 8
runQueueChildProcess = 9
-class RunQueueScheduler:
+class RunQueueScheduler(object):
"""
Control the order tasks are scheduled in.
"""
+ name = "basic"
+
def __init__(self, runqueue):
"""
The default scheduler just returns the first buildable task (the
@@ -101,6 +103,8 @@ class RunQueueSchedulerSpeed(RunQueueScheduler):
A scheduler optimised for speed. The priority map is sorted by task weight,
heavier weighted tasks (tasks needed by the most other tasks) are run first.
"""
+ name = "speed"
+
def __init__(self, runqueue):
"""
The priority map is sorted by task weight.
@@ -128,6 +132,8 @@ class RunQueueSchedulerCompletion(RunQueueSchedulerSpeed):
well where disk space is at a premium and classes like OE's rm_work are in
force.
"""
+ name = "completion"
+
def __init__(self, runqueue):
RunQueueSchedulerSpeed.__init__(self, runqueue)
from copy import deepcopy
@@ -638,11 +644,15 @@ class RunQueue:
# Check of higher length circular dependencies
self.runq_weight = self.calculate_task_weights(endpoints)
- # Decide what order to execute the tasks in, pick a scheduler
- #self.sched = RunQueueScheduler(self)
- if self.scheduler == "completion":
- self.sched = RunQueueSchedulerCompletion(self)
+ schedulers = [obj for obj in globals().itervalues()
+ if type(obj) is type and issubclass(obj, RunQueueScheduler)]
+ for scheduler in schedulers:
+ if self.scheduler == scheduler.name:
+ self.sched = scheduler(self)
+ break
else:
+ bb.error("Invalid scheduler '%s', using default 'speed' scheduler" % self.scheduler)
+ bb.error("Available schedulers: %s" % ", ".join(obj.name for obj in schedulers))
self.sched = RunQueueSchedulerSpeed(self)
# Sanity Check - Check for multiple tasks building the same provider