Skip to content

Commit

Permalink
terminate instead of close to prevent hanging pool.join. Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewThe committed Jan 3, 2024
1 parent 2f3aeb3 commit ecade76
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions job_pool/job_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class AbnormalWorkerTerminationError(Exception):


class JobPool:
@threadpool_limits.wrap(limits=1, user_api='blas')
def __init__(
self,
processes: int = 1,
Expand Down Expand Up @@ -121,8 +120,7 @@ def checkPool(self, printProgressEvery: int = -1):
):
self.checkForTerminatedProcess(res)
outputs.append(res.get())
self.pool.close()
self.pool.join()
self.stopPool()
return outputs
except (KeyboardInterrupt, SystemExit) as e:
logger.error(f"Caught {e.__class__.__name__}, terminating workers")
Expand Down

0 comments on commit ecade76

Please sign in to comment.