diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-01-10 12:48:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-01-10 13:24:04 +0000 |
commit | 9336ba1fd2ae750d3d399cc046896ef50f4cc0ed (patch) | |
tree | a7884f109932431ca4f7de8a5a59de69262da108 /bitbake/lib/bb/runqueue.py | |
parent | 5cc720aac294428f61212a4e83b2b4b72478de03 (diff) | |
download | poky-9336ba1fd2ae750d3d399cc046896ef50f4cc0ed.tar.gz |
bitbake/runqueue.py: Sync with changes in upstream bitbake
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 170 |
1 files changed, 80 insertions, 90 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 4e37aaf723..8580f51693 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -22,13 +22,13 @@ Handles preparation and execution of a queue of tasks | |||
22 | # with this program; if not, write to the Free Software Foundation, Inc., | 22 | # with this program; if not, write to the Free Software Foundation, Inc., |
23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
24 | 24 | ||
25 | import copy | ||
25 | import os | 26 | import os |
26 | import sys | 27 | import sys |
27 | import subprocess | 28 | import subprocess |
28 | import signal | 29 | import signal |
29 | import stat | 30 | import stat |
30 | import fcntl | 31 | import fcntl |
31 | import copy | ||
32 | import logging | 32 | import logging |
33 | import bb | 33 | import bb |
34 | from bb import msg, data, event | 34 | from bb import msg, data, event |
@@ -36,12 +36,6 @@ from bb import msg, data, event | |||
36 | bblogger = logging.getLogger("BitBake") | 36 | bblogger = logging.getLogger("BitBake") |
37 | logger = logging.getLogger("BitBake.RunQueue") | 37 | logger = logging.getLogger("BitBake.RunQueue") |
38 | 38 | ||
39 | try: | ||
40 | import cPickle as pickle | ||
41 | except ImportError: | ||
42 | import pickle | ||
43 | logger.info("Importing cPickle failed. Falling back to a very slow implementation.") | ||
44 | |||
45 | class RunQueueStats: | 39 | class RunQueueStats: |
46 | """ | 40 | """ |
47 | Holds statistics on the tasks handled by the associated runQueue | 41 | Holds statistics on the tasks handled by the associated runQueue |
@@ -93,28 +87,28 @@ class RunQueueScheduler(object): | |||
93 | """ | 87 | """ |
94 | self.rq = runqueue | 88 | self.rq = runqueue |
95 | self.rqdata = rqdata | 89 | self.rqdata = rqdata |
96 | numTasks = len(self.rq.runq_fnid) | 90 | numTasks = len(self.rqdata.runq_fnid) |
97 | 91 | ||
98 | self.prio_map = [] | 92 | self.prio_map = [] |
99 | self.prio_map.extend(range(numTasks)) | 93 | self.prio_map.extend(range(numTasks)) |
100 | 94 | ||
101 | def next_buildable_tasks(self): | 95 | def next_buildable_task(self): |
102 | """ | 96 | """ |
103 | Return the id of the first task we find that is buildable | 97 | Return the id of the first task we find that is buildable |
104 | """ | 98 | """ |
105 | for tasknum in range(len(self.rqdata.runq_fnid)): | 99 | for tasknum in xrange(len(self.rqdata.runq_fnid)): |
106 | taskid = self.prio_map[tasknum] | 100 | taskid = self.prio_map[tasknum] |
107 | if self.rq.runq_running[taskid] == 1: | 101 | if self.rq.runq_running[taskid] == 1: |
108 | continue | 102 | continue |
109 | if self.rq.runq_buildable[taskid] == 1: | 103 | if self.rq.runq_buildable[taskid] == 1: |
110 | yield taskid | 104 | return taskid |
111 | 105 | ||
112 | def next(self): | 106 | def next(self): |
113 | """ | 107 | """ |
114 | Return the id of the task we should build next | 108 | Return the id of the task we should build next |
115 | """ | 109 | """ |
116 | if self.rq.stats.active < self.rq.number_tasks: | 110 | if self.rq.stats.active < self.rq.number_tasks: |
117 | return next(self.next_buildable_tasks(), None) | 111 | return self.next_buildable_task() |
118 | 112 | ||
119 | class RunQueueSchedulerSpeed(RunQueueScheduler): | 113 | class RunQueueSchedulerSpeed(RunQueueScheduler): |
120 | """ | 114 | """ |
@@ -127,13 +121,12 @@ class RunQueueSchedulerSpeed(RunQueueScheduler): | |||
127 | """ | 121 | """ |
128 | The priority map is sorted by task weight. | 122 | The priority map is sorted by task weight. |
129 | """ | 123 | """ |
130 | from copy import deepcopy | ||
131 | 124 | ||
132 | self.rq = runqueue | 125 | self.rq = runqueue |
133 | self.rqdata = rqdata | 126 | self.rqdata = rqdata |
134 | 127 | ||
135 | sortweight = sorted(deepcopy(self.rqdata.runq_weight)) | 128 | sortweight = sorted(copy.deepcopy(self.rqdata.runq_weight)) |
136 | copyweight = deepcopy(self.rqdata.runq_weight) | 129 | copyweight = copy.deepcopy(self.rqdata.runq_weight) |
137 | self.prio_map = [] | 130 | self.prio_map = [] |
138 | 131 | ||
139 | for weight in sortweight: | 132 | for weight in sortweight: |
@@ -155,12 +148,11 @@ class RunQueueSchedulerCompletion(RunQueueSchedulerSpeed): | |||
155 | 148 | ||
156 | def __init__(self, runqueue, rqdata): | 149 | def __init__(self, runqueue, rqdata): |
157 | RunQueueSchedulerSpeed.__init__(self, runqueue, rqdata) | 150 | RunQueueSchedulerSpeed.__init__(self, runqueue, rqdata) |
158 | from copy import deepcopy | ||
159 | 151 | ||
160 | #FIXME - whilst this groups all fnids together it does not reorder the | 152 | #FIXME - whilst this groups all fnids together it does not reorder the |
161 | #fnid groups optimally. | 153 | #fnid groups optimally. |
162 | 154 | ||
163 | basemap = deepcopy(self.prio_map) | 155 | basemap = copy.deepcopy(self.prio_map) |
164 | self.prio_map = [] | 156 | self.prio_map = [] |
165 | while (len(basemap) > 0): | 157 | while (len(basemap) > 0): |
166 | entry = basemap.pop(0) | 158 | entry = basemap.pop(0) |
@@ -190,25 +182,6 @@ class RunQueueData: | |||
190 | self.stampwhitelist = bb.data.getVar("BB_STAMP_WHITELIST", cfgData, 1) or "" | 182 | self.stampwhitelist = bb.data.getVar("BB_STAMP_WHITELIST", cfgData, 1) or "" |
191 | self.multi_provider_whitelist = (bb.data.getVar("MULTI_PROVIDER_WHITELIST", cfgData, 1) or "").split() | 183 | self.multi_provider_whitelist = (bb.data.getVar("MULTI_PROVIDER_WHITELIST", cfgData, 1) or "").split() |
192 | 184 | ||
193 | self.schedulers = set(obj for obj in globals().itervalues() | ||
194 | if type(obj) is type and issubclass(obj, RunQueueScheduler)) | ||
195 | |||
196 | user_schedulers = bb.data.getVar("BB_SCHEDULERS", cfgData, True) | ||
197 | if user_schedulers: | ||
198 | for sched in user_schedulers.split(): | ||
199 | if not "." in sched: | ||
200 | bb.note("Ignoring scheduler '%s' from BB_SCHEDULERS: not an import" % sched) | ||
201 | continue | ||
202 | |||
203 | modname, name = sched.rsplit(".", 1) | ||
204 | try: | ||
205 | module = __import__(modname, fromlist=(name,)) | ||
206 | except ImportError, exc: | ||
207 | logger.critical("Unable to import scheduler '%s' from '%s': %s" % (name, modname, exc)) | ||
208 | raise SystemExit(1) | ||
209 | else: | ||
210 | self.schedulers.add(getattr(module, name)) | ||
211 | |||
212 | self.reset() | 185 | self.reset() |
213 | 186 | ||
214 | def reset(self): | 187 | def reset(self): |
@@ -313,7 +286,7 @@ class RunQueueData: | |||
313 | if dep in explored_deps[revdep]: | 286 | if dep in explored_deps[revdep]: |
314 | scan = True | 287 | scan = True |
315 | if scan: | 288 | if scan: |
316 | find_chains(revdep, deepcopy(prev_chain)) | 289 | find_chains(revdep, copy.deepcopy(prev_chain)) |
317 | for dep in explored_deps[revdep]: | 290 | for dep in explored_deps[revdep]: |
318 | if dep not in total_deps: | 291 | if dep not in total_deps: |
319 | total_deps.append(dep) | 292 | total_deps.append(dep) |
@@ -715,20 +688,15 @@ class RunQueueData: | |||
715 | stampfnwhitelist.append(fn) | 688 | stampfnwhitelist.append(fn) |
716 | self.stampfnwhitelist = stampfnwhitelist | 689 | self.stampfnwhitelist = stampfnwhitelist |
717 | 690 | ||
718 | #self.dump_data(taskData) | ||
719 | |||
720 | # Interate over the task list looking for tasks with a 'setscene' function | 691 | # Interate over the task list looking for tasks with a 'setscene' function |
721 | |||
722 | self.runq_setscene = [] | 692 | self.runq_setscene = [] |
723 | for task in range(len(self.runq_fnid)): | 693 | for task in range(len(self.runq_fnid)): |
724 | setscene = taskData.gettask_id(self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task] + "_setscene", False) | 694 | setscene = taskData.gettask_id(self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task] + "_setscene", False) |
725 | if not setscene: | 695 | if not setscene: |
726 | continue | 696 | continue |
727 | #bb.note("Found setscene for %s %s" % (self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task])) | ||
728 | self.runq_setscene.append(task) | 697 | self.runq_setscene.append(task) |
729 | 698 | ||
730 | # Interate over the task list and call into the siggen code | 699 | # Interate over the task list and call into the siggen code |
731 | |||
732 | dealtwith = set() | 700 | dealtwith = set() |
733 | todeal = set(range(len(self.runq_fnid))) | 701 | todeal = set(range(len(self.runq_fnid))) |
734 | while len(todeal) > 0: | 702 | while len(todeal) > 0: |
@@ -744,7 +712,7 @@ class RunQueueData: | |||
744 | hashdata = {} | 712 | hashdata = {} |
745 | hashdata["hashes"] = {} | 713 | hashdata["hashes"] = {} |
746 | hashdata["deps"] = {} | 714 | hashdata["deps"] = {} |
747 | for task in range(len(self.runq_fnid)): | 715 | for task in xrange(len(self.runq_fnid)): |
748 | hashdata["hashes"][self.taskData.fn_index[self.runq_fnid[task]] + "." + self.runq_task[task]] = self.runq_hash[task] | 716 | hashdata["hashes"][self.taskData.fn_index[self.runq_fnid[task]] + "." + self.runq_task[task]] = self.runq_hash[task] |
749 | deps = [] | 717 | deps = [] |
750 | for dep in self.runq_depends[task]: | 718 | for dep in self.runq_depends[task]: |
@@ -764,24 +732,24 @@ class RunQueueData: | |||
764 | Dump some debug information on the internal data structures | 732 | Dump some debug information on the internal data structures |
765 | """ | 733 | """ |
766 | logger.debug(3, "run_tasks:") | 734 | logger.debug(3, "run_tasks:") |
767 | for task in range(len(self.rqdata.runq_task)): | 735 | for task in xrange(len(self.rqdata.runq_task)): |
768 | logger.debug(3, " (%s)%s - %s: %s Deps %s RevDeps %s" % (task, | 736 | logger.debug(3, " (%s)%s - %s: %s Deps %s RevDeps %s", task, |
769 | taskQueue.fn_index[self.rqdata.runq_fnid[task]], | 737 | taskQueue.fn_index[self.rqdata.runq_fnid[task]], |
770 | self.rqdata.runq_task[task], | 738 | self.rqdata.runq_task[task], |
771 | self.rqdata.runq_weight[task], | 739 | self.rqdata.runq_weight[task], |
772 | self.rqdata.runq_depends[task], | 740 | self.rqdata.runq_depends[task], |
773 | self.rqdata.runq_revdeps[task])) | 741 | self.rqdata.runq_revdeps[task]) |
774 | 742 | ||
775 | logger.debug(3, "sorted_tasks:") | 743 | logger.debug(3, "sorted_tasks:") |
776 | for task1 in range(len(self.rqdata.runq_task)): | 744 | for task1 in xrange(len(self.rqdata.runq_task)): |
777 | if task1 in self.prio_map: | 745 | if task1 in self.prio_map: |
778 | task = self.prio_map[task1] | 746 | task = self.prio_map[task1] |
779 | logger.debug(3, " (%s)%s - %s: %s Deps %s RevDeps %s" % (task, | 747 | logger.debug(3, " (%s)%s - %s: %s Deps %s RevDeps %s", task, |
780 | taskQueue.fn_index[self.rqdata.runq_fnid[task]], | 748 | taskQueue.fn_index[self.rqdata.runq_fnid[task]], |
781 | self.rqdata.runq_task[task], | 749 | self.rqdata.runq_task[task], |
782 | self.rqdata.runq_weight[task], | 750 | self.rqdata.runq_weight[task], |
783 | self.rqdata.runq_depends[task], | 751 | self.rqdata.runq_depends[task], |
784 | self.rqdata.runq_revdeps[task])) | 752 | self.rqdata.runq_revdeps[task]) |
785 | 753 | ||
786 | class RunQueue: | 754 | class RunQueue: |
787 | def __init__(self, cooker, cfgData, dataCache, taskData, targets): | 755 | def __init__(self, cooker, cfgData, dataCache, taskData, targets): |
@@ -809,7 +777,7 @@ class RunQueue: | |||
809 | if self.stamppolicy == "whitelist": | 777 | if self.stamppolicy == "whitelist": |
810 | stampwhitelist = self.rqdata.stampfnwhitelist | 778 | stampwhitelist = self.rqdata.stampfnwhitelist |
811 | 779 | ||
812 | for task in range(len(self.rqdata.runq_fnid)): | 780 | for task in xrange(len(self.rqdata.runq_fnid)): |
813 | unchecked[task] = "" | 781 | unchecked[task] = "" |
814 | if len(self.rqdata.runq_depends[task]) == 0: | 782 | if len(self.rqdata.runq_depends[task]) == 0: |
815 | buildable.append(task) | 783 | buildable.append(task) |
@@ -824,7 +792,7 @@ class RunQueue: | |||
824 | if revdep in unchecked: | 792 | if revdep in unchecked: |
825 | buildable.append(revdep) | 793 | buildable.append(revdep) |
826 | 794 | ||
827 | for task in range(len(self.rqdata.runq_fnid)): | 795 | for task in xrange(len(self.rqdata.runq_fnid)): |
828 | if task not in unchecked: | 796 | if task not in unchecked: |
829 | continue | 797 | continue |
830 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] | 798 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] |
@@ -909,7 +877,7 @@ class RunQueue: | |||
909 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] | 877 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] |
910 | if taskname is None: | 878 | if taskname is None: |
911 | taskname = self.rqdata.runq_task[task] | 879 | taskname = self.rqdata.runq_task[task] |
912 | 880 | ||
913 | stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname) | 881 | stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname) |
914 | 882 | ||
915 | # If the stamp is missing its not current | 883 | # If the stamp is missing its not current |
@@ -919,7 +887,7 @@ class RunQueue: | |||
919 | # If its a 'nostamp' task, it's not current | 887 | # If its a 'nostamp' task, it's not current |
920 | taskdep = self.rqdata.dataCache.task_deps[fn] | 888 | taskdep = self.rqdata.dataCache.task_deps[fn] |
921 | if 'nostamp' in taskdep and taskname in taskdep['nostamp']: | 889 | if 'nostamp' in taskdep and taskname in taskdep['nostamp']: |
922 | logger.debug(2, "%s.%s is nostamp\n" % (fn, taskname)) | 890 | logger.debug(2, "%s.%s is nostamp\n", fn, taskname) |
923 | return False | 891 | return False |
924 | 892 | ||
925 | if taskname != "do_setscene" and taskname.endswith("_setscene"): | 893 | if taskname != "do_setscene" and taskname.endswith("_setscene"): |
@@ -939,10 +907,10 @@ class RunQueue: | |||
939 | continue | 907 | continue |
940 | if fn == fn2 or (fulldeptree and fn2 not in stampwhitelist): | 908 | if fn == fn2 or (fulldeptree and fn2 not in stampwhitelist): |
941 | if not t2: | 909 | if not t2: |
942 | logger.debug(2, "Stampfile %s does not exist" % (stampfile2)) | 910 | logger.debug(2, 'Stampfile %s does not exist', stampfile2) |
943 | iscurrent = False | 911 | iscurrent = False |
944 | if t1 < t2: | 912 | if t1 < t2: |
945 | logger.debug(2, "Stampfile %s < %s" % (stampfile, stampfile2)) | 913 | logger.debug(2, 'Stampfile %s < %s', stampfile, stampfile2) |
946 | iscurrent = False | 914 | iscurrent = False |
947 | 915 | ||
948 | return iscurrent | 916 | return iscurrent |
@@ -1014,7 +982,7 @@ class RunQueue: | |||
1014 | bb.note("Reparsing files to collect dependency data") | 982 | bb.note("Reparsing files to collect dependency data") |
1015 | for task in range(len(self.rqdata.runq_fnid)): | 983 | for task in range(len(self.rqdata.runq_fnid)): |
1016 | if self.rqdata.runq_fnid[task] not in done: | 984 | if self.rqdata.runq_fnid[task] not in done: |
1017 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] | 985 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] |
1018 | the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.get_file_appends(fn), self.cooker.configuration.data) | 986 | the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.get_file_appends(fn), self.cooker.configuration.data) |
1019 | done.add(self.rqdata.runq_fnid[task]) | 987 | done.add(self.rqdata.runq_fnid[task]) |
1020 | 988 | ||
@@ -1219,14 +1187,38 @@ class RunQueueExecuteTasks(RunQueueExecute): | |||
1219 | 1187 | ||
1220 | event.fire(bb.event.StampUpdate(self.rqdata.target_pairs, self.rqdata.dataCache.stamp), self.cfgData) | 1188 | event.fire(bb.event.StampUpdate(self.rqdata.target_pairs, self.rqdata.dataCache.stamp), self.cfgData) |
1221 | 1189 | ||
1222 | for scheduler in self.rqdata.schedulers: | 1190 | schedulers = self.get_schedulers() |
1191 | for scheduler in schedulers: | ||
1223 | if self.scheduler == scheduler.name: | 1192 | if self.scheduler == scheduler.name: |
1224 | self.sched = scheduler(self, self.rqdata) | 1193 | self.sched = scheduler(self, self.rqdata) |
1225 | logger.debug(1, "Using runqueue scheduler '%s'", scheduler.name) | 1194 | logger.debug(1, "Using runqueue scheduler '%s'", scheduler.name) |
1226 | break | 1195 | break |
1227 | else: | 1196 | else: |
1228 | bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" % | 1197 | bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" % |
1229 | (self.scheduler, ", ".join(obj.name for obj in self.rqdata.schedulers))) | 1198 | (self.scheduler, ", ".join(obj.name for obj in schedulers))) |
1199 | |||
1200 | |||
1201 | def get_schedulers(self): | ||
1202 | schedulers = set(obj for obj in globals().values() | ||
1203 | if type(obj) is type and | ||
1204 | issubclass(obj, RunQueueScheduler)) | ||
1205 | |||
1206 | user_schedulers = bb.data.getVar("BB_SCHEDULERS", self.cfgData, True) | ||
1207 | if user_schedulers: | ||
1208 | for sched in user_schedulers.split(): | ||
1209 | if not "." in sched: | ||
1210 | bb.note("Ignoring scheduler '%s' from BB_SCHEDULERS: not an import" % sched) | ||
1211 | continue | ||
1212 | |||
1213 | modname, name = sched.rsplit(".", 1) | ||
1214 | try: | ||
1215 | module = __import__(modname, fromlist=(name,)) | ||
1216 | except ImportError, exc: | ||
1217 | logger.critical("Unable to import scheduler '%s' from '%s': %s" % (name, modname, exc)) | ||
1218 | raise SystemExit(1) | ||
1219 | else: | ||
1220 | schedulers.add(getattr(module, name)) | ||
1221 | return schedulers | ||
1230 | 1222 | ||
1231 | def task_completeoutright(self, task): | 1223 | def task_completeoutright(self, task): |
1232 | """ | 1224 | """ |
@@ -1283,12 +1275,14 @@ class RunQueueExecuteTasks(RunQueueExecute): | |||
1283 | # nothing to do | 1275 | # nothing to do |
1284 | self.rq.state = runQueueCleanUp | 1276 | self.rq.state = runQueueCleanUp |
1285 | 1277 | ||
1286 | for task in iter(self.sched.next, None): | 1278 | task = self.sched.next() |
1279 | if task is not None: | ||
1287 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] | 1280 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] |
1288 | 1281 | ||
1289 | taskname = self.rqdata.runq_task[task] | 1282 | taskname = self.rqdata.runq_task[task] |
1290 | if self.rq.check_stamp_task(task, taskname): | 1283 | if self.rq.check_stamp_task(task, taskname): |
1291 | logger.debug(2, "Stamp current task %s (%s)" % (task, self.rqdata.get_user_idstring(task))) | 1284 | logger.debug(2, "Stamp current task %s (%s)", task, |
1285 | self.rqdata.get_user_idstring(task)) | ||
1292 | self.task_skip(task) | 1286 | self.task_skip(task) |
1293 | return True | 1287 | return True |
1294 | 1288 | ||
@@ -1455,12 +1449,11 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
1455 | 1449 | ||
1456 | for task in xrange(len(self.sq_revdeps)): | 1450 | for task in xrange(len(self.sq_revdeps)): |
1457 | if task not in valid_new and task not in noexec: | 1451 | if task not in valid_new and task not in noexec: |
1458 | logger.debug(2, "No package found so skipping setscene task %s" % (self.rqdata.get_user_idstring(self.rqdata.runq_setscene[task]))) | 1452 | logger.debug(2, 'No package found, so skipping setscene task %s', |
1453 | self.rqdata.get_user_idstring(task)) | ||
1459 | self.task_failoutright(task) | 1454 | self.task_failoutright(task) |
1460 | 1455 | ||
1461 | #print(str(valid)) | 1456 | logger.info('Executing SetScene Tasks') |
1462 | |||
1463 | logger.info("Executing SetScene Tasks") | ||
1464 | 1457 | ||
1465 | self.rq.state = runQueueSceneRun | 1458 | self.rq.state = runQueueSceneRun |
1466 | 1459 | ||
@@ -1521,11 +1514,6 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
1521 | # Find the next setscene to run | 1514 | # Find the next setscene to run |
1522 | for nexttask in xrange(self.stats.total): | 1515 | for nexttask in xrange(self.stats.total): |
1523 | if self.runq_buildable[nexttask] == 1 and self.runq_running[nexttask] != 1: | 1516 | if self.runq_buildable[nexttask] == 1 and self.runq_running[nexttask] != 1: |
1524 | #bb.note("Comparing %s to %s" % (self.sq_revdeps[nexttask], self.scenequeue_covered)) | ||
1525 | #if len(self.sq_revdeps[nexttask]) > 0 and self.sq_revdeps[nexttask].issubset(self.scenequeue_covered): | ||
1526 | # bb.note("Skipping task %s" % nexttask) | ||
1527 | # self.scenequeue_skip(nexttask) | ||
1528 | # return True | ||
1529 | task = nexttask | 1517 | task = nexttask |
1530 | break | 1518 | break |
1531 | if task is not None: | 1519 | if task is not None: |
@@ -1534,7 +1522,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
1534 | 1522 | ||
1535 | taskname = self.rqdata.runq_task[realtask] + "_setscene" | 1523 | taskname = self.rqdata.runq_task[realtask] + "_setscene" |
1536 | if self.rq.check_stamp_task(realtask, self.rqdata.runq_task[realtask]): | 1524 | if self.rq.check_stamp_task(realtask, self.rqdata.runq_task[realtask]): |
1537 | logger.debug(2, "Stamp for underlying task %s (%s) is current so skipping setscene varient" % (task, self.rqdata.get_user_idstring(task))) | 1525 | logger.debug(2, 'Stamp for underlying task %s(%s) is current, so skipping setscene variant', |
1526 | task, self.rqdata.get_user_idstring(task)) | ||
1538 | self.task_failoutright(task) | 1527 | self.task_failoutright(task) |
1539 | return True | 1528 | return True |
1540 | 1529 | ||
@@ -1545,7 +1534,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
1545 | return True | 1534 | return True |
1546 | 1535 | ||
1547 | if self.rq.check_stamp_task(realtask, taskname): | 1536 | if self.rq.check_stamp_task(realtask, taskname): |
1548 | logger.debug(2, "Setscene stamp current task %s (%s) so skip it and its dependencies" % (task, self.rqdata.get_user_idstring(realtask))) | 1537 | logger.debug(2, 'Setscene stamp current task %s(%s), so skip it and its dependencies', |
1538 | task, self.rqdata.get_user_idstring(realtask)) | ||
1549 | self.task_skip(task) | 1539 | self.task_skip(task) |
1550 | return True | 1540 | return True |
1551 | 1541 | ||
@@ -1575,7 +1565,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
1575 | for task in oldcovered: | 1565 | for task in oldcovered: |
1576 | self.rq.scenequeue_covered.add(self.rqdata.runq_setscene[task]) | 1566 | self.rq.scenequeue_covered.add(self.rqdata.runq_setscene[task]) |
1577 | 1567 | ||
1578 | bb.debug(1, "We can skip tasks %s" % self.rq.scenequeue_covered) | 1568 | logger.debug(1, 'We can skip tasks %s', self.rq.scenequeue_covered) |
1579 | 1569 | ||
1580 | self.rq.state = runQueueRunInit | 1570 | self.rq.state = runQueueRunInit |
1581 | return True | 1571 | return True |
@@ -1630,12 +1620,12 @@ class runQueueTaskCompleted(runQueueEvent): | |||
1630 | """ | 1620 | """ |
1631 | 1621 | ||
1632 | #def check_stamp_fn(fn, taskname, d): | 1622 | #def check_stamp_fn(fn, taskname, d): |
1633 | # rq = bb.data.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", d) | 1623 | # rqexe = bb.data.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", d) |
1634 | # fn = bb.data.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", d) | 1624 | # fn = bb.data.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", d) |
1635 | # fnid = rq.rqdata.taskData.getfn_id(fn) | 1625 | # fnid = rqexe.rqdata.taskData.getfn_id(fn) |
1636 | # taskid = rq.get_task_id(fnid, taskname) | 1626 | # taskid = rqexe.rqdata.get_task_id(fnid, taskname) |
1637 | # if taskid is not None: | 1627 | # if taskid is not None: |
1638 | # return rq.check_stamp_task(taskid) | 1628 | # return rqexe.rq.check_stamp_task(taskid) |
1639 | # return None | 1629 | # return None |
1640 | 1630 | ||
1641 | class runQueuePipe(): | 1631 | class runQueuePipe(): |
@@ -1643,17 +1633,17 @@ class runQueuePipe(): | |||
1643 | Abstraction for a pipe between a worker thread and the server | 1633 | Abstraction for a pipe between a worker thread and the server |
1644 | """ | 1634 | """ |
1645 | def __init__(self, pipein, pipeout, d): | 1635 | def __init__(self, pipein, pipeout, d): |
1646 | self.fd = pipein | 1636 | self.input = pipein |
1647 | pipeout.close() | 1637 | pipeout.close() |
1648 | fcntl.fcntl(self.fd, fcntl.F_SETFL, fcntl.fcntl(self.fd, fcntl.F_GETFL) | os.O_NONBLOCK) | 1638 | fcntl.fcntl(self.input, fcntl.F_SETFL, fcntl.fcntl(self.input, fcntl.F_GETFL) | os.O_NONBLOCK) |
1649 | self.queue = "" | 1639 | self.queue = "" |
1650 | self.d = d | 1640 | self.d = d |
1651 | 1641 | ||
1652 | def read(self): | 1642 | def read(self): |
1653 | start = len(self.queue) | 1643 | start = len(self.queue) |
1654 | try: | 1644 | try: |
1655 | self.queue = self.queue + self.fd.read(1024) | 1645 | self.queue = self.queue + self.input.read(1024) |
1656 | except IOError: | 1646 | except (OSError, IOError): |
1657 | pass | 1647 | pass |
1658 | end = len(self.queue) | 1648 | end = len(self.queue) |
1659 | index = self.queue.find("</event>") | 1649 | index = self.queue.find("</event>") |
@@ -1668,4 +1658,4 @@ class runQueuePipe(): | |||
1668 | continue | 1658 | continue |
1669 | if len(self.queue) > 0: | 1659 | if len(self.queue) > 0: |
1670 | print("Warning, worker left partial message: %s" % self.queue) | 1660 | print("Warning, worker left partial message: %s" % self.queue) |
1671 | self.fd.close() | 1661 | self.input.close() |