diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2016-11-29 17:47:43 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-07 10:42:22 +0000 |
commit | ad20ee9febb6bb9beca084b72e21aaddda24bcb9 (patch) | |
tree | 0ecae3022431599e50458982bfd4c739a36777d1 /bitbake/lib/bb/runqueue.py | |
parent | 083365143e844827599d9b0a78204b3a05df460c (diff) | |
download | poky-ad20ee9febb6bb9beca084b72e21aaddda24bcb9.tar.gz |
bitbake: runqueue.py: monitor disk space at regular time intervals
Hooking the disk monitor into the regular heatbeat event instead
of the runqueue solves two problems:
- When there is just one long running task which fills up the disk,
the previous approach did not notice that until after the completion
of the task because _execute_runqueue() only gets called on task
state changes. As a result, aborting a build did not work in this
case.
- When there are many short-lived tasks, disk space was getting
checked very frequently. When the storage that is getting checked
is on an NFS server, that can lead to noticable traffic to the
server.
(Bitbake rev: 4547eea26803a9cd355d8b045197bcbdbb36a9ad)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
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 | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 51d68a5cf8..3d8ae1f48b 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -984,8 +984,14 @@ class RunQueue: | |||
984 | self.state = runQueuePrepare | 984 | self.state = runQueuePrepare |
985 | 985 | ||
986 | # For disk space monitor | 986 | # For disk space monitor |
987 | # Invoked at regular time intervals via the bitbake heartbeat event | ||
988 | # while the build is running. We generate a unique name for the handler | ||
989 | # here, just in case that there ever is more than one RunQueue instance, | ||
990 | # start the handler when reaching runQueueSceneRun, and stop it when | ||
991 | # done with the build. | ||
987 | self.dm = monitordisk.diskMonitor(cfgData) | 992 | self.dm = monitordisk.diskMonitor(cfgData) |
988 | 993 | self.dm_event_handler_name = '_bb_diskmonitor_' + str(id(self)) | |
994 | self.dm_event_handler_registered = False | ||
989 | self.rqexe = None | 995 | self.rqexe = None |
990 | self.worker = {} | 996 | self.worker = {} |
991 | self.fakeworker = {} | 997 | self.fakeworker = {} |
@@ -1208,10 +1214,12 @@ class RunQueue: | |||
1208 | self.rqdata.init_progress_reporter.next_stage() | 1214 | self.rqdata.init_progress_reporter.next_stage() |
1209 | self.rqexe = RunQueueExecuteScenequeue(self) | 1215 | self.rqexe = RunQueueExecuteScenequeue(self) |
1210 | 1216 | ||
1211 | if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]: | ||
1212 | self.dm.check(self) | ||
1213 | |||
1214 | if self.state is runQueueSceneRun: | 1217 | if self.state is runQueueSceneRun: |
1218 | if not self.dm_event_handler_registered: | ||
1219 | res = bb.event.register(self.dm_event_handler_name, | ||
1220 | lambda x: self.dm.check(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp] else False, | ||
1221 | ('bb.event.HeartbeatEvent',)) | ||
1222 | self.dm_event_handler_registered = True | ||
1215 | retval = self.rqexe.execute() | 1223 | retval = self.rqexe.execute() |
1216 | 1224 | ||
1217 | if self.state is runQueueRunInit: | 1225 | if self.state is runQueueRunInit: |
@@ -1230,7 +1238,13 @@ class RunQueue: | |||
1230 | if self.state is runQueueCleanUp: | 1238 | if self.state is runQueueCleanUp: |
1231 | retval = self.rqexe.finish() | 1239 | retval = self.rqexe.finish() |
1232 | 1240 | ||
1233 | if (self.state is runQueueComplete or self.state is runQueueFailed) and self.rqexe: | 1241 | build_done = self.state is runQueueComplete or self.state is runQueueFailed |
1242 | |||
1243 | if build_done and self.dm_event_handler_registered: | ||
1244 | bb.event.remove(self.dm_event_handler_name, None) | ||
1245 | self.dm_event_handler_registered = False | ||
1246 | |||
1247 | if build_done and self.rqexe: | ||
1234 | self.teardown_workers() | 1248 | self.teardown_workers() |
1235 | if self.rqexe.stats.failed: | 1249 | if self.rqexe.stats.failed: |
1236 | 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) | 1250 | 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) |