diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-07-22 10:54:58 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-03 14:03:41 +0100 |
commit | e6b6767369f6d0caa7a9efe32ccd4ed514bb3148 (patch) | |
tree | 0f17ad55a46246c5e5885e0f86ace2932a9818ad /bitbake | |
parent | 29b4c2945f50e94a444303241b638ad5a54c0dbc (diff) | |
download | poky-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.py | 20 |
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 | |||
70 | runQueueComplete = 8 | 70 | runQueueComplete = 8 |
71 | runQueueChildProcess = 9 | 71 | runQueueChildProcess = 9 |
72 | 72 | ||
73 | class RunQueueScheduler: | 73 | class RunQueueScheduler(object): |
74 | """ | 74 | """ |
75 | Control the order tasks are scheduled in. | 75 | Control the order tasks are scheduled in. |
76 | """ | 76 | """ |
77 | name = "basic" | ||
78 | |||
77 | def __init__(self, runqueue): | 79 | def __init__(self, runqueue): |
78 | """ | 80 | """ |
79 | The default scheduler just returns the first buildable task (the | 81 | The default scheduler just returns the first buildable task (the |
@@ -101,6 +103,8 @@ class RunQueueSchedulerSpeed(RunQueueScheduler): | |||
101 | A scheduler optimised for speed. The priority map is sorted by task weight, | 103 | A scheduler optimised for speed. The priority map is sorted by task weight, |
102 | heavier weighted tasks (tasks needed by the most other tasks) are run first. | 104 | heavier weighted tasks (tasks needed by the most other tasks) are run first. |
103 | """ | 105 | """ |
106 | name = "speed" | ||
107 | |||
104 | def __init__(self, runqueue): | 108 | def __init__(self, runqueue): |
105 | """ | 109 | """ |
106 | The priority map is sorted by task weight. | 110 | The priority map is sorted by task weight. |
@@ -128,6 +132,8 @@ class RunQueueSchedulerCompletion(RunQueueSchedulerSpeed): | |||
128 | well where disk space is at a premium and classes like OE's rm_work are in | 132 | well where disk space is at a premium and classes like OE's rm_work are in |
129 | force. | 133 | force. |
130 | """ | 134 | """ |
135 | name = "completion" | ||
136 | |||
131 | def __init__(self, runqueue): | 137 | def __init__(self, runqueue): |
132 | RunQueueSchedulerSpeed.__init__(self, runqueue) | 138 | RunQueueSchedulerSpeed.__init__(self, runqueue) |
133 | from copy import deepcopy | 139 | from copy import deepcopy |
@@ -638,11 +644,15 @@ class RunQueue: | |||
638 | # Check of higher length circular dependencies | 644 | # Check of higher length circular dependencies |
639 | self.runq_weight = self.calculate_task_weights(endpoints) | 645 | self.runq_weight = self.calculate_task_weights(endpoints) |
640 | 646 | ||
641 | # Decide what order to execute the tasks in, pick a scheduler | 647 | schedulers = [obj for obj in globals().itervalues() |
642 | #self.sched = RunQueueScheduler(self) | 648 | if type(obj) is type and issubclass(obj, RunQueueScheduler)] |
643 | if self.scheduler == "completion": | 649 | for scheduler in schedulers: |
644 | self.sched = RunQueueSchedulerCompletion(self) | 650 | if self.scheduler == scheduler.name: |
651 | self.sched = scheduler(self) | ||
652 | break | ||
645 | else: | 653 | else: |
654 | bb.error("Invalid scheduler '%s', using default 'speed' scheduler" % self.scheduler) | ||
655 | bb.error("Available schedulers: %s" % ", ".join(obj.name for obj in schedulers)) | ||
646 | self.sched = RunQueueSchedulerSpeed(self) | 656 | self.sched = RunQueueSchedulerSpeed(self) |
647 | 657 | ||
648 | # Sanity Check - Check for multiple tasks building the same provider | 658 | # Sanity Check - Check for multiple tasks building the same provider |