in pbspro/src/pbspro/pbscmd.py [0:0]
def qstat_json(self, *args: str) -> Dict:
if "-F" not in args:
args = ("-F", "json") + args
response = self.qstat(*args)
# For some reason both json and regular format are printed...
expr = response
# fix invalid json output like the following
# "pset":"group_id=""",
expr = expr.replace('"""', '"')
attempts = 1000
while "{" in expr and attempts > 0:
attempts -= 1
expr = expr[expr.index("{") :]
try:
return json.loads(expr)
except JSONDecodeError as e:
logging.error(e)
raise RuntimeError("Could not parse qstat json output: '{}'".format(response))