* [PATCH 0/2] treat runqueue terminated by disk monitor as failure @ 2012-07-24 7:04 Kang Kai 2012-07-24 7:04 ` [PATCH 1/2] monitordisk: update return value Kang Kai 2012-07-24 7:04 ` [PATCH 2/2] cooker: treat termination by disk monitor as failure Kang Kai 0 siblings, 2 replies; 5+ messages in thread From: Kang Kai @ 2012-07-24 7:04 UTC (permalink / raw) To: richard.purdie; +Cc: bitbake-devel, Zhenfeng.Zhao 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(-) -- 1.7.5.4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] monitordisk: update return value 2012-07-24 7:04 [PATCH 0/2] treat runqueue terminated by disk monitor as failure Kang Kai @ 2012-07-24 7:04 ` Kang Kai 2012-07-24 7:04 ` [PATCH 2/2] cooker: treat termination by disk monitor as failure Kang Kai 1 sibling, 0 replies; 5+ messages in thread From: Kang Kai @ 2012-07-24 7:04 UTC (permalink / raw) To: richard.purdie; +Cc: bitbake-devel, Zhenfeng.Zhao 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. Signed-off-by: Kang Kai <kai.kang@windriver.com> --- bitbake/lib/bb/monitordisk.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py index 9469193..ac6f9be 100644 --- a/bitbake/lib/bb/monitordisk.py +++ b/bitbake/lib/bb/monitordisk.py @@ -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 -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] cooker: treat termination by disk monitor as failure 2012-07-24 7:04 [PATCH 0/2] treat runqueue terminated by disk monitor as failure Kang Kai 2012-07-24 7:04 ` [PATCH 1/2] monitordisk: update return value Kang Kai @ 2012-07-24 7:04 ` Kang Kai 2012-07-24 8:14 ` Richard Purdie 1 sibling, 1 reply; 5+ messages in thread From: Kang Kai @ 2012-07-24 7:04 UTC (permalink / raw) To: richard.purdie; +Cc: bitbake-devel, Zhenfeng.Zhao [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. Signed-off-by: Kang Kai <kai.kang@windriver.com> --- 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(-) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 361bc88..58a10f7 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -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() diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 1116c0a..d719105 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -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""" diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 0a8c723..efe3623 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py @@ -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: -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] cooker: treat termination by disk monitor as failure 2012-07-24 7:04 ` [PATCH 2/2] cooker: treat termination by disk monitor as failure Kang Kai @ 2012-07-24 8:14 ` Richard Purdie 2012-07-24 23:24 ` Kang Kai 0 siblings, 1 reply; 5+ messages in thread From: Richard Purdie @ 2012-07-24 8:14 UTC (permalink / raw) To: Kang Kai; +Cc: bitbake-devel, Zhenfeng.Zhao On Tue, 2012-07-24 at 15:04 +0800, Kang Kai wrote: > [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. > > Signed-off-by: Kang Kai <kai.kang@windriver.com> > --- > 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 > diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py > index 361bc88..58a10f7 100644 > --- a/bitbake/lib/bb/cooker.py > +++ b/bitbake/lib/bb/cooker.py > @@ -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() > diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py > index 1116c0a..d719105 100644 > --- a/bitbake/lib/bb/event.py > +++ b/bitbake/lib/bb/event.py > @@ -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""" > > diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py > index 0a8c723..efe3623 100644 > --- a/bitbake/lib/bb/runqueue.py > +++ b/bitbake/lib/bb/runqueue.py > @@ -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: ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] cooker: treat termination by disk monitor as failure 2012-07-24 8:14 ` Richard Purdie @ 2012-07-24 23:24 ` Kang Kai 0 siblings, 0 replies; 5+ messages in thread From: Kang Kai @ 2012-07-24 23:24 UTC (permalink / raw) To: Richard Purdie; +Cc: bitbake-devel, Zhenfeng.Zhao On 2012年07月24日 16:14, Richard Purdie wrote: > On Tue, 2012-07-24 at 15:04 +0800, Kang Kai wrote: >> [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. >> >> Signed-off-by: Kang Kai<kai.kang@windriver.com> >> --- >> 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, > 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 > > Cheers, > > Richard > > >> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py >> index 361bc88..58a10f7 100644 >> --- a/bitbake/lib/bb/cooker.py >> +++ b/bitbake/lib/bb/cooker.py >> @@ -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() >> diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py >> index 1116c0a..d719105 100644 >> --- a/bitbake/lib/bb/event.py >> +++ b/bitbake/lib/bb/event.py >> @@ -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""" >> >> diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py >> index 0a8c723..efe3623 100644 >> --- a/bitbake/lib/bb/runqueue.py >> +++ b/bitbake/lib/bb/runqueue.py >> @@ -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: > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-24 23:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-07-24 7:04 [PATCH 0/2] treat runqueue terminated by disk monitor as failure Kang Kai 2012-07-24 7:04 ` [PATCH 1/2] monitordisk: update return value Kang Kai 2012-07-24 7:04 ` [PATCH 2/2] cooker: treat termination by disk monitor as failure Kang Kai 2012-07-24 8:14 ` Richard Purdie 2012-07-24 23:24 ` Kang Kai
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox