Skip to content

Commit a746630

Browse files
committed
Revert "Merge pull request numba#8751 from apmasell/mulitprocess_recycling"
386a8f9
1 parent 135d150 commit a746630

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

‎numba/testing/main.py‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -770,24 +770,28 @@ def _run_inner(self, result):
770770

771771
# Split the tests and recycle the worker process to tame memory usage.
772772
chunk_size = 100
773+
splitted_tests = [self._ptests[i:i + chunk_size]
774+
for i in range(0, len(self._ptests), chunk_size)]
773775

774-
pool = multiprocessing.Pool(self.nprocs, maxtasksperchild=chunk_size)
775-
try:
776-
self._run_parallel_tests(result, pool, child_runner, self._ptests)
777-
except:
778-
# On exception, kill still active workers immediately
779-
pool.terminate()
780-
# Make sure exception is reported and not ignored
781-
raise
782-
else:
783-
# Close the pool cleanly unless asked to early out
784-
if result.shouldStop:
776+
for tests in splitted_tests:
777+
pool = multiprocessing.Pool(self.nprocs)
778+
try:
779+
self._run_parallel_tests(result, pool, child_runner, tests)
780+
except:
781+
# On exception, kill still active workers immediately
785782
pool.terminate()
783+
# Make sure exception is reported and not ignored
784+
raise
786785
else:
787-
pool.close()
788-
finally:
789-
# Always join the pool (this is necessary for coverage.py)
790-
pool.join()
786+
# Close the pool cleanly unless asked to early out
787+
if result.shouldStop:
788+
pool.terminate()
789+
break
790+
else:
791+
pool.close()
792+
finally:
793+
# Always join the pool (this is necessary for coverage.py)
794+
pool.join()
791795
if not result.shouldStop:
792796
stests = SerialSuite(self._stests)
793797
stests.run(result)

0 commit comments

Comments
 (0)