Skip to content

Commit fd8d976

Browse files
author
Chad Cumba
committed
Added mandatory args for SLURM, fixed regex for batch job number
Added in several defaults for mandatory arguments to sbatch. Also the regex that finds the job number was malformed and was returning 'None' for all batch jobs. That's been fixed and is now returning jobs correctly.
1 parent ef7d01b commit fd8d976

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nipype/pipeline/plugins/slurm.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ class SLURMPlugin(SLURMLikeBatchManagerBase):
3535

3636
def __init__(self, **kwargs):
3737

38-
template="""
39-
#!/bin/sh
38+
template="""#!/bin/sh
4039
"""
4140
self._retry_timeout = 2
4241
self._max_tries = 2
@@ -77,6 +76,12 @@ def _submit_batchtask(self, scriptfile, node):
7776
sbatch_args = '%s -o %s' % (sbatch_args, path)
7877
if '-e' not in sbatch_args:
7978
sbatch_args = '%s -e %s' % (sbatch_args, path)
79+
if '-p' not in sbatch_args:
80+
sbatch_args = '%s -p normal' % (sbatch_args)
81+
if '-n' not in sbatch_args:
82+
sbatch_args = '%s -n 16' % (sbatch_args)
83+
if '-t' not in sbatch_args:
84+
sbatch_args = '%s -t 48:00:00' % (sbatch_args)
8085
if node._hierarchy:
8186
jobname = '.'.join((os.environ.data['LOGNAME'],
8287
node._hierarchy,
@@ -110,7 +115,7 @@ def _submit_batchtask(self, scriptfile, node):
110115
iflogger.setLevel(oldlevel)
111116
# retrieve sge taskid
112117
lines = [line for line in result.runtime.stdout.split('\n') if line]
113-
taskid = int(re.match("Your job ([0-9]*) .* has been submitted",
118+
taskid = int(re.match("Submitted batch job ([0-9]*)",
114119
lines[-1]).groups()[0])
115120
self._pending[taskid] = node.output_dir()
116121
logger.debug('submitted sbatch task: %d for node %s' % (taskid, node._id))

0 commit comments

Comments
 (0)