diff --git a/scripts/jantoran.py b/scripts/jantoran.py index df30f35..98dbc42 100755 --- a/scripts/jantoran.py +++ b/scripts/jantoran.py @@ -46,11 +46,16 @@ def extract_info(inf, s): with open(inf) as f: full = ''.join(f.readlines()) x = re.search(r'orig-server (\d+) (\d+) \d+', full) - s['current']['npkt'] = int(x.groups()[0]) - s['current']['interval'] = int(x.groups()[1]) + if x: + s['current']['npkt'] = int(x.groups()[0]) + s['current']['interval'] = int(x.groups()[1]) + return True + else: + print("read error for",inf) + return False def extract_folder(p, s): - extract_info(p + '/info.txt', s) + if not extract_info(p + '/info.txt', s): return False extract_measlat(p + '/log/client-measlat-stdout.log', s) compute_failure(s) @@ -70,8 +75,7 @@ def extract(p, s): print("extracting...") for folder in os.listdir(p): s['current'] = {} - extract_folder(p + '/' + folder, s) - categorize(folder, s) + extract_folder(p + '/' + folder, s) and categorize(folder, s) counter += 1 progress = round(counter / item_count * 100) print(f"{progress}%", end="\r")