Skip to content

Commit a092cde

Browse files
authored
Merge pull request #1987 from gjcooper/PBS_Type_fix
FIX: TypeError bug for PBS process communication in python3
2 parents 26e8c12 + e5daf5d commit a092cde

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

nipype/pipeline/plugins/pbs.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import os
88
from time import sleep
9-
import subprocess
109

1110
from ...interfaces.base import CommandLine
1211
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
@@ -46,13 +45,12 @@ def __init__(self, **kwargs):
4645
super(PBSPlugin, self).__init__(template, **kwargs)
4746

4847
def _is_pending(self, taskid):
49-
# subprocess.Popen requires taskid to be a string
50-
proc = subprocess.Popen(["qstat", str(taskid)],
51-
stdout=subprocess.PIPE,
52-
stderr=subprocess.PIPE)
53-
_, e = proc.communicate()
48+
result = CommandLine('qstat {}'.format(taskid),
49+
environ=dict(os.environ),
50+
terminal_output='allatonce',
51+
ignore_exception=True).run()
5452
errmsg = 'Unknown Job Id' # %s' % taskid
55-
return errmsg not in e
53+
return errmsg not in result.runtime.stderr
5654

5755
def _submit_batchtask(self, scriptfile, node):
5856
cmd = CommandLine('qsub', environ=dict(os.environ),

0 commit comments

Comments
 (0)