diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-07-03 15:39:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-07-15 10:28:12 +0100 |
commit | dd7f09f471f19b8a03d62ff3a9a48a3173c2458f (patch) | |
tree | dc0e7ad6fc7790b641b5b673492e29a5a4051b42 /bitbake/lib/bb/runqueue.py | |
parent | 2c0d4b6816dedcc52c7eea030a556cd58e9e5e47 (diff) | |
download | poky-dd7f09f471f19b8a03d62ff3a9a48a3173c2458f.tar.gz |
bitbake: runqueue: Uniquely namespace the scenequeue functions
In preparation for merging the setscene and normal task execution,
uniquely namespace the scenequeue specific functions.
For the one shared function, add the "sq_live" variable so we know
which functions to send the results to.
(Bitbake rev: 2cbe9399902ba67dca566c7344b2247412cf4d5c)
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 | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 6aa4dabe16..5832db4ae5 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -1452,7 +1452,7 @@ class RunQueue: | |||
1452 | self.rqexe = RunQueueExecuteScenequeue(self) | 1452 | self.rqexe = RunQueueExecuteScenequeue(self) |
1453 | 1453 | ||
1454 | if self.state is runQueueSceneRun: | 1454 | if self.state is runQueueSceneRun: |
1455 | retval = self.rqexe.execute() | 1455 | retval = self.rqexe.sq_execute() |
1456 | 1456 | ||
1457 | if self.state is runQueueRunInit: | 1457 | if self.state is runQueueRunInit: |
1458 | if self.cooker.configuration.setsceneonly: | 1458 | if self.cooker.configuration.setsceneonly: |
@@ -1734,6 +1734,10 @@ class RunQueueExecute: | |||
1734 | self.number_tasks = int(self.cfgData.getVar("BB_NUMBER_THREADS") or 1) | 1734 | self.number_tasks = int(self.cfgData.getVar("BB_NUMBER_THREADS") or 1) |
1735 | self.scheduler = self.cfgData.getVar("BB_SCHEDULER") or "speed" | 1735 | self.scheduler = self.cfgData.getVar("BB_SCHEDULER") or "speed" |
1736 | 1736 | ||
1737 | self.sq_buildable = set() | ||
1738 | self.sq_running = set() | ||
1739 | self.sq_live = set() | ||
1740 | |||
1737 | self.runq_buildable = set() | 1741 | self.runq_buildable = set() |
1738 | self.runq_running = set() | 1742 | self.runq_running = set() |
1739 | self.runq_complete = set() | 1743 | self.runq_complete = set() |
@@ -1759,10 +1763,17 @@ class RunQueueExecute: | |||
1759 | self.build_stamps2.remove(self.build_stamps[task]) | 1763 | self.build_stamps2.remove(self.build_stamps[task]) |
1760 | del self.build_stamps[task] | 1764 | del self.build_stamps[task] |
1761 | 1765 | ||
1762 | if status != 0: | 1766 | if task in self.sq_live: |
1763 | self.task_fail(task, status) | 1767 | if status != 0: |
1768 | self.sq_task_fail(task, status) | ||
1769 | else: | ||
1770 | self.sq_task_complete(task) | ||
1771 | self.sq_live.remove(task) | ||
1764 | else: | 1772 | else: |
1765 | self.task_complete(task) | 1773 | if status != 0: |
1774 | self.task_fail(task, status) | ||
1775 | else: | ||
1776 | self.task_complete(task) | ||
1766 | return True | 1777 | return True |
1767 | 1778 | ||
1768 | def finish_now(self): | 1779 | def finish_now(self): |
@@ -2272,7 +2283,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): | |||
2272 | 2283 | ||
2273 | for tid in sqdata.sq_revdeps: | 2284 | for tid in sqdata.sq_revdeps: |
2274 | if len(sqdata.sq_revdeps[tid]) == 0: | 2285 | if len(sqdata.sq_revdeps[tid]) == 0: |
2275 | sqrq.runq_buildable.add(tid) | 2286 | sqrq.sq_buildable.add(tid) |
2276 | 2287 | ||
2277 | rqdata.init_progress_reporter.finish() | 2288 | rqdata.init_progress_reporter.finish() |
2278 | 2289 | ||
@@ -2292,20 +2303,20 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): | |||
2292 | 2303 | ||
2293 | if 'noexec' in taskdep and taskname in taskdep['noexec']: | 2304 | if 'noexec' in taskdep and taskname in taskdep['noexec']: |
2294 | noexec.append(tid) | 2305 | noexec.append(tid) |
2295 | sqrq.task_skip(tid) | 2306 | sqrq.sq_task_skip(tid) |
2296 | bb.build.make_stamp(taskname + "_setscene", rqdata.dataCaches[mc], taskfn) | 2307 | bb.build.make_stamp(taskname + "_setscene", rqdata.dataCaches[mc], taskfn) |
2297 | continue | 2308 | continue |
2298 | 2309 | ||
2299 | if rq.check_stamp_task(tid, taskname + "_setscene", cache=stampcache): | 2310 | if rq.check_stamp_task(tid, taskname + "_setscene", cache=stampcache): |
2300 | logger.debug(2, 'Setscene stamp current for task %s', tid) | 2311 | logger.debug(2, 'Setscene stamp current for task %s', tid) |
2301 | stamppresent.append(tid) | 2312 | stamppresent.append(tid) |
2302 | sqrq.task_skip(tid) | 2313 | sqrq.sq_task_skip(tid) |
2303 | continue | 2314 | continue |
2304 | 2315 | ||
2305 | if rq.check_stamp_task(tid, taskname, recurse = True, cache=stampcache): | 2316 | if rq.check_stamp_task(tid, taskname, recurse = True, cache=stampcache): |
2306 | logger.debug(2, 'Normal stamp current for task %s', tid) | 2317 | logger.debug(2, 'Normal stamp current for task %s', tid) |
2307 | stamppresent.append(tid) | 2318 | stamppresent.append(tid) |
2308 | sqrq.task_skip(tid) | 2319 | sqrq.sq_task_skip(tid) |
2309 | continue | 2320 | continue |
2310 | 2321 | ||
2311 | sq_fn.append(fn) | 2322 | sq_fn.append(fn) |
@@ -2367,9 +2378,9 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2367 | continue | 2378 | continue |
2368 | self.sqdata.sq_revdeps2[dep].remove(task) | 2379 | self.sqdata.sq_revdeps2[dep].remove(task) |
2369 | if len(self.sqdata.sq_revdeps2[dep]) == 0: | 2380 | if len(self.sqdata.sq_revdeps2[dep]) == 0: |
2370 | self.runq_buildable.add(dep) | 2381 | self.sq_buildable.add(dep) |
2371 | 2382 | ||
2372 | def task_completeoutright(self, task): | 2383 | def sq_task_completeoutright(self, task): |
2373 | """ | 2384 | """ |
2374 | Mark a task as completed | 2385 | Mark a task as completed |
2375 | Look at the reverse dependencies and mark any task with | 2386 | Look at the reverse dependencies and mark any task with |
@@ -2380,7 +2391,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2380 | self.scenequeue_covered.add(task) | 2391 | self.scenequeue_covered.add(task) |
2381 | self.scenequeue_updatecounters(task) | 2392 | self.scenequeue_updatecounters(task) |
2382 | 2393 | ||
2383 | def check_taskfail(self, task): | 2394 | def sq_check_taskfail(self, task): |
2384 | if self.rqdata.setscenewhitelist is not None: | 2395 | if self.rqdata.setscenewhitelist is not None: |
2385 | realtask = task.split('_setscene')[0] | 2396 | realtask = task.split('_setscene')[0] |
2386 | (mc, fn, taskname, taskfn) = split_tid_mcfn(realtask) | 2397 | (mc, fn, taskname, taskfn) = split_tid_mcfn(realtask) |
@@ -2389,34 +2400,34 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2389 | logger.error('Task %s.%s failed' % (pn, taskname + "_setscene")) | 2400 | logger.error('Task %s.%s failed' % (pn, taskname + "_setscene")) |
2390 | self.rq.state = runQueueCleanUp | 2401 | self.rq.state = runQueueCleanUp |
2391 | 2402 | ||
2392 | def task_complete(self, task): | 2403 | def sq_task_complete(self, task): |
2393 | self.stats.taskCompleted() | 2404 | self.stats.taskCompleted() |
2394 | bb.event.fire(sceneQueueTaskCompleted(task, self.stats, self.rq), self.cfgData) | 2405 | bb.event.fire(sceneQueueTaskCompleted(task, self.stats, self.rq), self.cfgData) |
2395 | self.task_completeoutright(task) | 2406 | self.sq_task_completeoutright(task) |
2396 | 2407 | ||
2397 | def task_fail(self, task, result): | 2408 | def sq_task_fail(self, task, result): |
2398 | self.stats.taskFailed() | 2409 | self.stats.taskFailed() |
2399 | bb.event.fire(sceneQueueTaskFailed(task, self.stats, result, self), self.cfgData) | 2410 | bb.event.fire(sceneQueueTaskFailed(task, self.stats, result, self), self.cfgData) |
2400 | self.scenequeue_notcovered.add(task) | 2411 | self.scenequeue_notcovered.add(task) |
2401 | self.scenequeue_updatecounters(task, True) | 2412 | self.scenequeue_updatecounters(task, True) |
2402 | self.check_taskfail(task) | 2413 | self.sq_check_taskfail(task) |
2403 | 2414 | ||
2404 | def task_failoutright(self, task): | 2415 | def sq_task_failoutright(self, task): |
2405 | self.runq_running.add(task) | 2416 | self.sq_running.add(task) |
2406 | self.runq_buildable.add(task) | 2417 | self.sq_buildable.add(task) |
2407 | self.stats.taskSkipped() | 2418 | self.stats.taskSkipped() |
2408 | self.stats.taskCompleted() | 2419 | self.stats.taskCompleted() |
2409 | self.scenequeue_notcovered.add(task) | 2420 | self.scenequeue_notcovered.add(task) |
2410 | self.scenequeue_updatecounters(task, True) | 2421 | self.scenequeue_updatecounters(task, True) |
2411 | 2422 | ||
2412 | def task_skip(self, task): | 2423 | def sq_task_skip(self, task): |
2413 | self.runq_running.add(task) | 2424 | self.sq_running.add(task) |
2414 | self.runq_buildable.add(task) | 2425 | self.sq_buildable.add(task) |
2415 | self.task_completeoutright(task) | 2426 | self.sq_task_completeoutright(task) |
2416 | self.stats.taskSkipped() | 2427 | self.stats.taskSkipped() |
2417 | self.stats.taskCompleted() | 2428 | self.stats.taskCompleted() |
2418 | 2429 | ||
2419 | def execute(self): | 2430 | def sq_execute(self): |
2420 | """ | 2431 | """ |
2421 | Run the tasks in a queue prepared by prepare_runqueue | 2432 | Run the tasks in a queue prepared by prepare_runqueue |
2422 | """ | 2433 | """ |
@@ -2427,7 +2438,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2427 | if self.can_start_task(): | 2438 | if self.can_start_task(): |
2428 | # Find the next setscene to run | 2439 | # Find the next setscene to run |
2429 | for nexttask in self.rqdata.runq_setscene_tids: | 2440 | for nexttask in self.rqdata.runq_setscene_tids: |
2430 | if nexttask in self.runq_buildable and nexttask not in self.runq_running and self.sqdata.stamps[nexttask] not in self.build_stamps.values(): | 2441 | if nexttask in self.sq_buildable and nexttask not in self.sq_running and self.sqdata.stamps[nexttask] not in self.build_stamps.values(): |
2431 | if nexttask in self.sqdata.unskippable: | 2442 | if nexttask in self.sqdata.unskippable: |
2432 | logger.debug(2, "Setscene task %s is unskippable" % nexttask) | 2443 | logger.debug(2, "Setscene task %s is unskippable" % nexttask) |
2433 | if nexttask not in self.sqdata.unskippable and len(self.sqdata.sq_revdeps[nexttask]) > 0 and self.sqdata.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and self.check_dependencies(nexttask, self.sqdata.sq_revdeps[nexttask]): | 2444 | if nexttask not in self.sqdata.unskippable and len(self.sqdata.sq_revdeps[nexttask]) > 0 and self.sqdata.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and self.check_dependencies(nexttask, self.sqdata.sq_revdeps[nexttask]): |
@@ -2438,11 +2449,11 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2438 | foundtarget = True | 2449 | foundtarget = True |
2439 | if not foundtarget: | 2450 | if not foundtarget: |
2440 | logger.debug(2, "Skipping setscene for task %s" % nexttask) | 2451 | logger.debug(2, "Skipping setscene for task %s" % nexttask) |
2441 | self.task_skip(nexttask) | 2452 | self.sq_task_skip(nexttask) |
2442 | self.scenequeue_notneeded.add(nexttask) | 2453 | self.scenequeue_notneeded.add(nexttask) |
2443 | return True | 2454 | return True |
2444 | if nexttask in self.sqdata.outrightfail: | 2455 | if nexttask in self.sqdata.outrightfail: |
2445 | self.task_failoutright(nexttask) | 2456 | self.sq_task_failoutright(nexttask) |
2446 | return True | 2457 | return True |
2447 | task = nexttask | 2458 | task = nexttask |
2448 | break | 2459 | break |
@@ -2451,28 +2462,28 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2451 | taskname = taskname + "_setscene" | 2462 | taskname = taskname + "_setscene" |
2452 | if self.rq.check_stamp_task(task, taskname_from_tid(task), recurse = True, cache=self.stampcache): | 2463 | if self.rq.check_stamp_task(task, taskname_from_tid(task), recurse = True, cache=self.stampcache): |
2453 | logger.debug(2, 'Stamp for underlying task %s is current, so skipping setscene variant', task) | 2464 | logger.debug(2, 'Stamp for underlying task %s is current, so skipping setscene variant', task) |
2454 | self.task_failoutright(task) | 2465 | self.sq_task_failoutright(task) |
2455 | return True | 2466 | return True |
2456 | 2467 | ||
2457 | if self.cooker.configuration.force: | 2468 | if self.cooker.configuration.force: |
2458 | if task in self.rqdata.target_tids: | 2469 | if task in self.rqdata.target_tids: |
2459 | self.task_failoutright(task) | 2470 | self.sq_task_failoutright(task) |
2460 | return True | 2471 | return True |
2461 | 2472 | ||
2462 | if self.rq.check_stamp_task(task, taskname, cache=self.stampcache): | 2473 | if self.rq.check_stamp_task(task, taskname, cache=self.stampcache): |
2463 | logger.debug(2, 'Setscene stamp current task %s, so skip it and its dependencies', task) | 2474 | logger.debug(2, 'Setscene stamp current task %s, so skip it and its dependencies', task) |
2464 | self.task_skip(task) | 2475 | self.sq_task_skip(task) |
2465 | return True | 2476 | return True |
2466 | 2477 | ||
2467 | if self.cooker.configuration.skipsetscene: | 2478 | if self.cooker.configuration.skipsetscene: |
2468 | logger.debug(2, 'No setscene tasks should be executed. Skipping %s', task) | 2479 | logger.debug(2, 'No setscene tasks should be executed. Skipping %s', task) |
2469 | self.task_failoutright(task) | 2480 | self.sq_task_failoutright(task) |
2470 | return True | 2481 | return True |
2471 | 2482 | ||
2472 | startevent = sceneQueueTaskStarted(task, self.stats, self.rq) | 2483 | startevent = sceneQueueTaskStarted(task, self.stats, self.rq) |
2473 | bb.event.fire(startevent, self.cfgData) | 2484 | bb.event.fire(startevent, self.cfgData) |
2474 | 2485 | ||
2475 | taskdepdata = self.build_taskdepdata(task) | 2486 | taskdepdata = self.sq_build_taskdepdata(task) |
2476 | 2487 | ||
2477 | taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] | 2488 | taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] |
2478 | taskhash = self.rqdata.get_task_hash(task) | 2489 | taskhash = self.rqdata.get_task_hash(task) |
@@ -2488,7 +2499,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2488 | 2499 | ||
2489 | self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) | 2500 | self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) |
2490 | self.build_stamps2.append(self.build_stamps[task]) | 2501 | self.build_stamps2.append(self.build_stamps[task]) |
2491 | self.runq_running.add(task) | 2502 | self.sq_running.add(task) |
2503 | self.sq_live.add(task) | ||
2492 | self.stats.taskActive() | 2504 | self.stats.taskActive() |
2493 | if self.can_start_task(): | 2505 | if self.can_start_task(): |
2494 | return True | 2506 | return True |
@@ -2498,8 +2510,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2498 | return self.rq.active_fds() | 2510 | return self.rq.active_fds() |
2499 | 2511 | ||
2500 | #for tid in self.sqdata.sq_revdeps: | 2512 | #for tid in self.sqdata.sq_revdeps: |
2501 | # if tid not in self.runq_running: | 2513 | # if tid not in self.sq_running: |
2502 | # buildable = tid in self.runq_buildable | 2514 | # buildable = tid in self.sq_buildable |
2503 | # revdeps = self.sqdata.sq_revdeps[tid] | 2515 | # revdeps = self.sqdata.sq_revdeps[tid] |
2504 | # bb.warn("Found we didn't run %s %s %s" % (tid, buildable, str(revdeps))) | 2516 | # bb.warn("Found we didn't run %s %s %s" % (tid, buildable, str(revdeps))) |
2505 | 2517 | ||
@@ -2515,11 +2527,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
2515 | 2527 | ||
2516 | return True | 2528 | return True |
2517 | 2529 | ||
2518 | def runqueue_process_waitpid(self, task, status): | 2530 | def sq_build_taskdepdata(self, task): |
2519 | RunQueueExecute.runqueue_process_waitpid(self, task, status) | ||
2520 | |||
2521 | |||
2522 | def build_taskdepdata(self, task): | ||
2523 | def getsetscenedeps(tid): | 2531 | def getsetscenedeps(tid): |
2524 | deps = set() | 2532 | deps = set() |
2525 | (mc, fn, taskname, _) = split_tid_mcfn(tid) | 2533 | (mc, fn, taskname, _) = split_tid_mcfn(tid) |