treat runqueue terminated by disk monitor as failure
cover treat runqueue terminated by disk monitor as failure
Hi Richard,
These 2 patches are for Yocto 2168. BB_DISKMON_DIRS and BB_DISKMON_WARNINTERVAL should be set in local.conf to enable disk monitor to test the patches.
Regards,
Kai
The following changes since commit 315d52934693b14f08b62f3f5f361d834484e180:
Pyphon-native: Fix typo (2012-07-22 14:20:57 +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: update return value
cooker: treat termination by disk monitor as failure
bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 5 +++-- bitbake/lib/bb/monitordisk.py | 12 ++++++++++-- bitbake/lib/bb/runqueue.py | 9 +++++---- 4 files changed, 30 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/2 monitordisk: update return value
update function check()'s return value of class diskMonitor. When runqueue is terminated by disk monitor, cooker has a chance to deal this situation accordingly.
--- bitbake/lib/bb/monitordisk.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
bitbake/lib/bb/monitordisk.py +10 -2
@@ -200,7 +200,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 +223,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) + return True 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 True # The free inodes, float point number freeInode = st.f_favail
@@ -237,8 +243,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) + return True 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 + return True + return False
Signature · 1 line
1.7.5.4
PATCH 2/2 cooker: treat termination by disk monitor as failure
In reply to Kang Kai[Yocto #2168]
Check the return value of function diskMonitor.check() in runqueue then pass it to cooker. The cooker treats that runqueue terminated by disk monitor as failure, then increase the build failure count if the return value is true.
The UIs could check the failure count accordingly, and this will helpful for UIs such as Hob.
--- bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 5 +++-- bitbake/lib/bb/runqueue.py | 9 +++++---- 3 files changed, 20 insertions(+), 8 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, termedbydm = 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 termedbydm: + bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures, bymonitor=True), 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, termedbydm = 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 termedbydm: + bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures, bymonitor=True), self.configuration.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 +3 -2
@@ -305,14 +305,15 @@ class BuildStarted(BuildBase, OperationStarted): class BuildCompleted(BuildBase, OperationCompleted): """bbmake build run completed""" - def __init__(self, total, n, p, failures = 0): + def __init__(self, total, n, p, failures = 0, bymonitor = False): + if bymonitor: + failures += 1 if not failures: OperationCompleted.__init__(self, total, "Building Succeeded") else: OperationCompleted.__init__(self, total, "Building Failed") BuildBase.__init__(self, n, p, failures) - class NoProvider(Event): """No Provider for an Event"""
bitbake/lib/bb/runqueue.py +5 -4
@@ -867,6 +867,7 @@ class RunQueue: """ retval = 0.5 + termedbydm = False 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) + termedbydm = 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, termedbydm if self.state is runQueueChildProcess: print("Child process, eeek, shouldn't happen!") - return False + return False, termedbydm # Loop - return retval + return retval, termedbydm def finish_runqueue(self, now = False): if not self.rqexe:
Signature · 1 line
1.7.5.4
Re: [PATCH 2/2] cooker: treat termination by disk monitor as failure
Quoted 10 lines · Kang Kai
[Yocto #2168]
Check the return value of function
diskMonitor.check()in runqueue then pass it to cooker. The cooker treats that runqueue terminated by disk monitor as failure, then increase the build failure count if the return value is true.The UIs could check the failure count accordingly, and this will helpful for UIs such as Hob.
Quoted 6 lines
Signed-off-by Kang Kai <[email protected]>--- bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 5 +++-- bitbake/lib/bb/runqueue.py | 9 +++++---- 3 files changed, 20 insertions(+), 8 deletions(-)
I have to say I don't really like this code. I agree that the UI needs to know about diskmonitor failures but I'm not sure about changing the BuiuldCompleted event in this way. I think we should add the exit status to the BuildCompleted event as an extra field (leaving the failures count alone as it means something specific right now).
The UI is going to want more information about what failed (which disk was full, how full was it, where is it mounted?). The best approach therefore could be a specific DiskFull event which gets fired and the UI can act upon containing much more information.
Cheers,
Richard
Quoted 107 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, termedbydm = 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 termedbydm: + bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures, bymonitor=True), 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, termedbydm = 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 termedbydm: + bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures, bymonitor=True), self.configuration.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 +3
-2@@ -305,14 +305,15 @@ class BuildStarted(BuildBase, OperationStarted): class BuildCompleted(BuildBase, OperationCompleted): """bbmake build run completed""" - def __init__(self, total, n, p, failures = 0): + def __init__(self, total, n, p, failures = 0, bymonitor = False): + if bymonitor: + failures += 1 if not failures: OperationCompleted.__init__(self, total, "Building Succeeded") else: OperationCompleted.__init__(self, total, "Building Failed") BuildBase.__init__(self, n, p, failures) - class NoProvider(Event): """No Provider for an Event"""bitbake/lib/bb/runqueue.py +5
-4@@ -867,6 +867,7 @@ class RunQueue: """ retval = 0.5 + termedbydm = False 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) + termedbydm = 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, termedbydm if self.state is runQueueChildProcess: print("Child process, eeek, shouldn't happen!") - return False + return False, termedbydm # Loop - return retval + return retval, termedbydm def finish_runqueue(self, now = False): if not self.rqexe:
Re: [PATCH 2/2] cooker: treat termination by disk monitor as failure
Quoted 11 lines · Richard Purdie
Quoted 10 lines · Kang Kai
[Yocto #2168]
Check the return value of function
diskMonitor.check()in runqueue then pass it to cooker. The cooker treats that runqueue terminated by disk monitor as failure, then increase the build failure count if the return value is true.The UIs could check the failure count accordingly, and this will helpful for UIs such as Hob.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Kang Kai<[email protected]>--- bitbake/lib/bb/cooker.py | 14 ++++++++++++-- bitbake/lib/bb/event.py | 5 +++-- bitbake/lib/bb/runqueue.py | 9 +++++---- 3 files changed, 20 insertions(+), 8 deletions(-)
Hi Richard,
Quoted 10 lines
I have to say I don't really like this code. I agree that the UI needs to know about diskmonitor failures but I'm not sure about changing the BuiuldCompleted event in this way. I think we should add the exit status to the BuildCompleted event as an extra field (leaving the failures count alone as it means something specific right now).
The UI is going to want more information about what failed (which disk was full, how full was it, where is it mounted?). The best approach therefore could be a specific DiskFull event which gets fired and the UI can act upon containing much more information.
OK. I'll update the patch.
Thanks,
Kai
Quoted 115 lines
Cheers,
Richard
Quoted 107 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, termedbydm = 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 termedbydm: + bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures, bymonitor=True), 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, termedbydm = 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 termedbydm: + bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures, bymonitor=True), self.configuration.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 +3
-2@@ -305,14 +305,15 @@ class BuildStarted(BuildBase, OperationStarted): class BuildCompleted(BuildBase, OperationCompleted): """bbmake build run completed""" - def __init__(self, total, n, p, failures = 0): + def __init__(self, total, n, p, failures = 0, bymonitor = False): + if bymonitor: + failures += 1 if not failures: OperationCompleted.__init__(self, total, "Building Succeeded") else: OperationCompleted.__init__(self, total, "Building Failed") BuildBase.__init__(self, n, p, failures) - class NoProvider(Event): """No Provider for an Event"""bitbake/lib/bb/runqueue.py +5
-4@@ -867,6 +867,7 @@ class RunQueue: """ retval = 0.5 + termedbydm = False 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) + termedbydm = 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, termedbydm if self.state is runQueueChildProcess: print("Child process, eeek, shouldn't happen!") - return False + return False, termedbydm # Loop - return retval + return retval, termedbydm def finish_runqueue(self, now = False): if not self.rqexe: