Skip to content

Commit 3a9ac48

Browse files
committed
ENH: Add process_initializer for LegacyMultiProc
1 parent 39a2cbd commit 3a9ac48

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

nipype/pipeline/plugins/legacymultiproc.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ class NonDaemonPool(pool.Pool):
153153
Process = NonDaemonProcess
154154

155155

156+
def process_initializer(cwd):
157+
"""Initializes the environment of the child process"""
158+
os.chdir(cwd)
159+
os.environ["NO_NIPYPE_ET"] = "1"
160+
161+
156162
class LegacyMultiProcPlugin(DistributedPluginBase):
157163
"""
158164
Execute workflow with multiprocessing, not sending more jobs at once
@@ -223,7 +229,7 @@ def __init__(self, plugin_args=None):
223229
self.pool = NipypePool(
224230
processes=self.processors,
225231
maxtasksperchild=maxtasks,
226-
initializer=os.chdir,
232+
initializer=process_initializer,
227233
initargs=(self._cwd,),
228234
)
229235
except TypeError:

0 commit comments

Comments
 (0)