Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
def compare_specjbb_results(spreadsheets, test_name, table_name=[]):
    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:
                if value[0][0] == ele[0][0]:
                    if value[1][0].split(".")[0] == ele[1][0].split(".")[0]:
                        results = combine_two_array_alternating(
                            results, value, ele)
                        break

            elif value[0][0] == "Cost/Hr":
                results += value
                break

            elif value[0][0] == ele[0][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_specjbb_data(spreadsheetId, test_name)

    print(f"https://docs.google.com/spreadsheets/d/{spreadsheetId}")

    return results