Skip to contentSkip to conversation

V3: hob check disk size

PATCH In review Kang Kai 2 participants 5 messages Jul 27, 2012 – Aug 2, 2012

lore
Share & tools
lore

Kang Kai

author
#0 lore raw

cover V3: hob check disk size

Hi Richard,

In V3 I fire the event DiskFull in diskMonitor.check() as your commented.

Thanks,
Kai

The following changes since commit 0ffb02eec2beaea27ff0ec9d3d31b0a09e675a4c:

documentation: Updated the h6 style to use a larger font (2012-07-24 10:35:34 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/hob-check-size
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/hob-check-size

Kang Kai (2):
monitordisk: fire event DISKFULL when terminate build
hob: deal event DiskFull

 bitbake/lib/bb/event.py                  |    8 ++++++++
 bitbake/lib/bb/monitordisk.py            |    5 +++++
 bitbake/lib/bb/ui/crumbs/builder.py      |    4 ++++
 bitbake/lib/bb/ui/crumbs/runningbuild.py |   11 ++++++++++-
 4 files changed, 27 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 1/2 monitordisk: fire event DISKFULL when terminate build

Part of [Yocto #2168]

Add a event DiskFull to descript the termination by disk monitor.

Update check() to fire the event DiskFull when terminates the build. This could help UIs to deal this scenario and show more information to end user.

---
 bitbake/lib/bb/event.py       |    8 ++++++++
 bitbake/lib/bb/monitordisk.py |    5 +++++
 2 files changed, 13 insertions(+), 0 deletions(-)
bitbake/lib/bb/event.py +8 -0
index 1116c0a..20923b5 100644
@@ -312,6 +312,14 @@ class BuildCompleted(BuildBase, OperationCompleted):
             OperationCompleted.__init__(self, total, "Building Failed")
         BuildBase.__init__(self, n, p, failures)
 
+class DiskFull(Event):
+    """Disk full case build aborted"""
+    def __init__(self, dev, type, freespace, mountpoint):
+        Event.__init__(self)
+        self._dev = dev
+        self._type = type
+        self._free = freespace
+        self._mountpoint = mountpoint
 
 class NoProvider(Event):
     """No Provider for an Event"""
bitbake/lib/bb/monitordisk.py +5 -0
index 9469193..2bd4881 100644
@@ -176,6 +176,7 @@ class diskMonitor:
     def __init__(self, configuration):
 
         self.enableMonitor = False
+        self.configuration = configuration
 
         BBDirs = configuration.getVar("BB_DISKMON_DIRS", True) or None
         if BBDirs:
@@ -219,10 +220,12 @@ class diskMonitor:
                         logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(False)
+                        bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, self.devDict[dev][1]), self.configuration)
                     elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]:
                         logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(True)
+                        bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, self.devDict[dev][1]), self.configuration)
 
                 # The free inodes, float point number
                 freeInode = st.f_favail
@@ -237,8 +240,10 @@ class diskMonitor:
                         logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(False)
+                        bb.event.fire(bb.event.DiskFull(dev, 'inode', freeSpace, self.devDict[dev][1]), self.configuration)
                     elif self.devDict[dev][0]  == "ABORT" and not self.checked[dev]:
                         logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(True)
+                        bb.event.fire(bb.event.DiskFull(dev, 'inode', freeSpace, self.devDict[dev][1]), self.configuration)
         return
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/2 hob: deal event DiskFull

In reply to Kang Kai

