summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/runqueue.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-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 afbc16a9f..c82affca3 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