solve bug in custom pool multiprocessing

This commit is contained in:
Noe Brucy
2020-12-14 09:51:29 +01:00
parent e0ce6729af
commit 653e64d782
3 changed files with 38 additions and 73 deletions
+7 -4
View File
@@ -1,3 +1,4 @@
from mypool import MyPool
from postprocessor import *
@@ -34,10 +35,12 @@ class Aggregator:
)
if self.pp_params.process.num_process > 1:
pool = Pool(processes=self.pp_params.process.num_process)
done = pool.map(map_fn, run_num)
pool = MyPool(processes=self.pp_params.process.num_process)
result = pool.map(map_fn, run_num)
pool.close()
pool.join()
else:
done = map(map_fn, run_num)
self.just_done.extend([item for li in done for item in li])
result = map(map_fn, run_num)
if np.any([res is not None for res in result]):
self.just_done.append(dep)