diff options
author | Linus Nordberg <linus@nordu.net> | 2016-11-30 16:47:23 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-11-30 16:47:23 +0100 |
commit | bff5d58fcce0534cf4774df386ff448261b28c20 (patch) | |
tree | 076adf9062bb24b210f8712b4aeb303b3023643d /tools/mergetools.py | |
parent | 720473257b4b7ab9916826ae87e617d1df138260 (diff) |
Parallelise merge_dist.
Also deduplicate some code.
Diffstat (limited to 'tools/mergetools.py')
-rw-r--r-- | tools/mergetools.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/mergetools.py b/tools/mergetools.py index 109e9d4..beb41bf 100644 --- a/tools/mergetools.py +++ b/tools/mergetools.py @@ -484,13 +484,21 @@ def flock_ex_or_fail(path): return False return True +def start_worker(name, fun, args): + pipe_mine, pipe_theirs = multiprocessing.Pipe() + p = multiprocessing.Process(target=fun, + args=(pipe_theirs, args), + name=name) + p.start() + return (p, pipe_mine) + def terminate_child_procs(): for p in multiprocessing.active_children(): #print >>sys.stderr, "DEBUG: terminating pid", p.pid p.terminate() def loginit(args, fname): - logfmt = '%(asctime)s %(message)s' + logfmt = '%(asctime)s %(name)s %(levelname)s %(message)s' loglevel = getattr(logging, args.loglevel.upper()) if args.logdir is None: logging.basicConfig(format=logfmt, level=loglevel) |