Skip to content

Commit a61b197

Browse files
committed
Merge pull request #328 from satra/enh/node_plugin_args
WIP: allow node specific plugin args for sge and pbs
2 parents e310b12 + 8ce4156 commit a61b197

File tree

6 files changed

+38
-0
lines changed

6 files changed

+38
-0
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Changes since 0.5
22
=================
33

4+
* API: Node now allows specifying node level configuration for SGE/PBS clusters
45
* API: Logging to file is disabled by default
56
* API: New location of log file -> .nipype/nipype.cfg
67

doc/users/plugins.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,22 @@ a custom template::
115115
workflow.run(plugin='SGE',
116116
plugin_args=dict(template='mytemplate.sh', qsub_args='-q myqueue')
117117

118+
In addition to overall workflow configuration, you can use node level
119+
configuration for PBS/SGE::
120+
121+
node.plugin_args = {'qsub_args': '-l nodes=1:ppn=3'}
122+
123+
this would apply only to the node and is useful in situations, where a
124+
particular node might use more resources than other nodes in a workflow.
125+
126+
.. note::
127+
128+
Setting the keyword `overwrite` would overwrite any global configuration with
129+
this local configuration::
130+
131+
node.plugin_args = {'qsub_args': '-l nodes=1:ppn=3', 'overwrite': True}
132+
133+
118134
Condor
119135
------
120136

nipype/pipeline/engine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ def __init__(self, interface, iterables=None, overwrite=None,
973973
self.run_without_submitting = run_without_submitting
974974
self.input_source = {}
975975
self.needed_outputs = []
976+
self.plugin_args = {}
976977
if needed_outputs:
977978
self.needed_outputs = sorted(needed_outputs)
978979

nipype/pipeline/plugins/condor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ def _submit_batchtask(self, scriptfile, node):
6060
cmd = CommandLine('condor_qsub', environ=os.environ.data)
6161
path = os.path.dirname(scriptfile)
6262
qsubargs = ''
63+
if self._qsub_args:
64+
qsubargs = self._qsub_args
65+
if 'qsub_args' in node.plugin_args:
66+
if 'overwrite' in node.plugin_args and\
67+
node.plugin_args['overwrite']:
68+
qsubargs = node.plugin_args['qsub_args']
69+
else:
70+
qsubargs += (" " + node.plugin_args['qsub_args'])
6371
if self._qsub_args:
6472
qsubargs = self._qsub_args
6573
if '-o' not in qsubargs:

nipype/pipeline/plugins/pbs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ def _submit_batchtask(self, scriptfile, node):
5252
qsubargs = ''
5353
if self._qsub_args:
5454
qsubargs = self._qsub_args
55+
if 'qsub_args' in node.plugin_args:
56+
if 'overwrite' in node.plugin_args and \
57+
node.plugin_args['overwrite']:
58+
qsubargs = node.plugin_args['qsub_args']
59+
else:
60+
qsubargs += (" " + node.plugin_args['qsub_args'])
5561
if '-o' not in qsubargs:
5662
qsubargs = '%s -o %s' % (qsubargs, path)
5763
if '-e' not in qsubargs:

nipype/pipeline/plugins/sge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def _submit_batchtask(self, scriptfile, node):
5353
qsubargs = ''
5454
if self._qsub_args:
5555
qsubargs = self._qsub_args
56+
if 'qsub_args' in node.plugin_args:
57+
if 'overwrite' in node.plugin_args and\
58+
node.plugin_args['overwrite']:
59+
qsubargs = node.plugin_args['qsub_args']
60+
else:
61+
qsubargs += (" " + node.plugin_args['qsub_args'])
5662
if '-o' not in qsubargs:
5763
qsubargs = '%s -o %s' % (qsubargs, path)
5864
if '-e' not in qsubargs:

0 commit comments

Comments
 (0)