Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Kang Kai <Kai.Kang@windriver.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: bitbake-devel@lists.openembedded.org, Zhenfeng.Zhao@windriver.com
Subject: Re: [PATCH 2/2] cooker: treat termination by disk monitor as failure
Date: Wed, 25 Jul 2012 07:24:59 +0800	[thread overview]
Message-ID: <500F2ECB.8080505@windriver.com> (raw)
In-Reply-To: <1343117680.21788.114.camel@ted>

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:
>
>




      reply	other threads:[~2012-07-24 23:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=500F2ECB.8080505@windriver.com \
    --to=kai.kang@windriver.com \
    --cc=Zhenfeng.Zhao@windriver.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox