def compare_pig_results(spreadsheets): spreadsheet_name = [] values = [] results = [] test_name = "pig" for spreadsheetId in spreadsheets: values.append(read_sheet(spreadsheetId, range=test_name)) spreadsheet_name.append( get_sheet(spreadsheetId, range=[])["properties"]["title"] ) spreadsheet_name = " vs ".join(spreadsheet_name) for index, value in enumerate(values): values[index] = (list(g) for k, g in groupby(value, key=lambda x: x != []) if k) for value, ele in zip(values[0], values[1]): results.append([""]) if value[0] == ele[0]: results.append(value[0]) results = combine_two_array_alternating(results, value[1:], ele[1:]) spreadsheetId = create_spreadsheet(spreadsheet_name, test_name) append_to_sheet(spreadsheetId, results, test_name) graph_pig_data(spreadsheetId, test_name) print(f"https://docs.google.com/spreadsheets/d/{spreadsheetId}") return results
def compare_hammerdb_results(spreadsheets, test_name): spreadsheet_name = [] values = [] results = [] for spreadsheetId in spreadsheets: values.append(read_sheet(spreadsheetId, range=test_name)) spreadsheet_name.append( get_sheet(spreadsheetId, range=[])["properties"]["title"]) spreadsheet_name = " vs ".join(spreadsheet_name) for index, value in enumerate(values): values[index] = (list(g) for k, g in groupby(value, key=lambda x: x != []) if k) for value, ele in zip(values[0], values[1]): results.append([""]) # Make sure it's same system family # TODO: Maybe check for whole type instead of family if value[0][1].split(".")[0] == ele[0][1].split(".")[0]: results = combine_two_array_alternating(results, value, ele) spreadsheetId = create_spreadsheet(spreadsheet_name, test_name) append_to_sheet(spreadsheetId, results, test_name) graph_hammerdb_data(spreadsheetId, test_name) print(f"https://docs.google.com/spreadsheets/d/{spreadsheetId}") return results
def process_results(results): """""" global test_name spreadsheet_name = f"{config.cloud_type} {config.OS_TYPE}-{config.OS_RELEASE}" if results: if check_test_is_hammerdb(test_name): results = create_summary_hammerdb_data(results) else: results = globals()[f"create_summary_{test_name}_data"](results) if not config.spreadsheetId: config.spreadsheetId = create_spreadsheet(spreadsheet_name, test_name) create_sheet(config.spreadsheetId, test_name) append_to_sheet(config.spreadsheetId, results, test_name) # Graphing up data if check_test_is_hammerdb(test_name): graph_hammerdb_data(config.spreadsheetId, test_name) else: globals()[f"graph_{test_name}_data"](config.spreadsheetId, test_name) return []
def compare_linpack_results(spreadsheets): values = [] results = [] test_name = "linpack_8.2-8.3" for spreadsheetId in spreadsheets: values.append(read_sheet(spreadsheetId, range="linpack")) for v in values[0]: if v[0] == "System": results.append([ "System", "GFLOPS - 8.2", "GFLOPS - 8.3", "% Diff", "GFLOP Scaling - 8.2", "GFLOP Scaling - 8.3", "Cost / hr", "Price/Perf - 8.2", "Price/Perf - 8.3", "Price/Perf % Diff", ]) for y in values[1]: if y[0] == "System": continue if v[0] in y[0]: price_perf = [] perc_diff = (float(y[1]) - float(v[1])) / float(v[1]) price_perf.append(float(v[1]) / float(v[3])) price_perf.append(float(y[1]) / float(y[3])) price_perf_diff = (float(price_perf[1]) - float(price_perf[0])) / float(price_perf[0]) results.append([ v[0], v[1], y[1], perc_diff, v[2], y[2], v[3], price_perf[0], price_perf[1], price_perf_diff, ]) spreadsheetId = create_spreadsheet("Comparison 8.2 vs 8.3", test_name) append_to_sheet(spreadsheetId, results, range=test_name) graph_linpack_comparison(spreadsheetId, range=test_name) print(f"https://docs.google.com/spreadsheets/d/{spreadsheetId}")
def compare_stream_results(spreadsheets, test_name, table_name=["Max Througput"]): values = [] results = [] spreadsheet_name = [] for spreadsheetId in spreadsheets: values.append(read_sheet(spreadsheetId, range=test_name)) spreadsheet_name.append( get_sheet(spreadsheetId, range=[])["properties"]["title"]) spreadsheet_name = " vs ".join(spreadsheet_name) for index, value in enumerate(values): values[index] = (list(g) for k, g in groupby(value, key=lambda x: x != []) if k) list_1 = list(values[0]) list_2 = list(values[1]) for value in list_1: results.append([""]) for ele in list_2: if value[0][0] in table_name and ele[0][0] in table_name: results = combine_two_array_alternating(results, value, ele) break elif value[1][0] == ele[1][0]: results.append(value[0]) results = combine_two_array_alternating( results, value[1:], ele[1:]) break spreadsheetId = create_spreadsheet(spreadsheet_name, test_name) append_to_sheet(spreadsheetId, results, test_name) graph_stream_data(spreadsheetId, test_name) print(f"https://docs.google.com/spreadsheets/d/{spreadsheetId}") return results
def graph_linpack_comparison(spreadsheetId, range="A:F"): """ Re-arrange data from the sheet into a dict grouped by machine name. The sheet data & charts are then cleared excluding the header row. The function then processes loops over each groups of machine and plots the graphs. Graphs: - GFLOP and GFLOPS scaling - Price/perf :sheet: sheet API function :spreadsheetId :range: range to graph up the data, it will be mostly sheet name """ GFLOPS_PLOT_RANGE = "B" PRICE_PER_PERF_RANGE = "H" GRAPH_COL_INDEX = 5 GRAPH_ROW_INDEX = 0 data_dict = rearrange_linpack_data(spreadsheetId, range) header_row = data_dict[0][0] if data_dict: clear_sheet_data(spreadsheetId, range) clear_sheet_charts(spreadsheetId, range) else: raise Exception("Data sheet empty") for data in data_dict: machine_class = data[0][1].split(".")[0] response = append_to_sheet(spreadsheetId, data, range) updated_range = response["updates"]["updatedRange"] title, sheet_range = updated_range.split("!") sheet_range = sheet_range.split(":") # apply_named_range(sheet, spreadsheetId, machine_class, updated_range) sheetId = get_sheet( spreadsheetId, updated_range)["sheets"][0]["properties"]["sheetId"] # GFlops & GFlops scaling graph requests = { "addChart": { "chart": { "spec": { "title": "%s : %s and %s" % (title, header_row[1], header_row[2]), "basicChart": { "chartType": "COMBO", "legendPosition": "BOTTOM_LEGEND", "axis": [ { "position": "BOTTOM_AXIS", "title": "%s" % (header_row[0]), }, { "position": "LEFT_AXIS", "title": "%s, %s and %s, %s " % ( header_row[1], header_row[2], header_row[4], header_row[5], ), }, ], "domains": [{ "domain": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": 0, "endColumnIndex": 1, }] } } }], "series": [ { "series": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65, "endColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 1, }] } }, "targetAxis": "LEFT_AXIS", "type": "COLUMN", }, { "series": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 1, "endColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 2, }] } }, "targetAxis": "LEFT_AXIS", "type": "COLUMN", }, { "series": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 3, "endColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 4, }] } }, "targetAxis": "RIGHT_AXIS", "type": "LINE", }, { "series": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 4, "endColumnIndex": ord(GFLOPS_PLOT_RANGE) % 65 + 5, }] } }, "targetAxis": "RIGHT_AXIS", "type": "LINE", }, ], "headerCount": 1, }, }, "position": { "overlayPosition": { "anchorCell": { "sheetId": sheetId, "rowIndex": GRAPH_ROW_INDEX, "columnIndex": ord(sheet_range[1][:1]) % 65 + 2, } } }, } } } # PRICE/PERF graph body = {"requests": requests} sheet.batchUpdate(spreadsheetId=spreadsheetId, body=body).execute() requests = { "addChart": { "chart": { "spec": { "title": "%s : Price/Perf " % (title), "basicChart": { "chartType": "COLUMN", "legendPosition": "BOTTOM_LEGEND", "axis": [ { "position": "BOTTOM_AXIS", "title": "%s" % (header_row[0]), }, { "position": "LEFT_AXIS", "title": "GFlops/$/hr " }, ], "domains": [{ "domain": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": 0, "endColumnIndex": 1, }] } } }], "series": [ { "series": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": ord(PRICE_PER_PERF_RANGE) % 65, "endColumnIndex": ord(PRICE_PER_PERF_RANGE) % 65 + 1, }] } }, "targetAxis": "LEFT_AXIS", "type": "COLUMN", }, { "series": { "sourceRange": { "sources": [{ "sheetId": sheetId, "startRowIndex": int(sheet_range[0][1:]) - 1, "endRowIndex": sheet_range[1][1:], "startColumnIndex": ord(PRICE_PER_PERF_RANGE) % 65 + 1, "endColumnIndex": ord(PRICE_PER_PERF_RANGE) % 65 + 2, }] } }, "targetAxis": "LEFT_AXIS", "type": "COLUMN", }, ], "headerCount": 1, }, }, "position": { "overlayPosition": { "anchorCell": { "sheetId": sheetId, "rowIndex": GRAPH_ROW_INDEX, "columnIndex": ord(sheet_range[1][:1]) % 65 + 8, } } }, } } } body = {"requests": requests} sheet.batchUpdate(spreadsheetId=spreadsheetId, body=body).execute() GRAPH_ROW_INDEX += 20