Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions numba/testing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,24 +770,28 @@ def _run_inner(self, result):

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

pool = multiprocessing.Pool(self.nprocs, maxtasksperchild=chunk_size)
try:
self._run_parallel_tests(result, pool, child_runner, self._ptests)
except:
# On exception, kill still active workers immediately
pool.terminate()
# Make sure exception is reported and not ignored
raise
else:
# Close the pool cleanly unless asked to early out
if result.shouldStop:
for tests in splitted_tests:
pool = multiprocessing.Pool(self.nprocs)
try:
self._run_parallel_tests(result, pool, child_runner, tests)
except:
# On exception, kill still active workers immediately
pool.terminate()
# Make sure exception is reported and not ignored
raise
else:
pool.close()
finally:
# Always join the pool (this is necessary for coverage.py)
pool.join()
# Close the pool cleanly unless asked to early out
if result.shouldStop:
pool.terminate()
break
else:
pool.close()
finally:
# Always join the pool (this is necessary for coverage.py)
pool.join()
if not result.shouldStop:
stests = SerialSuite(self._stests)
stests.run(result)
Expand Down