Skip to content

Commit 6dd7703

Browse files
authored
Merge pull request #2344 from achetverikov/pbs_plugin_fix
FIX: PBS plugin fix
2 parents ae3fd02 + eff7b43 commit 6dd7703

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.zenodo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,11 @@
568568
"affiliation": "University College London",
569569
"name": "Mancini, Matteo",
570570
"orcid": "0000-0001-7194-4568"
571+
},
572+
{
573+
"affiliation": "Donders Institute for Brain, Cognition and Behavior, Center for Cognitive Neuroimaging",
574+
"name": "Chetverikov, Andrey",
575+
"orcid": "0000-0003-2767-6310"
571576
}
572577
],
573578
"keywords": [

nipype/pipeline/plugins/pbs.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,20 @@ def __init__(self, **kwargs):
4949
super(PBSPlugin, self).__init__(template, **kwargs)
5050

5151
def _is_pending(self, taskid):
52-
result = CommandLine(
53-
'qstat {}'.format(taskid),
54-
environ=dict(os.environ),
55-
terminal_output='allatonce',
56-
resource_monitor=False,
57-
ignore_exception=True).run()
58-
errmsg = 'Unknown Job Id' # %s' % taskid
52+
result = CommandLine('qstat -f {}'.format(taskid),
53+
environ=dict(os.environ),
54+
terminal_output='file_split',
55+
resource_monitor=False,
56+
ignore_exception=True).run()
57+
58+
stdout = result.runtime.stdout
59+
stderr = result.runtime.stderr
60+
errmsg = 'Unknown Job Id'
5961
success = 'Job has finished'
60-
if success in e: # Fix for my PBS
62+
if (success in stderr) or ('job_state = C' in stdout):
6163
return False
6264
else:
63-
return errmsg not in e
65+
return errmsg not in stderr
6466

6567
def _submit_batchtask(self, scriptfile, node):
6668
cmd = CommandLine(

0 commit comments

Comments
 (0)