From bff5d58fcce0534cf4774df386ff448261b28c20 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 30 Nov 2016 16:47:23 +0100 Subject: Parallelise merge_dist. Also deduplicate some code. --- tools/mergetools.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/mergetools.py') 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) -- cgit v1.1