All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] bb.build: in _exec_task, move TaskStarted into try/except
@ 2016-09-15 21:15 Christopher Larson
  2016-09-15 21:15 ` [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2016-09-15 21:15 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

We want any exceptions raised by the TaskStarted event handlers to be caught
by the existing exception handling, rather than unconditionally hitting the
exception formatting + traceback in exec_task, otherwise we can't cleanly exit
the task with a nice message from such a handler.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 lib/bb/build.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index fcf0149..28401b3 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -560,8 +560,8 @@ def _exec_task(fn, task, d, quieterr):
 
     flags = localdata.getVarFlags(task)
 
-    event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
     try:
+        event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
         for func in (prefuncs or '').split():
             exec_func(func, localdata)
         exec_func(task, localdata)
-- 
2.8.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException
  2016-09-15 21:15 [PATCH 1/2] bb.build: in _exec_task, move TaskStarted into try/except Christopher Larson
@ 2016-09-15 21:15 ` Christopher Larson
  2016-09-16 16:34   ` Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2016-09-15 21:15 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

We don't want a traceback for this exception, we need to catch it, fire
TaskFailed, and return failure.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 lib/bb/build.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 28401b3..8581e72 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -575,6 +575,9 @@ def _exec_task(fn, task, d, quieterr):
             logger.error(str(exc))
             event.fire(TaskFailed(task, logfn, localdata, errprinted), localdata)
         return 1
+    except bb.BBHandledException:
+        event.fire(TaskFailed(task, logfn, localdata, True), localdata)
+        return 1
     finally:
         sys.stdout.flush()
         sys.stderr.flush()
-- 
2.8.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException
  2016-09-15 21:15 ` [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException Christopher Larson
@ 2016-09-16 16:34   ` Christopher Larson
  2016-09-16 20:02     ` Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2016-09-16 16:34 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Christopher Larson

[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]

On Thu, Sep 15, 2016 at 2:15 PM, Christopher Larson <kergoth@gmail.com>
wrote:

> From: Christopher Larson <chris_larson@mentor.com>
>
> We don't want a traceback for this exception, we need to catch it, fire
> TaskFailed, and return failure.
>
> Signed-off-by: Christopher Larson <chris_larson@mentor.com>
> ---
>  lib/bb/build.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/bb/build.py b/lib/bb/build.py
> index 28401b3..8581e72 100644
> --- a/lib/bb/build.py
> +++ b/lib/bb/build.py
> @@ -575,6 +575,9 @@ def _exec_task(fn, task, d, quieterr):
>              logger.error(str(exc))
>              event.fire(TaskFailed(task, logfn, localdata, errprinted),
> localdata)
>          return 1
> +    except bb.BBHandledException:
> +        event.fire(TaskFailed(task, logfn, localdata, True), localdata)
> +        return 1
>

Don’t merge this, v2 is forthcoming. Apparently firing the TaskFailed is
problematic if it was the TaskStarted event handler which failed, as the UI
won’t have the pid of the task, resulting in this:

Traceback (most recent call last):
  File "/scratch/dogwood/pdk-licensing/poky/bitbake/lib/bb/ui/knotty.py",
line 426, in main
    helper.eventHandler(event)
  File "/scratch/dogwood/pdk-licensing/poky/bitbake/lib/bb/ui/uihelper.py",
line 48, in eventHandler
    del self.running_tasks[event.pid]
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 2441 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException
  2016-09-16 16:34   ` Christopher Larson
@ 2016-09-16 20:02     ` Christopher Larson
  2016-09-16 20:04       ` Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2016-09-16 20:02 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Christopher Larson

[-- Attachment #1: Type: text/plain, Size: 1826 bytes --]

On Fri, Sep 16, 2016 at 9:34 AM, Christopher Larson <chris_larson@mentor.com
> wrote:

> On Thu, Sep 15, 2016 at 2:15 PM, Christopher Larson <kergoth@gmail.com>
> wrote:
>
>> From: Christopher Larson <chris_larson@mentor.com>
>>
>> We don't want a traceback for this exception, we need to catch it, fire
>> TaskFailed, and return failure.
>>
>> Signed-off-by: Christopher Larson <chris_larson@mentor.com>
>> ---
>>  lib/bb/build.py | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/lib/bb/build.py b/lib/bb/build.py
>> index 28401b3..8581e72 100644
>> --- a/lib/bb/build.py
>> +++ b/lib/bb/build.py
>> @@ -575,6 +575,9 @@ def _exec_task(fn, task, d, quieterr):
>>              logger.error(str(exc))
>>              event.fire(TaskFailed(task, logfn, localdata, errprinted),
>> localdata)
>>          return 1
>> +    except bb.BBHandledException:
>> +        event.fire(TaskFailed(task, logfn, localdata, True), localdata)
>> +        return 1
>>
>
> Don’t merge this, v2 is forthcoming. Apparently firing the TaskFailed is
> problematic if it was the TaskStarted event handler which failed, as the UI
> won’t have the pid of the task, resulting in this:
>
> Traceback (most recent call last):
>   File "/scratch/dogwood/pdk-licensing/poky/bitbake/lib/bb/ui/knotty.py",
> line 426, in main
>     helper.eventHandler(event)
>   File "/scratch/dogwood/pdk-licensing/poky/bitbake/lib/bb/ui/uihelper.py",
> line 48, in eventHandler
>     del self.running_tasks[event.pid]
>

This is superceded by 'bb.build: in _exec_task, catch errors from
TaskStarted’. Please review/apply that rather than this. Thanks.
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 3012 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException
  2016-09-16 20:02     ` Christopher Larson
@ 2016-09-16 20:04       ` Christopher Larson
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Larson @ 2016-09-16 20:04 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Christopher Larson

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

On Fri, Sep 16, 2016 at 1:02 PM, Christopher Larson <chris_larson@mentor.com
> wrote:

>
> On Fri, Sep 16, 2016 at 9:34 AM, Christopher Larson <
> chris_larson@mentor.com> wrote:
>
>> On Thu, Sep 15, 2016 at 2:15 PM, Christopher Larson <kergoth@gmail.com>
>> wrote:
>>
>>> From: Christopher Larson <chris_larson@mentor.com>
>>>
>>> We don't want a traceback for this exception, we need to catch it, fire
>>> TaskFailed, and return failure.
>>>
>>> Signed-off-by: Christopher Larson <chris_larson@mentor.com>
>>> ---
>>>  lib/bb/build.py | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/lib/bb/build.py b/lib/bb/build.py
>>> index 28401b3..8581e72 100644
>>> --- a/lib/bb/build.py
>>> +++ b/lib/bb/build.py
>>> @@ -575,6 +575,9 @@ def _exec_task(fn, task, d, quieterr):
>>>              logger.error(str(exc))
>>>              event.fire(TaskFailed(task, logfn, localdata, errprinted),
>>> localdata)
>>>          return 1
>>> +    except bb.BBHandledException:
>>> +        event.fire(TaskFailed(task, logfn, localdata, True), localdata)
>>> +        return 1
>>>
>>
>> Don’t merge this, v2 is forthcoming. Apparently firing the TaskFailed is
>> problematic if it was the TaskStarted event handler which failed, as the UI
>> won’t have the pid of the task, resulting in this:
>>
>> Traceback (most recent call last):
>>   File "/scratch/dogwood/pdk-licensing/poky/bitbake/lib/bb/ui/knotty.py",
>> line 426, in main
>>     helper.eventHandler(event)
>>   File "/scratch/dogwood/pdk-licensing/poky/bitbake/lib/bb/ui/uihelper.py",
>> line 48, in eventHandler
>>     del self.running_tasks[event.pid]
>>
>
> This is superceded by 'bb.build: in _exec_task, catch errors from
> TaskStarted’. Please review/apply that rather than this. Thanks.


Sigh, was on the wrong patch. We want this one, it’s not superceded. Ignore
all this, a v2 series is forthcoming.
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 3475 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-16 20:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 21:15 [PATCH 1/2] bb.build: in _exec_task, move TaskStarted into try/except Christopher Larson
2016-09-15 21:15 ` [PATCH 2/2] bb.build: in _exec_task, catch BBHandledException Christopher Larson
2016-09-16 16:34   ` Christopher Larson
2016-09-16 20:02     ` Christopher Larson
2016-09-16 20:04       ` Christopher Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.