X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_tables.py;h=7f4071bef3a7f8786cb847e4868a428012fe3db0;hp=1071dee409d534dec80ef182384976a1f57bdc1e;hb=a7e064b331e539b3294c8c8208a4fab60c7144aa;hpb=3f2beec17f60c2c6b003c955e02451a77944197b diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 1071dee409..7f4071bef3 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -183,12 +183,13 @@ def table_performance_improvements(table, input_data): for build in data[job]: try: data_lst.append(float(build[tmpl_item[0]]["throughput"] - ["value"]) / 1000000) + ["value"])) except (KeyError, TypeError): # No data, ignore continue if data_lst: - tbl_item.append({"data": eval(operation)(data_lst)}) + tbl_item.append({"data": (eval(operation)(data_lst)) / + 1000000}) else: tbl_item.append({"data": None}) elif cmd == "operation": @@ -200,7 +201,7 @@ def table_performance_improvements(table, input_data): tbl_item.append({"data": eval(operation)(nr1, nr2)}) else: tbl_item.append({"data": None}) - except (IndexError, ValueError): + except (IndexError, ValueError, TypeError): logging.error("No data for {0}".format(tbl_item[1]["data"])) tbl_item.append({"data": None}) continue @@ -226,21 +227,23 @@ def table_performance_improvements(table, input_data): with open(file_name, "w") as file_handler: file_handler.write(",".join(header) + "\n") for item in tbl_lst: + if isinstance(item[-1]["data"], float): + rel_change = round(item[-1]["data"], 1) + else: + rel_change = item[-1]["data"] if "ndr_top" in file_name \ and "ndr" in item[1]["data"] \ - and item[-1]["data"] >= 10.0: + and rel_change >= 10.0: _write_line_to_file(file_handler, item) elif "pdr_top" in file_name \ and "pdr" in item[1]["data"] \ - and item[-1]["data"] >= 10.0: + and rel_change >= 10.0: _write_line_to_file(file_handler, item) elif "ndr_low" in file_name \ - and "ndr" in item[1]["data"] \ - and item[-1]["data"] < 10.0: + and "ndr" in item[1]["data"]: _write_line_to_file(file_handler, item) elif "pdr_low" in file_name \ - and "pdr" in item[1]["data"] \ - and item[-1]["data"] < 10.0: + and "pdr" in item[1]["data"]: _write_line_to_file(file_handler, item) logging.info(" Done.")