aboutsummaryrefslogtreecommitdiffstats
path: root/parse_exps.py
diff options
context:
space:
mode:
Diffstat (limited to 'parse_exps.py')
-rwxr-xr-xparse_exps.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/parse_exps.py b/parse_exps.py
index c2376de..f27021a 100755
--- a/parse_exps.py
+++ b/parse_exps.py
@@ -16,7 +16,7 @@ from parse.dir_map import DirMap
16from parse.point import ExpPoint 16from parse.point import ExpPoint
17from parse.tuple_table import TupleTable,ReducedTupleTable 17from parse.tuple_table import TupleTable,ReducedTupleTable
18from parse.col_map import ColMapBuilder 18from parse.col_map import ColMapBuilder
19 19from multiprocessing import Pool, cpu_count
20 20
21def parse_args(): 21def parse_args():
22 # TODO: convert data-dir to proper option, clean 'dest' options 22 # TODO: convert data-dir to proper option, clean 'dest' options
@@ -106,7 +106,7 @@ def parse_exp(exp, force):
106 106
107 pickle.dump(result, f) 107 pickle.dump(result, f)
108 108
109 return result 109 return (exp, result)
110 110
111def main(): 111def main():
112 opts, args = parse_args() 112 opts, args = parse_args()
@@ -126,8 +126,11 @@ def main():
126 result_table = TupleTable(col_map) 126 result_table = TupleTable(col_map)
127 127
128 sys.stderr.write("Parsing data...\n") 128 sys.stderr.write("Parsing data...\n")
129 for i,exp in enumerate(exps): 129
130 result = parse_exp(exp, opts.force) 130 procs = min(len(exps), cpu_count()/2)
131 pool = Pool(processes=procs)
132 enum = pool.imap_unordered(parse_exp, exps, [opts.force]*len(exps))
133 for i, (exp, result) in enumerate(enum):
131 if opts.verbose: 134 if opts.verbose:
132 print(result) 135 print(result)
133 else: 136 else: