X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_tables.py;h=afd8390c919653be2e13410b5a9f23605c7d4c44;hp=7f4071bef3a7f8786cb847e4868a428012fe3db0;hb=2b8547bc50fd06ea936f096794b8c2a5e09c5f8b;hpb=a7e064b331e539b3294c8c8208a4fab60c7144aa diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 7f4071bef3..afd8390c91 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -108,6 +108,66 @@ def table_details(table, input_data): logging.info(" Done.") +def table_merged_details(table, input_data): + """Generate the table(s) with algorithm: table_merged_details + specified in the specification file. + + :param table: Table to generate. + :param input_data: Data to process. + :type table: pandas.Series + :type input_data: InputData + """ + + logging.info(" Generating the table {0} ...". + format(table.get("title", ""))) + + # Transform the data + data = input_data.filter_data(table) + data = input_data.merge_data(data) + + suites = input_data.filter_data(table, data_set="suites") + suites = input_data.merge_data(suites) + + # Prepare the header of the tables + header = list() + for column in table["columns"]: + header.append('"{0}"'.format(str(column["title"]).replace('"', '""'))) + + for _, suite in suites.iteritems(): + # Generate data + suite_name = suite["name"] + table_lst = list() + for test in data.keys(): + if data[test]["parent"] in suite_name: + row_lst = list() + for column in table["columns"]: + try: + col_data = str(data[test][column["data"]. + split(" ")[1]]).replace('"', '""') + if column["data"].split(" ")[1] in ("vat-history", + "show-run"): + col_data = replace(col_data, " |br| ", "", + maxreplace=1) + col_data = " |prein| {0} |preout| ".\ + format(col_data[:-5]) + row_lst.append('"{0}"'.format(col_data)) + except KeyError: + row_lst.append("No data") + table_lst.append(row_lst) + + # Write the data to file + if table_lst: + file_name = "{0}_{1}{2}".format(table["output-file"], suite_name, + table["output-file-ext"]) + logging.info(" Writing file: '{}'".format(file_name)) + with open(file_name, "w") as file_handler: + file_handler.write(",".join(header) + "\n") + for item in table_lst: + file_handler.write(",".join(item) + "\n") + + logging.info(" Done.") + + def table_performance_improvements(table, input_data): """Generate the table(s) with algorithm: table_performance_improvements specified in the specification file. @@ -177,16 +237,17 @@ def table_performance_improvements(table, input_data): val = tmpl_item[int(args[0])] tbl_item.append({"data": val}) elif cmd == "data": - job = args[0] - operation = args[1] + jobs = args[0:-1] + operation = args[-1] data_lst = list() - for build in data[job]: - try: - data_lst.append(float(build[tmpl_item[0]]["throughput"] - ["value"])) - except (KeyError, TypeError): - # No data, ignore - continue + for job in jobs: + for build in data[job]: + try: + data_lst.append(float(build[tmpl_item[0]] + ["throughput"]["value"])) + except (KeyError, TypeError): + # No data, ignore + continue if data_lst: tbl_item.append({"data": (eval(operation)(data_lst)) / 1000000}) @@ -240,10 +301,12 @@ def table_performance_improvements(table, input_data): 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 "ndr" in item[1]["data"] \ + and rel_change < 10.0: _write_line_to_file(file_handler, item) elif "pdr_low" in file_name \ - and "pdr" in item[1]["data"]: + and "pdr" in item[1]["data"] \ + and rel_change < 10.0: _write_line_to_file(file_handler, item) logging.info(" Done.")