Skip to content

Commit ef7d01b

Browse files
author
Chad Cumba
committed
Added support for sbatch args to slurm module.
1 parent 5a653ef commit ef7d01b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

nipype/pipeline/plugins/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def __init__(self, template, plugin_args=None):
606606
self._template = plugin_args['template']
607607
if os.path.isfile(self._template):
608608
self._template = open(self._template).read()
609-
if 'sbatch' in plugin_args:
609+
if 'sbatch_args' in plugin_args:
610610
self._sbatch_args = plugin_args['sbatch_args']
611611
self._pending = {}
612612

nipype/pipeline/plugins/slurm.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ class SLURMPlugin(SLURMLikeBatchManagerBase):
2727
2828
- template : template to use for batch job submission
2929
30+
- sbatch_args: arguments to pass prepend to the sbatch call
31+
3032
3133
'''
3234

3335

3436
def __init__(self, **kwargs):
35-
'''
36-
Constructor
37-
'''
37+
3838
template="""
3939
#!/bin/sh
4040
"""
@@ -56,6 +56,10 @@ def _is_pending(self, taskid):
5656
return o.find(taskid) > -1
5757

5858
def _submit_batchtask(self, scriptfile, node):
59+
"""
60+
This is more or less the _submit_batchtask from sge.py with flipped variable
61+
names, different command line switches, and different output formatting/processing
62+
"""
5963
cmd = CommandLine('sbatch', environ=os.environ.data,
6064
terminal_output='allatonce')
6165
path = os.path.dirname(scriptfile)
@@ -98,7 +102,7 @@ def _submit_batchtask(self, scriptfile, node):
98102
sleep(self._retry_timeout) # sleep 2 seconds and try again.
99103
else:
100104
iflogger.setLevel(oldlevel)
101-
raise RuntimeError('\n'.join((('Could not submit slurm task'
105+
raise RuntimeError('\n'.join((('Could not submit sbatch task'
102106
' for node %s') % node._id,
103107
str(e))))
104108
else:
@@ -109,5 +113,5 @@ def _submit_batchtask(self, scriptfile, node):
109113
taskid = int(re.match("Your job ([0-9]*) .* has been submitted",
110114
lines[-1]).groups()[0])
111115
self._pending[taskid] = node.output_dir()
112-
logger.debug('submitted slurm task: %d for node %s' % (taskid, node._id))
116+
logger.debug('submitted sbatch task: %d for node %s' % (taskid, node._id))
113117
return taskid

0 commit comments

Comments
 (0)