Skip to content

Commit 25ccb15

Browse files
committed
fix python2 to 3 issue with NonDaemonPool within Pool.Process as part of nipy/nipype#2754
1 parent f2de331 commit 25ccb15

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

maestro/core/module.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,21 @@ def _set_daemon(self, value):
4141

4242

4343
class NonDaemonizedPool(Pool):
44-
Process = NoDaemonProcess
44+
def Process(self, *args, **kwds):
45+
proc = super(NonDaemonizedPool, self).Process(*args, **kwds)
46+
47+
class NonDaemonProcess(proc.__class__):
48+
"""Monkey-patch process to ensure it is never daemonized"""
49+
@property
50+
def daemon(self):
51+
return False
52+
53+
@daemon.setter
54+
def daemon(self, val):
55+
pass
56+
57+
proc.__class__ = NonDaemonProcess
58+
return proc
4559

4660
# TODO: change modules to accept kwargs and args
4761

0 commit comments

Comments
 (0)