diff options
| -rw-r--r-- | bitbake/lib/bb/runqueue.py | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 2cfcb33cca..e1cb1409bf 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
| @@ -196,6 +196,11 @@ class RunQueueScheduler(object): | |||
| 196 | if self.rq.can_start_task(): | 196 | if self.rq.can_start_task(): |
| 197 | return self.next_buildable_task() | 197 | return self.next_buildable_task() |
| 198 | 198 | ||
| 199 | def initbuildable(self): | ||
| 200 | for tid in self.rqdata.runtaskentries: | ||
| 201 | if tid in self.rq.runq_buildable: | ||
| 202 | self.buildable.append(tid) | ||
| 203 | |||
| 199 | def newbuildable(self, task): | 204 | def newbuildable(self, task): |
| 200 | self.buildable.append(task) | 205 | self.buildable.append(task) |
| 201 | 206 | ||
| @@ -1451,7 +1456,14 @@ class RunQueue: | |||
| 1451 | self.start_worker() | 1456 | self.start_worker() |
| 1452 | self.rqdata.init_progress_reporter.next_stage() | 1457 | self.rqdata.init_progress_reporter.next_stage() |
| 1453 | self.rqexe = RunQueueExecute(self) | 1458 | self.rqexe = RunQueueExecute(self) |
| 1454 | start_scenequeue_tasks(self.rqexe) | 1459 | |
| 1460 | # If we don't have any setscene functions, skip execution | ||
| 1461 | if len(self.rqdata.runq_setscene_tids) == 0: | ||
| 1462 | self.rqdata.init_progress_reporter.finish() | ||
| 1463 | self.state = runQueueRunInit | ||
| 1464 | else: | ||
| 1465 | logger.info('Executing SetScene Tasks') | ||
| 1466 | self.state = runQueueSceneRun | ||
| 1455 | 1467 | ||
| 1456 | if self.state is runQueueSceneRun: | 1468 | if self.state is runQueueSceneRun: |
| 1457 | retval = self.rqexe.sq_execute() | 1469 | retval = self.rqexe.sq_execute() |
| @@ -1461,11 +1473,7 @@ class RunQueue: | |||
| 1461 | self.state = runQueueComplete | 1473 | self.state = runQueueComplete |
| 1462 | 1474 | ||
| 1463 | if self.state is runQueueRunInit: | 1475 | if self.state is runQueueRunInit: |
| 1464 | # Just in case we didn't setscene | ||
| 1465 | self.rqdata.init_progress_reporter.finish() | ||
| 1466 | logger.info("Executing RunQueue Tasks") | 1476 | logger.info("Executing RunQueue Tasks") |
| 1467 | if not self.rqexe: | ||
| 1468 | self.rqexe = RunQueueExecute(self) | ||
| 1469 | start_runqueue_tasks(self.rqexe) | 1477 | start_runqueue_tasks(self.rqexe) |
| 1470 | self.state = runQueueRunning | 1478 | self.state = runQueueRunning |
| 1471 | 1479 | ||
| @@ -1690,7 +1698,7 @@ def process_setscene_whitelist(rq, rqdata, stampcache, sched, rqex): | |||
| 1690 | def check_norun_task(tid, showerror=False): | 1698 | def check_norun_task(tid, showerror=False): |
| 1691 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) | 1699 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) |
| 1692 | # Ignore covered tasks | 1700 | # Ignore covered tasks |
| 1693 | if tid in rq.scenequeue_covered: | 1701 | if tid in rqex.scenequeue_covered: |
| 1694 | return False | 1702 | return False |
| 1695 | # Ignore stamped tasks | 1703 | # Ignore stamped tasks |
| 1696 | if rq.check_stamp_task(tid, taskname, cache=stampcache): | 1704 | if rq.check_stamp_task(tid, taskname, cache=stampcache): |
| @@ -1765,6 +1773,24 @@ class RunQueueExecute: | |||
| 1765 | if self.number_tasks <= 0: | 1773 | if self.number_tasks <= 0: |
| 1766 | bb.fatal("Invalid BB_NUMBER_THREADS %s" % self.number_tasks) | 1774 | bb.fatal("Invalid BB_NUMBER_THREADS %s" % self.number_tasks) |
| 1767 | 1775 | ||
| 1776 | self.scenequeue_covered = set() | ||
| 1777 | self.scenequeue_notcovered = set() | ||
| 1778 | self.scenequeue_notneeded = set() | ||
| 1779 | |||
| 1780 | if len(self.rqdata.runq_setscene_tids) > 0: | ||
| 1781 | self.sqdata = SQData() | ||
| 1782 | build_scenequeue_data(self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self) | ||
| 1783 | |||
| 1784 | schedulers = self.get_schedulers() | ||
| 1785 | for scheduler in schedulers: | ||
| 1786 | if self.scheduler == scheduler.name: | ||
| 1787 | self.sched = scheduler(self, self.rqdata) | ||
| 1788 | logger.debug(1, "Using runqueue scheduler '%s'", scheduler.name) | ||
| 1789 | break | ||
| 1790 | else: | ||
| 1791 | bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" % | ||
| 1792 | (self.scheduler, ", ".join(obj.name for obj in schedulers))) | ||
| 1793 | |||
| 1768 | def runqueue_process_waitpid(self, task, status): | 1794 | def runqueue_process_waitpid(self, task, status): |
| 1769 | 1795 | ||
| 1770 | # self.build_stamps[pid] may not exist when use shared work directory. | 1796 | # self.build_stamps[pid] may not exist when use shared work directory. |
| @@ -1937,7 +1963,7 @@ class RunQueueExecute: | |||
| 1937 | if task is not None: | 1963 | if task is not None: |
| 1938 | (mc, fn, taskname, taskfn) = split_tid_mcfn(task) | 1964 | (mc, fn, taskname, taskfn) = split_tid_mcfn(task) |
| 1939 | 1965 | ||
| 1940 | if task in self.rq.scenequeue_covered: | 1966 | if task in self.scenequeue_covered: |
| 1941 | logger.debug(2, "Setscene covered task %s", task) | 1967 | logger.debug(2, "Setscene covered task %s", task) |
| 1942 | self.task_skip(task, "covered") | 1968 | self.task_skip(task, "covered") |
| 1943 | return True | 1969 | return True |
| @@ -2194,10 +2220,7 @@ class RunQueueExecute: | |||
| 2194 | # revdeps = self.sqdata.sq_revdeps[tid] | 2220 | # revdeps = self.sqdata.sq_revdeps[tid] |
| 2195 | # bb.warn("Found we didn't run %s %s %s" % (tid, buildable, str(revdeps))) | 2221 | # bb.warn("Found we didn't run %s %s %s" % (tid, buildable, str(revdeps))) |
| 2196 | 2222 | ||
| 2197 | self.rq.scenequeue_covered = self.scenequeue_covered | 2223 | logger.debug(1, 'We can skip tasks %s', "\n".join(sorted(self.scenequeue_covered))) |
| 2198 | self.rq.scenequeue_notcovered = self.scenequeue_notcovered | ||
| 2199 | |||
| 2200 | logger.debug(1, 'We can skip tasks %s', "\n".join(sorted(self.rq.scenequeue_covered))) | ||
| 2201 | 2224 | ||
| 2202 | self.rq.state = runQueueRunInit | 2225 | self.rq.state = runQueueRunInit |
| 2203 | 2226 | ||
| @@ -2490,29 +2513,28 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): | |||
| 2490 | sqdata.outrightfail.append(tid) | 2513 | sqdata.outrightfail.append(tid) |
| 2491 | 2514 | ||
| 2492 | def start_runqueue_tasks(rqexec): | 2515 | def start_runqueue_tasks(rqexec): |
| 2493 | |||
| 2494 | # Mark initial buildable tasks | 2516 | # Mark initial buildable tasks |
| 2495 | for tid in rqexec.rqdata.runtaskentries: | 2517 | for tid in rqexec.rqdata.runtaskentries: |
| 2496 | if len(rqexec.rqdata.runtaskentries[tid].depends) == 0: | 2518 | if len(rqexec.rqdata.runtaskentries[tid].depends) == 0: |
| 2497 | rqexec.runq_buildable.add(tid) | 2519 | rqexec.runq_buildable.add(tid) |
| 2498 | if len(rqexec.rqdata.runtaskentries[tid].revdeps) > 0 and rqexec.rqdata.runtaskentries[tid].revdeps.issubset(rqexec.rq.scenequeue_covered): | 2520 | if len(rqexec.rqdata.runtaskentries[tid].revdeps) > 0 and rqexec.rqdata.runtaskentries[tid].revdeps.issubset(rqexec.scenequeue_covered): |
| 2499 | rqexec.rq.scenequeue_covered.add(tid) | 2521 | rqexec.scenequeue_covered.add(tid) |
| 2500 | 2522 | ||
| 2501 | found = True | 2523 | found = True |
| 2502 | while found: | 2524 | while found: |
| 2503 | found = False | 2525 | found = False |
| 2504 | for tid in rqexec.rqdata.runtaskentries: | 2526 | for tid in rqexec.rqdata.runtaskentries: |
| 2505 | if tid in rqexec.rq.scenequeue_covered: | 2527 | if tid in rqexec.scenequeue_covered: |
| 2506 | continue | 2528 | continue |
| 2507 | logger.debug(1, 'Considering %s: %s' % (tid, str(rqexec.rqdata.runtaskentries[tid].revdeps))) | 2529 | logger.debug(1, 'Considering %s: %s' % (tid, str(rqexec.rqdata.runtaskentries[tid].revdeps))) |
| 2508 | 2530 | ||
| 2509 | if len(rqexec.rqdata.runtaskentries[tid].revdeps) > 0 and rqexec.rqdata.runtaskentries[tid].revdeps.issubset(rqexec.rq.scenequeue_covered): | 2531 | if len(rqexec.rqdata.runtaskentries[tid].revdeps) > 0 and rqexec.rqdata.runtaskentries[tid].revdeps.issubset(rqexec.scenequeue_covered): |
| 2510 | if tid in rqexec.rq.scenequeue_notcovered: | 2532 | if tid in rqexec.scenequeue_notcovered: |
| 2511 | continue | 2533 | continue |
| 2512 | found = True | 2534 | found = True |
| 2513 | rqexec.rq.scenequeue_covered.add(tid) | 2535 | rqexec.scenequeue_covered.add(tid) |
| 2514 | 2536 | ||
| 2515 | logger.debug(1, 'Skip list %s', sorted(rqexec.rq.scenequeue_covered)) | 2537 | logger.debug(1, 'Skip list %s', sorted(rqexec.scenequeue_covered)) |
| 2516 | 2538 | ||
| 2517 | for task in self.rq.scenequeue_notcovered: | 2539 | for task in self.rq.scenequeue_notcovered: |
| 2518 | logger.debug(1, 'Not skipping task %s', task) | 2540 | logger.debug(1, 'Not skipping task %s', task) |
| @@ -2525,35 +2547,8 @@ def start_runqueue_tasks(rqexec): | |||
| 2525 | target_pairs.append((fn, taskname)) | 2547 | target_pairs.append((fn, taskname)) |
| 2526 | 2548 | ||
| 2527 | event.fire(bb.event.StampUpdate(target_pairs, rqexec.rqdata.dataCaches[mc].stamp), rqexec.cfgData) | 2549 | event.fire(bb.event.StampUpdate(target_pairs, rqexec.rqdata.dataCaches[mc].stamp), rqexec.cfgData) |
| 2550 | rqexec.sched.initbuildable() | ||
| 2528 | 2551 | ||
| 2529 | schedulers = rqexec.get_schedulers() | ||
| 2530 | for scheduler in schedulers: | ||
| 2531 | if rqexec.scheduler == scheduler.name: | ||
| 2532 | rqexec.sched = scheduler(rqexec, rqexec.rqdata) | ||
| 2533 | logger.debug(1, "Using runqueue scheduler '%s'", scheduler.name) | ||
| 2534 | break | ||
| 2535 | else: | ||
| 2536 | bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" % | ||
| 2537 | (rqexec.scheduler, ", ".join(obj.name for obj in schedulers))) | ||
| 2538 | |||
| 2539 | def start_scenequeue_tasks(rqexec): | ||
| 2540 | rqexec.scenequeue_covered = set() | ||
| 2541 | rqexec.scenequeue_notcovered = set() | ||
| 2542 | rqexec.scenequeue_notneeded = set() | ||
| 2543 | |||
| 2544 | # If we don't have any setscene functions, skip this step | ||
| 2545 | if len(rqexec.rqdata.runq_setscene_tids) == 0: | ||
| 2546 | rqexec.rq.scenequeue_covered = set() | ||
| 2547 | rqexec.rq.scenequeue_notcovered = set() | ||
| 2548 | rqexec.rq.state = runQueueRunInit | ||
| 2549 | return | ||
| 2550 | |||
| 2551 | rqexec.sqdata = SQData() | ||
| 2552 | build_scenequeue_data(rqexec.sqdata, rqexec.rqdata, rqexec.rq, rqexec.cooker, rqexec.stampcache, rqexec) | ||
| 2553 | |||
| 2554 | logger.info('Executing SetScene Tasks') | ||
| 2555 | |||
| 2556 | rqexec.rq.state = runQueueSceneRun | ||
| 2557 | 2552 | ||
| 2558 | class TaskFailure(Exception): | 2553 | class TaskFailure(Exception): |
| 2559 | """ | 2554 | """ |
