Skip to content

Commit

Permalink
multiprinting
Browse files Browse the repository at this point in the history
Former-commit-id: bb4c70f
Former-commit-id: cfb7fd8
  • Loading branch information
daniel committed Jan 30, 2016
1 parent f1302fc commit 5cbe176
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions corpkit/multiprocess.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5cbe176

Please sign in to comment.