diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2023-06-12 12:31:46 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2023-06-12 12:31:46 +0200 |
commit | a8a49f244fabc7e3129537c30d668e82a268cac5 (patch) | |
tree | 64c1d73635f5c7ff49e5182df2e372474a888cc9 /bin/analyze-log.py | |
parent | 52ae52a3944f4897cf5b7e5924e4c78f03b2d6d8 (diff) |
analyze-log: add param-shift support; improve debug output
Diffstat (limited to 'bin/analyze-log.py')
-rwxr-xr-x | bin/analyze-log.py | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/bin/analyze-log.py b/bin/analyze-log.py index 476c6b9..81298d0 100755 --- a/bin/analyze-log.py +++ b/bin/analyze-log.py @@ -33,21 +33,28 @@ def parse_logfile(filename): observations = list() with open(filename, "r") as f: - for line in f: + for lineno, line in enumerate(f): m = re.search(r"\[::\] *([^|]*?) *[|] *([^|]*?) *[|] *(.*)", line) if m: name_str = m.group(1) param_str = m.group(2) attr_str = m.group(3) - param = dict(map(kv_to_param_i, param_str.split(" "))) - attr = dict(map(kv_to_param_f, attr_str.split(" "))) - observations.append( - { - "name": name_str, - "param": param, - "attribute": attr, - } - ) + try: + param = dict(map(kv_to_param_i, param_str.split(" "))) + attr = dict(map(kv_to_param_f, attr_str.split(" "))) + observations.append( + { + "name": name_str, + "param": param, + "attribute": attr, + } + ) + except ValueError: + print( + f"Error parsing {filename}: invalid key-value pair in line {lineno+1}" + ) + print(f"Offending entry:\n{line}") + raise return observations @@ -116,6 +123,11 @@ def main(): dfatool.utils.filter_aggregate_by_param(by_name, parameter_names, args.filter_param) + if args.param_shift: + param_shift = dfatool.cli.parse_param_shift(args.param_shift) + print(param_shift) + dfatool.utils.shift_param_in_aggregate(by_name, parameter_names, param_shift) + model = AnalyticModel( by_name, parameter_names, |