summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-07-05 15:42:25 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-16 12:31:19 +0100
commit8a5b5080a2fa0db7972573cfcd8e04abedb22618 (patch)
tree0264453b6650da4de92bf88e76dcc4562a4d7ea5 /bitbake
parent90db9f30749b3f93a6c7d503af544ee8e0ca1728 (diff)
downloadast2050-yocto-poky-8a5b5080a2fa0db7972573cfcd8e04abedb22618.zip
ast2050-yocto-poky-8a5b5080a2fa0db7972573cfcd8e04abedb22618.tar.gz
bitbake: runqueue: Combine the waitpid result handling code into a function
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/runqueue.py49
1 files changed, 21 insertions, 28 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index afbc16a..c82affc 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1010,19 +1010,8 @@ class RunQueue:
self.build_pipes[pipe].read()
if self.stats.active > 0:
- result = os.waitpid(-1, os.WNOHANG)
- if result[0] is 0 and result[1] is 0:
+ if self.runqueue_process_waitpid() is None:
return
- task = self.build_pids[result[0]]
- del self.build_pids[result[0]]
- self.build_pipes[result[0]].close()
- del self.build_pipes[result[0]]
- if result[1] != 0:
- self.task_fail(task, result[1])
- return
- self.task_complete(task)
- self.stats.taskCompleted()
- bb.event.fire(runQueueTaskCompleted(task, self.stats, self), self.cfgData)
continue
if len(self.failed_fnids) != 0:
@@ -1040,6 +1029,25 @@ class RunQueue:
self.state = runQueueComplete
return
+ def runqueue_process_waitpid(self):
+ """
+ Return none is there are no processes awaiting result collection, otherwise
+ collect the process exit codes and close the information pipe.
+ """
+ result = os.waitpid(-1, os.WNOHANG)
+ if result[0] is 0 and result[1] is 0:
+ return None
+ task = self.build_pids[result[0]]
+ del self.build_pids[result[0]]
+ self.build_pipes[result[0]].close()
+ del self.build_pipes[result[0]]
+ if result[1] != 0:
+ self.task_fail(task, result[1])
+ else:
+ self.task_complete(task)
+ self.stats.taskCompleted()
+ bb.event.fire(runQueueTaskCompleted(task, self.stats, self), self.cfgData)
+
def finish_runqueue_now(self):
if self.stats.active:
bb.msg.note(1, bb.msg.domain.RunQueue, "Sending SIGINT to remaining %s tasks" % self.stats.active)
@@ -1062,23 +1070,8 @@ class RunQueue:
try:
while self.stats.active > 0:
bb.event.fire(runQueueExitWait(self.stats.active), self.cfgData)
- #bb.msg.note(1, bb.msg.domain.RunQueue, "Waiting for %s active tasks to finish" % self.stats.active)
- #tasknum = 1
- #for k, v in self.build_pids.iteritems():
- # bb.msg.note(1, bb.msg.domain.RunQueue, "%s: %s (pid %s)" % (tasknum, self.get_user_idstring(v), k))
- # tasknum = tasknum + 1
- result = os.waitpid(-1, os.WNOHANG)
- if result[0] is 0 and result[1] is 0:
+ if self.runqueue_process_waitpid() is None:
return
- task = self.build_pids[result[0]]
- del self.build_pids[result[0]]
- self.build_pipes[result[0]].close()
- del self.build_pipes[result[0]]
- if result[1] != 0:
- self.task_fail(task, result[1])
- else:
- self.stats.taskCompleted()
- bb.event.fire(runQueueTaskCompleted(task, self.stats, self), self.cfgData)
except:
self.finish_runqueue_now()
raise
OpenPOWER on IntegriCloud