[bitbake-devel] [PATCH 2/4] runqueue.py: monitor disk space at regular time intervals

Patrick Ohly patrick.ohly at intel.com
Mon Nov 28 15:15:11 UTC 2016


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.

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
 lib/bb/runqueue.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 84b2685..3772e2e 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -984,7 +984,12 @@ class RunQueue:
         self.state = runQueuePrepare
 
         # For disk space monitor
+        # Invoked at regular time intervals via the bitbake heartbeat event
+        # while the build is running.
         self.dm = monitordisk.diskMonitor(cfgData)
+        bb.event.register('_bb_diskmonitor',
+                          lambda x: self.dm.check(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp] else False,
+                          ('bb.event.HeartbeatEvent',))
 
         self.rqexe = None
         self.worker = {}
@@ -1208,9 +1213,6 @@ class RunQueue:
                 self.rqdata.init_progress_reporter.next_stage()
                 self.rqexe = RunQueueExecuteScenequeue(self)
 
-        if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]:
-            self.dm.check(self)
-
         if self.state is runQueueSceneRun:
             retval = self.rqexe.execute()
 
-- 
2.1.4




More information about the bitbake-devel mailing list