diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-20 15:19:57 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-24 11:52:27 +0100 |
| commit | 34c2bd84ee6f699e348d602a82d2d0963384cdec (patch) | |
| tree | 86507939a8a338557c4929615c0e07fc16388d55 /meta/lib/oe/utils.py | |
| parent | adea90740d45628685d0828b3103109432c25857 (diff) | |
| download | poky-34c2bd84ee6f699e348d602a82d2d0963384cdec.tar.gz | |
lib/oe/utils: Drop now unused multiprocess_exec
(From OE-Core rev: f3b30def2cd1c9ede7630489c3949a45b6eba6ed)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/utils.py')
| -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 |