Part of [Yocto #2168]

When bitbake runqueue is teminated by disk monitor, it will send event DiskFull. Update to handle it.

---
 bitbake/lib/bb/ui/crumbs/builder.py      |    4 ++++
 bitbake/lib/bb/ui/crumbs/runningbuild.py |   11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +4 -0
index 123608e..c2e7068 100755
@@ -430,6 +430,7 @@ class Builder(gtk.Window):
         self.handler.build.connect("build-started",      self.handler_build_started_cb)
         self.handler.build.connect("build-succeeded",    self.handler_build_succeeded_cb)
         self.handler.build.connect("build-failed",       self.handler_build_failed_cb)
+        self.handler.build.connect("build-aborted",      self.handler_build_aborted_cb)
         self.handler.build.connect("task-started",       self.handler_task_started_cb)
         self.handler.build.connect("log-error",          self.handler_build_failure_cb)
         self.handler.build.connect("no-provider",        self.handler_no_provider_cb)
@@ -920,6 +921,9 @@ class Builder(gtk.Window):
     def handler_build_failed_cb(self, running_build):
         self.build_failed()
 
+    def handler_build_aborted_cb(self, running_build):
+        self.build_failed()
+
     def handler_no_provider_cb(self, running_build, msg):
         dialog = CrumbsMessageDialog(self, Builder.interpret_markup(msg), gtk.STOCK_DIALOG_INFO)
         button = dialog.add_button("Close", gtk.RESPONSE_OK)
bitbake/lib/bb/ui/crumbs/runningbuild.py +10 -1
index 8cf36ee..0347058 100644
@@ -76,6 +76,9 @@ class RunningBuild (gobject.GObject):
           'build-complete'  :  (gobject.SIGNAL_RUN_LAST,
                                 gobject.TYPE_NONE,
                                ()),
+          'build-aborted'     :  (gobject.SIGNAL_RUN_LAST,
+                                gobject.TYPE_NONE,
+                               ()),
           'task-started'    :  (gobject.SIGNAL_RUN_LAST,
                                 gobject.TYPE_NONE,
                                (gobject.TYPE_PYOBJECT,)),
@@ -93,6 +96,7 @@ class RunningBuild (gobject.GObject):
         gobject.GObject.__init__ (self)
         self.model = RunningBuildModel()
         self.sequential = sequential
+        self.buildaborted = False
 
     def reset (self):
         self.pids_to_task.clear()
@@ -274,7 +278,9 @@ class RunningBuild (gobject.GObject):
                                       0))
 
             # Emit the appropriate signal depending on the number of failures
-            if (failures >= 1):
+            if self.buildaborted:
+                self.emit ("build-aborted")
+            elif (failures >= 1):
                 self.emit ("build-failed")
             else:
                 self.emit ("build-succeeded")
@@ -286,6 +292,9 @@ class RunningBuild (gobject.GObject):
             if pbar:
                 pbar.set_text(event.msg)
 
+        elif isinstance(event, bb.event.DiskFull):
+            self.buildaborted = True
+
         elif isinstance(event, bb.command.CommandFailed):
             if event.error.startswith("Exited with"):
                 # If the command fails with an exit code we're done, emit the
Signature · 1 line
1.7.5.4
author
#3 lore raw
In reply to Kang Kai
Quoted 3 lines · Kang Kai

Hi Richard,

In V3 I fire the event DiskFull in diskMonitor.check() as your commented.

Hi Richard,

Would you like to help me to review these patches? Thanks,

Kai

Quoted 21 lines

Thanks,
Kai

The following changes since commit 0ffb02eec2beaea27ff0ec9d3d31b0a09e675a4c:

documentation: Updated the h6 style to use a larger font (2012-07-24 10:35:34 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/hob-check-size
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/hob-check-size

Kang Kai (2):
monitordisk: fire event DISKFULL when terminate build
hob: deal event DiskFull

  bitbake/lib/bb/event.py                  |    8 ++++++++
  bitbake/lib/bb/monitordisk.py            |    5 +++++
  bitbake/lib/bb/ui/crumbs/builder.py      |    4 ++++
  bitbake/lib/bb/ui/crumbs/runningbuild.py |   11 ++++++++++-
  4 files changed, 27 insertions(+), 1 deletions(-)
#4 lore raw
In reply to Kang Kai
Quoted 11 lines · Kang Kai

Hi Richard,

In V3 I fire the event DiskFull in diskMonitor.check() as your commented.

Thanks,
Kai

The following changes since commit 0ffb02eec2beaea27ff0ec9d3d31b0a09e675a4c:

documentation: Updated the h6 style to use a larger font (2012-07-24 10:35:34 +0100)

Quoted 7 lines

are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/hob-check-size
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/hob-check-size

Kang Kai (2):
monitordisk: fire event DISKFULL when terminate build
hob: deal event DiskFull

Looks much cleaner, thanks for the changes. Merged to master, thanks.

Richard