|
6 | 6 |
|
7 | 7 | import os
|
8 | 8 | from time import sleep
|
9 |
| -import subprocess |
10 | 9 |
|
11 | 10 | from ...interfaces.base import CommandLine
|
12 | 11 | from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
|
@@ -46,13 +45,12 @@ def __init__(self, **kwargs):
|
46 | 45 | super(PBSPlugin, self).__init__(template, **kwargs)
|
47 | 46 |
|
48 | 47 | 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() |
54 | 52 | errmsg = 'Unknown Job Id' # %s' % taskid
|
55 |
| - return errmsg not in e |
| 53 | + return errmsg not in result.runtime.stderr |
56 | 54 |
|
57 | 55 | def _submit_batchtask(self, scriptfile, node):
|
58 | 56 | cmd = CommandLine('qsub', environ=dict(os.environ),
|
|
0 commit comments