Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extract testcases #62

Merged
merged 11 commits into from
Jan 6, 2025
72 changes: 17 additions & 55 deletions quisby.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def data_handler(proc_list, noti_flag, exclude_list):
print(line, end="")

with open(results_path) as file:
summary_result = []
custom_logger.info("Reading data files path provided in file : " + results_path)
test_result_path = file.readlines()
flag = False
Expand All @@ -212,14 +211,9 @@ def data_handler(proc_list, noti_flag, exclude_list):
if "test " in data:
flag = False
if results:
summary_result = [[""],[test_name]]+summary_result
#TODO Check better way to add this information
append_to_sheet(spreadsheetid, summary_result, "summary")
spreadsheetid = process_results(results, test_name, cloud_type, os_type, os_release,
spreadsheet_name, spreadsheetid)
spreadsheetid = process_results(results, test_name, cloud_type, os_type, os_release, spreadsheet_name, spreadsheetid)
results = []
test_name = data.replace("test ", "").strip()
summary_result = []
source = "results"
if test_name in proc_list or proc_list == [] and test_name not in exclude_list:
flag = True
Expand All @@ -241,107 +235,77 @@ def data_handler(proc_list, noti_flag, exclude_list):
path = test_path + "/" + path.strip()
custom_logger.debug(path)
if test_name == "streams" and flag == True:
ret_val, summary_data = extract_streams_data(path, system_name, os_release)
ret_val = extract_streams_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "uperf" and flag == True:
ret_val, summary_data = extract_uperf_data(path, system_name)
ret_val = extract_uperf_data(path, system_name)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "linpack" and flag == True:
ret_val, summary_data = extract_linpack_data(path, system_name)
ret_val = extract_linpack_data(path, system_name)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "specjbb" and flag == True:
ret_value, summary_data = extract_specjbb_data(path, system_name, os_release)
ret_value = extract_specjbb_data(path, system_name, os_release)
if ret_value is not None:
results.append(ret_value)
if summary_data:
summary_result +=summary_data
elif test_name == "pig" and flag == True:
ret_val, summary_data = extract_pig_data(path, system_name, os_release)
ret_val = extract_pig_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif check_test_is_hammerdb(test_name) and flag == True:
ret_val, summary_data = extract_hammerdb_data(path, system_name, test_name, os_release)
ret_val = extract_hammerdb_data(path, system_name, test_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "fio_run" and flag == True:
ret_val = None
if source == "results":
ret_val, summary_data = extract_fio_run_data(path, system_name, os_release)
ret_val = extract_fio_run_data(path, system_name, os_release)
elif source == "pbench":
ret_val, summary_data = process_fio_run_result(path, system_name)
ret_val = process_fio_run_result(path, system_name)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "boot" and flag == True:
ret_val, summary_data = extract_boot_data(path, system_name)
ret_val = extract_boot_data(path, system_name)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "aim" and flag == True:
ret_val = extract_aim_data(path, system_name)
if ret_val:
results += ret_val
elif test_name == "auto_hpl" and flag == True:
ret_val, summary_data = extract_auto_hpl_data(path, system_name)
ret_val= extract_auto_hpl_data(path, system_name)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "speccpu" and flag == True:
ret_val, summary_data = extract_speccpu_data(path, system_name, os_release)
ret_val = extract_speccpu_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "etcd" and flag == True:
ret_val = extract_etcd_data(path, system_name)
if ret_val:
results += ret_val
elif test_name == "coremark" and flag == True:
ret_val, summary_data = extract_coremark_data(path, system_name, os_release)
ret_val = extract_coremark_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "coremark_pro" and flag == True:
ret_val, summary_data = extract_coremark_pro_data(path, system_name, os_release)
ret_val = extract_coremark_pro_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "passmark" and flag == True:
ret_val, summary_data = extract_passmark_data(path, system_name, os_release)
ret_val = extract_passmark_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result += summary_data
elif test_name == "pyperf" and flag == True:
ret_val, summary_data = extract_pyperf_data(path, system_name, os_release)
ret_val = extract_pyperf_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
elif test_name == "phoronix" and flag == True:
ret_val, summary_data= extract_phoronix_data(path, system_name, os_release)
ret_val= extract_phoronix_data(path, system_name, os_release)
if ret_val:
results += ret_val
if summary_data:
summary_result +=summary_data
else:
if flag == False:
pass
Expand All @@ -355,10 +319,8 @@ def data_handler(proc_list, noti_flag, exclude_list):
register_details_json(spreadsheet_name, spreadsheetid)
else:
try:
append_to_sheet(spreadsheetid, summary_result, "summary")
spreadsheetid = process_results(results, test_name, cloud_type, os_type, os_release, spreadsheet_name,
spreadsheetid)

except Exception as exc:
custom_logger.error(str(exc))
pass
Expand Down
39 changes: 22 additions & 17 deletions quisby/benchmarks/auto_hpl/comparison.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
from quisby.benchmarks.linpack.comparison import compare_linpack_results


def compare_auto_hpl_results(spreadsheets, spreadsheetId, test_name):
compare_linpack_results(spreadsheets, spreadsheetId, test_name)















def compare_auto_hpl_results(spreadsheets, spreadsheet_id, test_name):
"""
Compares AutoHPL results using Linpack benchmark data.

This function calls the `compare_linpack_results` function to compare
Linpack results for AutoHPL tests. It uses provided spreadsheets and test
details to perform the comparison.

Args:
spreadsheets (list): A list of spreadsheet data to compare.
spreadsheet_id (str): The ID of the spreadsheet containing the results.
test_name (str): The name of the test to compare.

Returns:
None
"""
try:
# Call the Linpack comparison function with the provided arguments
compare_linpack_results(spreadsheets, spreadsheet_id, test_name)
except Exception as e:
# Handle errors that may occur during comparison
raise RuntimeError(f"Error comparing AutoHPL results: {str(e)}")
86 changes: 60 additions & 26 deletions quisby/benchmarks/auto_hpl/extract.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,72 @@
import csv

from quisby.pricing import cloud_pricing
import logging
from typing import List, Dict, Optional
from pathlib import Path
from quisby.benchmarks.linpack.extract import linpack_format_data

from quisby.util import read_config

logger = logging.getLogger(__name__)


def extract_auto_hpl_data(
path: str,
system_name: str
) -> Optional[List[Dict[str, str]]]:
"""
Extract Auto HPL benchmark data from a CSV file.

Args:
path (str): Path to the CSV file
system_name (str): Name of the system being analyzed

Returns:
Optional[List[Dict[str, str]]]: Processed benchmark results or None

Raises:
FileNotFoundError: If the specified file does not exist
PermissionError: If there are insufficient permissions to read the file
ValueError: If the file format is incorrect
"""
# Validate input path
file_path = Path(path)

# Check file existence and extension
if not file_path.exists():
raise FileNotFoundError(f"File not found: {path}")
if file_path.suffix.lower() != '.csv':
raise ValueError(f"Invalid file type. Expected .csv, got {file_path.suffix}")


def extract_auto_hpl_data(path, system_name):
# Read file with proper error handling
with open(file_path, 'r', encoding='utf-8') as file:
file_data = file.readlines()

summary_data = []
server = read_config("server", "name")
result_dir = read_config("server", "result_dir")
# Check for minimum required data
if len(file_data) < 2:
logger.warning(f"Insufficient data in file: {path}")
return None

if path.endswith(".csv"):
with open(path) as file:
results = []
file_data = file.readlines()
summary_data.append([system_name, server + "/results/" + result_dir + "/" + path])

if len(file_data) > 1:
header_row = file_data[-2].strip().split(":")
data_row = file_data[-1].strip().split(":")
# Extract header and data rows
header_row = file_data[-2].strip().split(":")
data_row = file_data[-1].strip().split(":")

data_dict = {}
for key, value in zip(header_row, data_row):
data_dict[key] = value
# Validate data extraction
if len(header_row) != len(data_row):
raise ValueError("Mismatched header and data lengths")

results = linpack_format_data(
results=results, system_name=system_name, gflops=data_dict["Gflops"]
)
# Create dictionary from rows
data_dict = dict(zip(header_row, data_row))

if results:
return results, summary_data
# Validate required field
if 'Gflops' not in data_dict:
raise KeyError("Missing 'Gflops' in data")

else:
return None, None
# Process and format data
results: List[Dict[str, str]] = []
formatted_results = linpack_format_data(
results=results,
system_name=system_name,
gflops=data_dict["Gflops"]
)

return formatted_results if formatted_results else None
23 changes: 21 additions & 2 deletions quisby/benchmarks/auto_hpl/graph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
from quisby.benchmarks.linpack.graph import graph_linpack_data


def graph_auto_hpl_data(spreadsheetId, test_name, action):
return graph_linpack_data(spreadsheetId, test_name, action)
def graph_auto_hpl_data(spreadsheet_id, test_name, action):
"""
Graphs AutoHPL data based on the provided test results.

This function calls the `graph_linpack_data` function to generate graphs
for the AutoHPL test data based on the provided spreadsheet, test name,
and action to be performed.

Args:
spreadsheet_id (str): The ID of the spreadsheet containing the data.
test_name (str): The name of the test for which data is to be graphed.
action (str): The action to perform (e.g., "generate", "update", etc.) when graphing.

Returns:
Any: Returns the result of the `graph_linpack_data` function.
"""
try:
# Call the function to graph the Linpack data for AutoHPL
return graph_linpack_data(spreadsheet_id, test_name, action)
except Exception as e:
# Handle potential errors and raise with a descriptive message
raise RuntimeError(f"Error graphing AutoHPL data: {str(e)}")
22 changes: 20 additions & 2 deletions quisby/benchmarks/auto_hpl/summary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
from quisby.benchmarks.linpack.summary import create_summary_linpack_data


def create_summary_auto_hpl_data(results,OS_RELEASE):
return create_summary_linpack_data(results,OS_RELEASE)
def create_summary_auto_hpl_data(results, os_release):
"""
Creates a summary of AutoHPL test results.

This function calls `create_summary_linpack_data` to generate a summary of
the AutoHPL test results based on the provided data and OS release information.

Args:
results (list): The test results to be summarized.
os_release (str): The operating system release version used for the test.

Returns:
Any: Returns the summary data generated by `create_summary_linpack_data`.
"""
try:
# Call the function to create the summary for AutoHPL test results
return create_summary_linpack_data(results, os_release)
except Exception as e:
# Handle potential errors and raise with a descriptive message
raise RuntimeError(f"Error creating summary for AutoHPL data: {str(e)}")
Loading