V2: hob check disk size
cover V2: hob check disk size
Hi Richard,
This version 2 update to create a new event DiskFull to descript the termination by disk monitor. The event DiskFull records the information of which device, lack of disk or inode, free space left and mount point as you comment in previous letter.
Update hob to deal event DiskFull. Because the detail log could be seen in log tab, I didn't change the hob code too much.
Regards,
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 (3):
monitordisk: update check() to return a dict
cooker: send event when terminated by disk monitor
hob: deal event DiskFull
bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 8 ++++++++ bitbake/lib/bb/monitordisk.py | 25 +++++++++++++++++++++++-- bitbake/lib/bb/runqueue.py | 9 +++++---- bitbake/lib/bb/ui/crumbs/builder.py | 4 ++++ bitbake/lib/bb/ui/crumbs/runningbuild.py | 11 +++++++++++ 6 files changed, 63 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/3 monitordisk: update check() to return a dict
Update function check() to return a dict to provide information about disk monitor. This could help UIs to show more detail information to end user.
--- bitbake/lib/bb/monitordisk.py | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-)
bitbake/lib/bb/monitordisk.py +23 -2
@@ -176,6 +176,7 @@ class diskMonitor: def __init__(self, configuration): self.enableMonitor = False + self.data = {'terminate': False} BBDirs = configuration.getVar("BB_DISKMON_DIRS", True) or None if BBDirs:
@@ -200,7 +201,11 @@ class diskMonitor: def check(self, rq): - """ Take action for the monitor """ + """ + Take action for the monitor. + Return True to tell cooker that runqueue is terminated by disk monitor. + This return value is useful for UIs such as Hob. + """ if self.enableMonitor: for dev in self.devDict:
@@ -219,10 +224,14 @@ 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) + self.setData(dev, 'disk', freeSpace, self.devDict[dev][1]) + return self.data 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) + self.setData(dev, 'disk', freeSpace, self.devDict[dev][1]) + return self.data # The free inodes, float point number freeInode = st.f_favail
@@ -237,8 +246,20 @@ 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) + self.setData(dev, 'inode', freeSpace, self.devDict[dev][1]) + return self.data 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) - return + self.setData(dev, 'inode', freeSpace, self.devDict[dev][1]) + return self.data + return self.data + + def setData(self, dev, type, free, mountPoint): + """ Set the class member data """ + self.data['terminated'] = True + self.data['dev'] = dev + self.data['type'] = type + self.data['freespace'] = free + self.data['mountpoint'] = mountPoint
Signature · 1 line
1.7.5.4
PATCH 2/3 cooker: send event when terminated by disk monitor
In reply to Kang KaiPart of [Yocto #2168]
Add a event DiskFull to descript the termination by disk monitor.
According to the return info from function diskMonitor.check, runqueue pass it to cooker. The cooker check the info and send event DiskFull when runqueue terminated by disk monitor.
The UIs could get the infomation from the event DiskFull.
--- bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 8 ++++++++ bitbake/lib/bb/runqueue.py | 9 +++++---- 3 files changed, 25 insertions(+), 6 deletions(-)
bitbake/lib/bb/cooker.py +12 -2
@@ -1095,7 +1095,7 @@ class BBCooker: rq.finish_runqueue(False) failures = 0 try: - retval = rq.execute_runqueue() + retval, dmdata = rq.execute_runqueue() except runqueue.TaskFailure as exc: failures += len(exc.args) retval = False
@@ -1103,6 +1103,11 @@ class BBCooker: self.command.finishAsyncCommand() return False + if 'terminated' in dmdata and dmdata['terminated']: + bb.event.fire(bb.event.DiskFull(dmdata['dev'], dmdata['type'], dmdata['freespace'], dmdata['mountpoint']), self.configuration.event_data) + self.command.finishAsyncCommand() + return False + if not retval: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures), self.configuration.event_data) self.command.finishAsyncCommand()
@@ -1135,7 +1140,7 @@ class BBCooker: rq.finish_runqueue(False) failures = 0 try: - retval = rq.execute_runqueue() + retval, dmdata = rq.execute_runqueue() except runqueue.TaskFailure as exc: failures += len(exc.args) retval = False
@@ -1143,6 +1148,11 @@ class BBCooker: self.command.finishAsyncCommand() return False + if 'terminated' in dmdata and dmdata['terminated']: + bb.event.fire(bb.event.DiskFull(dmdata['dev'], dmdata['type'], dmdata['freespace'], dmdata['mountpoint']), self.configuration.event_data) + self.command.finishAsyncCommand() + return False + if not retval: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures), self.configuration.data) self.command.finishAsyncCommand()
bitbake/lib/bb/event.py +8 -0
@@ -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/runqueue.py +5 -4
@@ -867,6 +867,7 @@ class RunQueue: """ retval = 0.5 + dmdata = {} if self.state is runQueuePrepare: self.rqexe = RunQueueExecuteDummy(self)
@@ -882,7 +883,7 @@ class RunQueue: self.rqexe = RunQueueExecuteScenequeue(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]: - self.dm.check(self) + dmdata = self.dm.check(self) if self.state is runQueueSceneRun: retval = self.rqexe.execute()
@@ -914,14 +915,14 @@ class RunQueue: if self.state is runQueueComplete: # All done - return False + return False, dmdata if self.state is runQueueChildProcess: print("Child process, eeek, shouldn't happen!") - return False + return False, dmdata # Loop - return retval + return retval, dmdata def finish_runqueue(self, now = False): if not self.rqexe:
Signature · 1 line
1.7.5.4
Re: [PATCH 2/3] cooker: send event when terminated by disk monitor
Quoted 8 lines · Kang Kai
Part of [Yocto #2168]
Add a event DiskFull to descript the termination by disk monitor.
According to the return info from function diskMonitor.check, runqueue pass it to cooker. The cooker check the info and send event DiskFull when runqueue terminated by disk monitor.
Quoted 8 lines
The UIs could get the infomation from the event DiskFull.
Signed-off-by Kang Kai <[email protected]>--- bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 8 ++++++++ bitbake/lib/bb/runqueue.py | 9 +++++---- 3 files changed, 25 insertions(+), 6 deletions(-)
This is good and heading the right way but why can't self.dm.check fire the event itself? This appears to unnecessarily complicate code...
Cheers,
Richard
Quoted 104 lines
bitbake/lib/bb/cooker.py +12
-2@@ -1095,7 +1095,7 @@ class BBCooker: rq.finish_runqueue(False) failures = 0 try: - retval = rq.execute_runqueue() + retval, dmdata = rq.execute_runqueue() except runqueue.TaskFailure as exc: failures += len(exc.args) retval = False@@ -1103,6 +1103,11 @@ class BBCooker: self.command.finishAsyncCommand() return False + if 'terminated' in dmdata and dmdata['terminated']: + bb.event.fire(bb.event.DiskFull(dmdata['dev'], dmdata['type'], dmdata['freespace'], dmdata['mountpoint']), self.configuration.event_data) + self.command.finishAsyncCommand() + return False + if not retval: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures), self.configuration.event_data) self.command.finishAsyncCommand()@@ -1135,7 +1140,7 @@ class BBCooker: rq.finish_runqueue(False) failures = 0 try: - retval = rq.execute_runqueue() + retval, dmdata = rq.execute_runqueue() except runqueue.TaskFailure as exc: failures += len(exc.args) retval = False@@ -1143,6 +1148,11 @@ class BBCooker: self.command.finishAsyncCommand() return False + if 'terminated' in dmdata and dmdata['terminated']: + bb.event.fire(bb.event.DiskFull(dmdata['dev'], dmdata['type'], dmdata['freespace'], dmdata['mountpoint']), self.configuration.event_data) + self.command.finishAsyncCommand() + return False + if not retval: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures), self.configuration.data) self.command.finishAsyncCommand()bitbake/lib/bb/event.py +8
-0@@ -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/runqueue.py +5
-4@@ -867,6 +867,7 @@ class RunQueue: """ retval = 0.5 + dmdata = {} if self.state is runQueuePrepare: self.rqexe = RunQueueExecuteDummy(self)@@ -882,7 +883,7 @@ class RunQueue: self.rqexe = RunQueueExecuteScenequeue(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]: - self.dm.check(self) + dmdata = self.dm.check(self) if self.state is runQueueSceneRun: retval = self.rqexe.execute()@@ -914,14 +915,14 @@ class RunQueue: if self.state is runQueueComplete: # All done - return False + return False, dmdata if self.state is runQueueChildProcess: print("Child process, eeek, shouldn't happen!") - return False + return False, dmdata # Loop - return retval + return retval, dmdata def finish_runqueue(self, now = False): if not self.rqexe:
Re: [PATCH 2/3] cooker: send event when terminated by disk monitor
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Kang Kai
Part of [Yocto #2168]
Add a event DiskFull to descript the termination by disk monitor.
According to the return info from function diskMonitor.check, runqueue pass it to cooker. The cooker check the info and send event DiskFull when runqueue terminated by disk monitor.
Quoted 8 lines
Quoted 8 lines
The UIs could get the infomation from the event DiskFull.
Signed-off-by Kang Kai<[email protected]>--- bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 8 ++++++++ bitbake/lib/bb/runqueue.py | 9 +++++---- 3 files changed, 25 insertions(+), 6 deletions(-)
Hi Richard,
Quoted 2 lines
This is good and heading the right way but why can't self.dm.check fire the event itself? This appears to unnecessarily complicate code...
Thank you.
I have send the Version 3.
Regards,
Kai
Quoted 111 lines
Cheers,
Richard
Quoted 104 lines
bitbake/lib/bb/cooker.py +12
-2@@ -1095,7 +1095,7 @@ class BBCooker: rq.finish_runqueue(False) failures = 0 try: - retval = rq.execute_runqueue() + retval, dmdata = rq.execute_runqueue() except runqueue.TaskFailure as exc: failures += len(exc.args) retval = False@@ -1103,6 +1103,11 @@ class BBCooker: self.command.finishAsyncCommand() return False + if 'terminated' in dmdata and dmdata['terminated']: + bb.event.fire(bb.event.DiskFull(dmdata['dev'], dmdata['type'], dmdata['freespace'], dmdata['mountpoint']), self.configuration.event_data) + self.command.finishAsyncCommand() + return False + if not retval: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures), self.configuration.event_data) self.command.finishAsyncCommand()@@ -1135,7 +1140,7 @@ class BBCooker: rq.finish_runqueue(False) failures = 0 try: - retval = rq.execute_runqueue() + retval, dmdata = rq.execute_runqueue() except runqueue.TaskFailure as exc: failures += len(exc.args) retval = False@@ -1143,6 +1148,11 @@ class BBCooker: self.command.finishAsyncCommand() return False + if 'terminated' in dmdata and dmdata['terminated']: + bb.event.fire(bb.event.DiskFull(dmdata['dev'], dmdata['type'], dmdata['freespace'], dmdata['mountpoint']), self.configuration.event_data) + self.command.finishAsyncCommand() + return False + if not retval: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures), self.configuration.data) self.command.finishAsyncCommand()bitbake/lib/bb/event.py +8
-0@@ -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/runqueue.py +5
-4@@ -867,6 +867,7 @@ class RunQueue: """ retval = 0.5 + dmdata = {} if self.state is runQueuePrepare: self.rqexe = RunQueueExecuteDummy(self)@@ -882,7 +883,7 @@ class RunQueue: self.rqexe = RunQueueExecuteScenequeue(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]: - self.dm.check(self) + dmdata = self.dm.check(self) if self.state is runQueueSceneRun: retval = self.rqexe.execute()@@ -914,14 +915,14 @@ class RunQueue: if self.state is runQueueComplete: # All done - return False + return False, dmdata if self.state is runQueueChildProcess: print("Child process, eeek, shouldn't happen!") - return False + return False, dmdata # Loop - return retval + return retval, dmdata def finish_runqueue(self, now = False): if not self.rqexe:
PATCH 3/3 hob: deal event DiskFull
In reply to Kang KaiWhen 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, 15 insertions(+), 0 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +4 -0
@@ -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 +11 -0
@@ -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,)),
@@ -286,6 +289,14 @@ class RunningBuild (gobject.GObject): if pbar: pbar.set_text(event.msg) + elif isinstance(event, bb.event.DiskFull): + self.emit("build-aborted") + self.emit("build-complete") + self.model.close_task_refresh() + print(pbar) + if pbar: + pbar.set_text(event.msg) + 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