Skip to content

Commit 5a653ef

Browse files
author
Chad Cumba
committed
Fixed misnamed variable causing crash.
_sbatch_args was incorrectly called _slurm_args in one of the if statements in slurm.py causing a crash. Added in a load .slurm to __init__ as development env had plugins in PYTHONPATH. Moved slurm plugin base to base.py instead of slurm.py
1 parent 518a65c commit 5a653ef

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

nipype/pipeline/plugins/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
from .pbsgraph import PBSGraphPlugin
1515
from .sgegraph import SGEGraphPlugin
1616
from .lsf import LSFPlugin
17+
from .slurm import SLURMPlugin

nipype/pipeline/plugins/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ class SLURMLikeBatchManagerBase(SGELikeBatchManagerBase):
598598
"""
599599

600600
def __init__(self, template, plugin_args=None):
601-
super(SLURMLikeBatchManagerBase, self).__init__(plugin_args=plugin_args)
601+
super(SLURMLikeBatchManagerBase, self).__init__(template=template, plugin_args=plugin_args)
602602
self._template = template
603603
self._sbatch_args = None
604604
if plugin_args:

nipype/pipeline/plugins/slurm.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ def _submit_batchtask(self, scriptfile, node):
6060
terminal_output='allatonce')
6161
path = os.path.dirname(scriptfile)
6262

63-
slurmargs = ''
64-
if self._slurmargs:
65-
slurmargs = self._slurm_args
66-
if 'slurm_args' in node.plugin_args:
63+
sbatch_args = ''
64+
if self._sbatch_args:
65+
sbatch_args = self._sbatch_args
66+
if 'sbatch_args' in node.plugin_args:
6767
if 'overwrite' in node.plugin_args and\
6868
node.plugin_args['overwrite']:
69-
slurmargs = node.plugin_args['slurm_args']
69+
sbatch_args = node.plugin_args['sbatch_args']
7070
else:
71-
slurmargs += (" " + node.plugin_args['slurm_args'])
72-
if '-o' not in slurmargs:
73-
slurmargs = '%s -o %s' % (slurmargs, path)
74-
if '-e' not in slurmargs:
75-
slurmargs = '%s -e %s' % (slurmargs, path)
71+
sbatch_args += (" " + node.plugin_args['sbatch_args'])
72+
if '-o' not in sbatch_args:
73+
sbatch_args = '%s -o %s' % (sbatch_args, path)
74+
if '-e' not in sbatch_args:
75+
sbatch_args = '%s -e %s' % (sbatch_args, path)
7676
if node._hierarchy:
7777
jobname = '.'.join((os.environ.data['LOGNAME'],
7878
node._hierarchy,
@@ -83,7 +83,7 @@ def _submit_batchtask(self, scriptfile, node):
8383
jobnameitems = jobname.split('.')
8484
jobnameitems.reverse()
8585
jobname = '.'.join(jobnameitems)
86-
cmd.inputs.args = '%s -J %s %s' % (slurmargs,
86+
cmd.inputs.args = '%s -J %s %s' % (sbatch_args,
8787
jobname,
8888
scriptfile)
8989
oldlevel = iflogger.level

0 commit comments

Comments
 (0)