Skip to content

Commit 9a911d4

Browse files
authored
Merge pull request #2693 from mgxd/bf/slurm
FIX: SLURM plugin polling
2 parents 0a7b0a5 + 5653828 commit 9a911d4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

nipype/pipeline/plugins/slurm.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ def __init__(self, **kwargs):
6262
super(SLURMPlugin, self).__init__(self._template, **kwargs)
6363

6464
def _is_pending(self, taskid):
65-
# subprocess.Popen requires taskid to be a string
66-
res = CommandLine(
67-
'squeue',
68-
args=' '.join(['-j', '%s' % taskid]),
69-
resource_monitor=False,
70-
terminal_output='allatonce').run()
71-
return res.runtime.stdout.find(str(taskid)) > -1
65+
try:
66+
res = CommandLine(
67+
'squeue',
68+
args=' '.join(['-j', '%s' % taskid]),
69+
resource_monitor=False,
70+
terminal_output='allatonce').run()
71+
return res.runtime.stdout.find(str(taskid)) > -1
72+
except RuntimeError as e:
73+
if 'Invalid job id' not in str(e):
74+
raise(e)
75+
return False
7276

7377
def _submit_batchtask(self, scriptfile, node):
7478
"""

0 commit comments

Comments
 (0)