All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bb.runqueue: fix unexpected process death logic
@ 2016-10-07  4:07 Christopher Larson
  2016-10-07  4:10 ` Christopher Larson
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Larson @ 2016-10-07  4:07 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

`if w in self.rq.worker` when w *is* self.rq.worker doesn't make a great deal
of sense, and results in this error:

      File ".../poky/bitbake/lib/bb/runqueue.py", line 2372, in runQueuePipe.read():
                             name = None
        >                    if w in self.rq.worker:
                                 name = "Worker"
    TypeError: unhashable type: 'dict'

Most likely this was meant to be 'is' rather than 'in', but rather than
checking after the fact, just include the name in the iteration, instead.

While we're here, also clean up and fix the broken error message.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 lib/bb/runqueue.py | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 1571639..df7c50f 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -2365,16 +2365,11 @@ class runQueuePipe():
         self.rqexec = rqexec
 
     def read(self):
-        for w in [self.rq.worker, self.rq.fakeworker]:
-            for mc in w:
-                w[mc].process.poll()
-                if w[mc].process.returncode is not None and not self.rq.teardown:
-                    name = None
-                    if w in self.rq.worker:
-                        name = "Worker"
-                    elif w in self.rq.fakeworker:
-                        name = "Fakeroot"
-                    bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, w.pid, str(w.returncode)))
+        for workers, name in [(self.rq.worker, "Worker"), (self.rq.fakeworker, "Fakeroot")]:
+            for worker in workers.values():
+                worker.process.poll()
+                if worker.process.returncode is not None and not self.rq.teardown:
+                    bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, worker.process.pid, str(worker.process.returncode)))
                     self.rq.finish_runqueue(True)
 
         start = len(self.queue)
-- 
2.8.0



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

* Re: [PATCH] bb.runqueue: fix unexpected process death logic
  2016-10-07  4:07 [PATCH] bb.runqueue: fix unexpected process death logic Christopher Larson
@ 2016-10-07  4:10 ` Christopher Larson
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Larson @ 2016-10-07  4:10 UTC (permalink / raw)
  To: bitbake-devel@lists.openembedded.org; +Cc: Christopher Larson

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

On Thu, Oct 6, 2016 at 9:07 PM, Christopher Larson <kergoth@gmail.com>
wrote:

> From: Christopher Larson <chris_larson@mentor.com>
>
> `if w in self.rq.worker` when w *is* self.rq.worker doesn't make a great
> deal
> of sense, and results in this error:
>
>       File ".../poky/bitbake/lib/bb/runqueue.py", line 2372, in
> runQueuePipe.read():
>                              name = None
>         >                    if w in self.rq.worker:
>                                  name = "Worker"
>     TypeError: unhashable type: 'dict'
>
> Most likely this was meant to be 'is' rather than 'in', but rather than
> checking after the fact, just include the name in the iteration, instead.
>
> While we're here, also clean up and fix the broken error message.
>
> Signed-off-by: Christopher Larson <chris_larson@mentor.com>
>

Ah, no, it wasn’t meant to be is, clearly this was a missed w -> w[mc]
replacement, so it was meant to be in, just with a different value. Still
worth simplifying that handling a bit, regardless :)
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

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

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

end of thread, other threads:[~2016-10-07  4:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07  4:07 [PATCH] bb.runqueue: fix unexpected process death logic Christopher Larson
2016-10-07  4:10 ` 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.