From c0d4a64dd31f4170e6fe10fd89113b9bdaa9f8dc Mon Sep 17 00:00:00 2001 From: Aki Abramowski Date: Mon, 22 Apr 2024 16:31:20 +0200 Subject: [PATCH] fix result rewriter Signed-off-by: Aki Abramowski --- .github/workflows/benchmark.yml | 4 ++-- benchmark/result_rewriter.py | 39 +++++---------------------------- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index c478529676..12aae8bddc 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,7 +1,7 @@ name: Benchmark on: - schedule: - - cron: "*/30 * * * *" + #schedule: + # - cron: "*/30 * * * *" workflow_dispatch: pull_request: branches: diff --git a/benchmark/result_rewriter.py b/benchmark/result_rewriter.py index 37159801d9..f2c5d6742f 100644 --- a/benchmark/result_rewriter.py +++ b/benchmark/result_rewriter.py @@ -12,54 +12,27 @@ def create_entry(name, value, unit): return entry -def read_metric(metric): - task = metric.get("task") - throughput = metric.get("throughput") - latency = metric.get("latency") - service_time = metric.get("service_time") - client_processing_time = metric.get("client_processing_time") - processing_time = metric.get("processing_time") - error_rate = metric.get("error_rate") - return [ - create_entry(f"{task} throughput mean", 1 % throughput.get("mean"), "s/ops"), - create_entry(f"{task} latency mean", latency.get("mean"), "ms"), - create_entry(f"{task} error rate", error_rate * 100, "%") - ] - - -def rewrite_results(src_file): - try: - result = [] - with open(src_file, 'r') as f: - src = json.load(f) - results = src.get("results") - metrics = results.get("op_metrics") - for metric in metrics: - result.extend(read_metric(metric)) - return result - except Exception as e: - print(f"Failed to rewrite benchmark results: {e}") - sys.exit(1) - - def rewrite_csv(src_file): try: result = [] - with open(src_file, 'r', newline='') as f: - reader = csv.reader(f) + with open(src_file, 'r', newline='') as file: + reader = csv.reader(file) next(reader) for row in reader: if row[1] == "" or row[1] is None: continue else: name = f"{row[0]} {row[1]}" - if name.startswith("Min") or name.startswith("Max") or name.startswith("Median"): + if name.startswith("Min") or name.startswith("Max") or name.startswith("Median") or not name.startswith("50th"): continue unit = row[3] value = float(row[2]) if unit == "ops/s": value = 1 / value unit = "s/ops" + elif unit == "docs/s": + value = 1 / value + unit = "s/docs" entry = create_entry(name, value, unit) result.append(entry) return result