From 5cbe176510d9c86990783935ab2f2c85735d62a6 Mon Sep 17 00:00:00 2001 From: daniel Date: Sat, 30 Jan 2016 15:57:33 +0100 Subject: [PATCH] multiprinting Former-commit-id: bb4c70f2df91c12fa252f00b6272abf859070d99 Former-commit-id: cfb7fd87fb700dcfc991b7571d99da61e351487a --- corpkit/multiprocess.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/corpkit/multiprocess.py b/corpkit/multiprocess.py index 85eefc93..e4465725 100644 --- a/corpkit/multiprocess.py +++ b/corpkit/multiprocess.py @@ -107,7 +107,6 @@ def best_num_parallel(num_cores, num_queries): if type(multiprocess) == int: num_cores = multiprocess if multiprocess is False: - multiprocess = 1 num_cores = 1 # make sure quicksaves are right type @@ -223,6 +222,7 @@ def best_num_parallel(num_cores, num_queries): #stdout=sys.stdout failed = False terminal = False + used_joblib = False #ds = ds[::-1] if not root: from blessings import Terminal @@ -246,6 +246,7 @@ def best_num_parallel(num_cores, num_queries): try: #ds = sorted(ds, key=lambda k: k['paralleling'], reverse = True) res = Parallel(n_jobs=num_cores)(delayed(interrogator)(**x) for x in ds) + used_joblib = True except: failed = True print 'Multiprocessing failed.' @@ -346,9 +347,11 @@ def best_num_parallel(num_cores, num_queries): thetime = strftime("%H:%M:%S", localtime()) if terminal: with terminal.location(0, terminal.height): - print '\n\n%s: Finished! %d unique results, %d total.' % (thetime, len(out.results.columns), out.totals.sum()) + print '\n\n%s: Finished! %d unique results, %d total.%s' % (thetime, len(out.results.columns), out.totals.sum(), '\n') else: - print '\n\n%s: Finished! %d unique results, %d total.' % (thetime, len(out.results.columns), out.totals.sum()) + print '\n\n%s: Finished! %d unique results, %d total.%s' % (thetime, len(out.results.columns), out.totals.sum(), '\n') + if used_joblib: + print '\n' * (len(ds) - 3) if quicksave: from corpkit.other import save save(out, quicksave)