]> code.ossystems Code Review - openembedded-core.git/commitdiff
Split out 'find next buildable task' into a separate generator function
authorChris Larson <chris_larson@mentor.com>
Fri, 23 Jul 2010 21:32:14 +0000 (14:32 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Jan 2011 14:46:32 +0000 (14:46 +0000)
It needs to be a generator, so scheduler subclasses have the option to skip
buildable tasks and return a later one.

(Bitbake rev: a8c61e41bc6277222e4cde667ad0b24bd1597aa0)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/runqueue.py

index 3a630e02a27210ecf5cfda8595ddac509c4edd18..be873ff7dc039e4da1ba83b92f69d733febcb580 100644 (file)
@@ -92,17 +92,23 @@ class RunQueueScheduler(object):
         self.prio_map = []
         self.prio_map.extend(range(numTasks))
 
-    def next(self):
+    def next_buildable_tasks(self):
         """
         Return the id of the first task we find that is buildable
         """
+        for tasknum in range(len(self.rqdata.runq_fnid)):
+            taskid = self.prio_map[tasknum]
+            if self.rq.runq_running[taskid] == 1:
+                continue
+            if self.rq.runq_buildable[taskid] == 1:
+                yield taskid
+
+    def next(self):
+        """
+        Return the id of the task we should build next
+        """
         if self.rq.stats.active < self.rq.number_tasks:
-            for task1 in range(len(self.rqdata.runq_fnid)):
-                task = self.prio_map[task1]
-                if self.rq.runq_running[task] == 1:
-                    continue
-                if self.rq.runq_buildable[task] == 1:
-                    return task
+            return next(self.next_buildable_tasks(), None)
 
 class RunQueueSchedulerSpeed(RunQueueScheduler):
     """