Commit 67b9ab9b authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Explicitly set mp start method to fork

parent 5e2c7e58
......@@ -110,12 +110,22 @@ def main(argv=None):
if args.num_jobs > 1:
log.debug('Running up to %i jobs in parallel', args.num_jobs)
mgr = mp.Manager()
# We need to initialise icd10
# before the worker processes
# are created, so its state is
# shared by all processes.
# Funpack relies on fork() to share
# the dataset to child processes
# when parallelising tasks. This
# is potentially dangerous on macOS
# - see the "macOS issues" note in
# README, and the python bug report:
# https://bugs.python.org/issue33725
mp.set_start_method('fork')
# The icd10 module maintains information
# which is potentially shared (read from
# and written to) by multiple processes,
# so we use a mp.Manager to handle
# shared state.
mgr = mp.Manager()
icd10.initialise(mgr)
else:
mgr = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment