Skip to content

Commit d8b136f

Browse files
author
Daniel Haehn
committed
Add the non_daemon option to execute the MultiProcPlugin nodes as non-daemon processes.
1 parent f403708 commit d8b136f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

nipype/pipeline/plugins/multiproc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class MultiProcPlugin(DistributedPluginBase):
4444
execution. Currently supported options are:
4545
4646
- n_procs : number of processes to use
47+
- non_daemon : boolean flag to execute as non-daemon processes
4748
4849
"""
4950

@@ -52,10 +53,17 @@ def __init__(self, plugin_args=None):
5253
self._taskresult = {}
5354
self._taskid = 0
5455
n_procs = 1
56+
non_daemon = False
5557
if plugin_args:
5658
if 'n_procs' in plugin_args:
5759
n_procs = plugin_args['n_procs']
58-
self.pool = Pool(processes=n_procs)
60+
if 'non_daemon' in plugin_args:
61+
non_daemon = plugin_args['non_daemon']
62+
if non_daemon:
63+
# run the execution using the non-daemon pool subclass
64+
self.pool = NonDaemonPool(processes=n_procs)
65+
else:
66+
self.pool = Pool(processes=n_procs)
5967

6068
def _get_result(self, taskid):
6169
if taskid not in self._taskresult:

0 commit comments

Comments
 (0)