diff --git a/oarstats.py b/oarstats.py index bc19599f8580ec658b41da32dec335bffa2ed21e..0f973aa5c414ec547ca03e5ba715ac2907ba7237 100755 --- a/oarstats.py +++ b/oarstats.py @@ -99,7 +99,7 @@ def main(): owners = {} resources_pattern = re.compile('R=([0-9]+)') - walltime_pattern = re.compile('W=([0-9]+:[0-9]+:[0-9]+)') + walltime_pattern = re.compile('W=([0-9]+(:[0-9]+(:[0-9]+)?)?)') queue_pattern = re.compile('Q=(\S+)') karma_pattern = re.compile('Karma=([0-9]+\.[0-9]+)') gpu_pattern = re.compile('gpu is not null', flags=re.IGNORECASE) @@ -107,6 +107,8 @@ def main(): if job_info["owner"] not in owners: owners[job_info["owner"]] = Owner(job_info["owner"]) elapsed_time = 0 if job_info["startTime"] == 0 else time.time() - job_info["startTime"] + if job_info["message"] == '': + continue tokens = re.search(walltime_pattern, job_info["message"]).group(1).split(':') wall_time = int(tokens[0]) * 3600 + int(tokens[1]) * 60 + int(tokens[2]) resources = int(re.search(resources_pattern, job_info["message"]).group(1))