summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-03 17:20:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-15 10:28:12 +0100
commitd3d7163ab608b7264f1b8bcbc37d845b292be3b6 (patch)
tree1307366df2cd0833d4a19a6eab41b0acf5fe299f /bitbake
parent9341a6c5d1e88d7084083a2e6a44cd65ba5c2455 (diff)
downloadpoky-d3d7163ab608b7264f1b8bcbc37d845b292be3b6.tar.gz
bitbake: runqueue: Remove RunQueueExecuteScenequeue and RunQueueExecuteTasks
Replace the remains of the Tasks and Scenequeue Tasks classes with simple function calls. Also drop the dummy version of the execution class to simplify further changes as its not needed. (Bitbake rev: 33805394310046cd58c2194f6d063b3946811014) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/runqueue.py99
1 files changed, 43 insertions, 56 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index c6f45a345f..517684c3ff 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1407,7 +1407,6 @@ class RunQueue:
1407 retval = True 1407 retval = True
1408 1408
1409 if self.state is runQueuePrepare: 1409 if self.state is runQueuePrepare:
1410 self.rqexe = RunQueueExecuteDummy(self)
1411 # NOTE: if you add, remove or significantly refactor the stages of this 1410 # NOTE: if you add, remove or significantly refactor the stages of this
1412 # process then you should recalculate the weightings here. This is quite 1411 # process then you should recalculate the weightings here. This is quite
1413 # easy to do - just change the next line temporarily to pass debug=True as 1412 # easy to do - just change the next line temporarily to pass debug=True as
@@ -1449,7 +1448,9 @@ class RunQueue:
1449 self.rqdata.init_progress_reporter.next_stage() 1448 self.rqdata.init_progress_reporter.next_stage()
1450 self.start_worker() 1449 self.start_worker()
1451 self.rqdata.init_progress_reporter.next_stage() 1450 self.rqdata.init_progress_reporter.next_stage()
1452 self.rqexe = RunQueueExecuteScenequeue(self) 1451 if not self.rqexe:
1452 self.rqexe = RunQueueExecute(self)
1453 start_scenequeue_tasks(self.rqexe)
1453 1454
1454 if self.state is runQueueSceneRun: 1455 if self.state is runQueueSceneRun:
1455 retval = self.rqexe.sq_execute() 1456 retval = self.rqexe.sq_execute()
@@ -1461,7 +1462,9 @@ class RunQueue:
1461 # Just in case we didn't setscene 1462 # Just in case we didn't setscene
1462 self.rqdata.init_progress_reporter.finish() 1463 self.rqdata.init_progress_reporter.finish()
1463 logger.info("Executing RunQueue Tasks") 1464 logger.info("Executing RunQueue Tasks")
1464 self.rqexe = RunQueueExecuteTasks(self) 1465 if not self.rqexe:
1466 self.rqexe = RunQueueExecute(self)
1467 start_runqueue_tasks(self.rqexe)
1465 self.state = runQueueRunning 1468 self.state = runQueueRunning
1466 1469
1467 if self.state is runQueueRunning: 1470 if self.state is runQueueRunning:
@@ -1478,11 +1481,12 @@ class RunQueue:
1478 1481
1479 if build_done and self.rqexe: 1482 if build_done and self.rqexe:
1480 self.teardown_workers() 1483 self.teardown_workers()
1481 if self.rqexe.stats.failed: 1484 if self.rqexe:
1482 logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and %d failed.", self.rqexe.stats.completed + self.rqexe.stats.failed, self.rqexe.stats.skipped, self.rqexe.stats.failed) 1485 if self.rqexe.stats.failed:
1483 else: 1486 logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and %d failed.", self.rqexe.stats.completed + self.rqexe.stats.failed, self.rqexe.stats.skipped, self.rqexe.stats.failed)
1484 # Let's avoid the word "failed" if nothing actually did 1487 else:
1485 logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and all succeeded.", self.rqexe.stats.completed, self.rqexe.stats.skipped) 1488 # Let's avoid the word "failed" if nothing actually did
1489 logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and all succeeded.", self.rqexe.stats.completed, self.rqexe.stats.skipped)
1486 1490
1487 if self.state is runQueueFailed: 1491 if self.state is runQueueFailed:
1488 raise bb.runqueue.TaskFailure(self.rqexe.failed_tids) 1492 raise bb.runqueue.TaskFailure(self.rqexe.failed_tids)
@@ -2483,88 +2487,71 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2483 logger.debug(2, 'No package found, so skipping setscene task %s', tid) 2487 logger.debug(2, 'No package found, so skipping setscene task %s', tid)
2484 sqdata.outrightfail.append(tid) 2488 sqdata.outrightfail.append(tid)
2485 2489
2486 2490def start_runqueue_tasks(rqexec):
2487class RunQueueExecuteDummy(RunQueueExecute):
2488 def __init__(self, rq):
2489 self.rq = rq
2490 self.stats = RunQueueStats(0)
2491
2492 def finish(self):
2493 self.rq.state = runQueueComplete
2494 return
2495
2496class RunQueueExecuteTasks(RunQueueExecute):
2497 def __init__(self, rq):
2498 RunQueueExecute.__init__(self, rq)
2499
2500 self.stampcache = {}
2501 2491
2502 # Mark initial buildable tasks 2492 # Mark initial buildable tasks
2503 for tid in self.rqdata.runtaskentries: 2493 for tid in rqexec.rqdata.runtaskentries:
2504 if len(self.rqdata.runtaskentries[tid].depends) == 0: 2494 if len(rqexec.rqdata.runtaskentries[tid].depends) == 0:
2505 self.runq_buildable.add(tid) 2495 rqexec.runq_buildable.add(tid)
2506 if len(self.rqdata.runtaskentries[tid].revdeps) > 0 and self.rqdata.runtaskentries[tid].revdeps.issubset(self.rq.scenequeue_covered): 2496 if len(rqexec.rqdata.runtaskentries[tid].revdeps) > 0 and rqexec.rqdata.runtaskentries[tid].revdeps.issubset(rqexec.rq.scenequeue_covered):
2507 self.rq.scenequeue_covered.add(tid) 2497 rqexec.rq.scenequeue_covered.add(tid)
2508 2498
2509 found = True 2499 found = True
2510 while found: 2500 while found:
2511 found = False 2501 found = False
2512 for tid in self.rqdata.runtaskentries: 2502 for tid in rqexec.rqdata.runtaskentries:
2513 if tid in self.rq.scenequeue_covered: 2503 if tid in rqexec.rq.scenequeue_covered:
2514 continue 2504 continue
2515 logger.debug(1, 'Considering %s: %s' % (tid, str(self.rqdata.runtaskentries[tid].revdeps))) 2505 logger.debug(1, 'Considering %s: %s' % (tid, str(rqexec.rqdata.runtaskentries[tid].revdeps)))
2516 2506
2517 if len(self.rqdata.runtaskentries[tid].revdeps) > 0 and self.rqdata.runtaskentries[tid].revdeps.issubset(self.rq.scenequeue_covered): 2507 if len(rqexec.rqdata.runtaskentries[tid].revdeps) > 0 and rqexec.rqdata.runtaskentries[tid].revdeps.issubset(rqexec.rq.scenequeue_covered):
2518 if tid in self.rq.scenequeue_notcovered: 2508 if tid in rqexec.rq.scenequeue_notcovered:
2519 continue 2509 continue
2520 found = True 2510 found = True
2521 self.rq.scenequeue_covered.add(tid) 2511 rqexec.rq.scenequeue_covered.add(tid)
2522 2512
2523 logger.debug(1, 'Skip list %s', sorted(self.rq.scenequeue_covered)) 2513 logger.debug(1, 'Skip list %s', sorted(rqexec.rq.scenequeue_covered))
2524 2514
2525 for task in self.rq.scenequeue_notcovered: 2515 for task in self.rq.scenequeue_notcovered:
2526 logger.debug(1, 'Not skipping task %s', task) 2516 logger.debug(1, 'Not skipping task %s', task)
2527 2517
2528 for mc in self.rqdata.dataCaches: 2518 for mc in rqexec.rqdata.dataCaches:
2529 target_pairs = [] 2519 target_pairs = []
2530 for tid in self.rqdata.target_tids: 2520 for tid in rqexec.rqdata.target_tids:
2531 (tidmc, fn, taskname, _) = split_tid_mcfn(tid) 2521 (tidmc, fn, taskname, _) = split_tid_mcfn(tid)
2532 if tidmc == mc: 2522 if tidmc == mc:
2533 target_pairs.append((fn, taskname)) 2523 target_pairs.append((fn, taskname))
2534 2524
2535 event.fire(bb.event.StampUpdate(target_pairs, self.rqdata.dataCaches[mc].stamp), self.cfgData) 2525 event.fire(bb.event.StampUpdate(target_pairs, rqexec.rqdata.dataCaches[mc].stamp), rqexec.cfgData)
2536 2526
2537 schedulers = self.get_schedulers() 2527 schedulers = rqexec.get_schedulers()
2538 for scheduler in schedulers: 2528 for scheduler in schedulers:
2539 if self.scheduler == scheduler.name: 2529 if rqexec.scheduler == scheduler.name:
2540 self.sched = scheduler(self, self.rqdata) 2530 rqexec.sched = scheduler(rqexec, rqexec.rqdata)
2541 logger.debug(1, "Using runqueue scheduler '%s'", scheduler.name) 2531 logger.debug(1, "Using runqueue scheduler '%s'", scheduler.name)
2542 break 2532 break
2543 else: 2533 else:
2544 bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" % 2534 bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" %
2545 (self.scheduler, ", ".join(obj.name for obj in schedulers))) 2535 (rqexec.scheduler, ", ".join(obj.name for obj in schedulers)))
2546
2547class RunQueueExecuteScenequeue(RunQueueExecute):
2548 def __init__(self, rq):
2549 RunQueueExecute.__init__(self, rq)
2550 2536
2551 self.scenequeue_covered = set() 2537def start_scenequeue_tasks(rqexec):
2552 self.scenequeue_notcovered = set() 2538 rqexec.scenequeue_covered = set()
2553 self.scenequeue_notneeded = set() 2539 rqexec.scenequeue_notcovered = set()
2540 rqexec.scenequeue_notneeded = set()
2554 2541
2555 # If we don't have any setscene functions, skip this step 2542 # If we don't have any setscene functions, skip this step
2556 if len(self.rqdata.runq_setscene_tids) == 0: 2543 if len(rqexec.rqdata.runq_setscene_tids) == 0:
2557 rq.scenequeue_covered = set() 2544 rqexec.rq.scenequeue_covered = set()
2558 rq.scenequeue_notcovered = set() 2545 rqexec.rq.scenequeue_notcovered = set()
2559 rq.state = runQueueRunInit 2546 rqexec.rq.state = runQueueRunInit
2560 return 2547 return
2561 2548
2562 self.sqdata = SQData() 2549 rqexec.sqdata = SQData()
2563 build_scenequeue_data(self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self) 2550 build_scenequeue_data(rqexec.sqdata, rqexec.rqdata, rqexec.rq, rqexec.cooker, rqexec.stampcache, rqexec)
2564 2551
2565 logger.info('Executing SetScene Tasks') 2552 logger.info('Executing SetScene Tasks')
2566 2553
2567 self.rq.state = runQueueSceneRun 2554 rqexec.rq.state = runQueueSceneRun
2568 2555
2569class TaskFailure(Exception): 2556class TaskFailure(Exception):
2570 """ 2557 """