diff options
-rw-r--r-- | meta/lib/oe/utils.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 753b577555..814ac0fd51 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -248,40 +248,6 @@ def execute_pre_post_process(d, cmds): | |||
248 | bb.note("Executing %s ..." % cmd) | 248 | bb.note("Executing %s ..." % cmd) |
249 | bb.build.exec_func(cmd, d) | 249 | bb.build.exec_func(cmd, d) |
250 | 250 | ||
251 | def multiprocess_exec(commands, function): | ||
252 | import signal | ||
253 | import multiprocessing | ||
254 | |||
255 | if not commands: | ||
256 | return [] | ||
257 | |||
258 | def init_worker(): | ||
259 | signal.signal(signal.SIGINT, signal.SIG_IGN) | ||
260 | |||
261 | fails = [] | ||
262 | |||
263 | def failures(res): | ||
264 | fails.append(res) | ||
265 | |||
266 | nproc = min(multiprocessing.cpu_count(), len(commands)) | ||
267 | pool = bb.utils.multiprocessingpool(nproc, init_worker) | ||
268 | |||
269 | try: | ||
270 | mapresult = pool.map_async(function, commands, error_callback=failures) | ||
271 | |||
272 | pool.close() | ||
273 | pool.join() | ||
274 | results = mapresult.get() | ||
275 | except KeyboardInterrupt: | ||
276 | pool.terminate() | ||
277 | pool.join() | ||
278 | raise | ||
279 | |||
280 | if fails: | ||
281 | raise fails[0] | ||
282 | |||
283 | return results | ||
284 | |||
285 | # For each item in items, call the function 'target' with item as the first | 251 | # For each item in items, call the function 'target' with item as the first |
286 | # argument, extraargs as the other arguments and handle any exceptions in the | 252 | # argument, extraargs as the other arguments and handle any exceptions in the |
287 | # parent thread | 253 | # parent thread |