Skip to content

Commit 117c97b

Browse files
committed
FIX: Python 2.7-3.7.1 compatible NonDaemonPool
1 parent 39675df commit 117c97b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

nipype/pipeline/plugins/legacymultiproc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,16 @@ def _set_daemon(self, value):
9090
class NonDaemonPool(pool.Pool):
9191
"""A process pool with non-daemon processes.
9292
"""
93-
Process = NonDaemonProcess
93+
def Process(self, *args, **kwds):
94+
if hasattr(self, '_ctx'):
95+
ctx = self._ctx
96+
if isinstance(args[0], multiprocessing.context.BaseContext):
97+
ctx = args.pop(0)
98+
process = ctx.Process
99+
kwds['daemon'] = False
100+
else:
101+
process = NonDaemonProcess
102+
return process(*args, **kwds)
94103

95104

96105
class LegacyMultiProcPlugin(DistributedPluginBase):

0 commit comments

Comments
 (0)