Skip to contentSkip to conversation

bb.runqueue: fix unexpected process death logic

PATCH In review Christopher Larson 2 participants 2 messages Oct 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bb.runqueue: fix unexpected process death logic

From: Christopher Larson <[email protected]>

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.

---
 lib/bb/runqueue.py | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
lib/bb/runqueue.py +5 -10
index 1571639..df7c50f 100644
@@ -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)
Signature · 1 line
2.8.0
#1 lore raw
Quoted 13 lines · Christopher Larson

From: Christopher Larson <[email protected]>

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'

Quoted 7 lines

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.

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

Signature · 5 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics