From ccc6bf81aae0ff27cb31d24100cc5019f678b06a Mon Sep 17 00:00:00 2001 From: Yadong Ding Date: Sat, 6 May 2023 10:22:09 +0800 Subject: [PATCH 1/2] misc: fix benchmark on schedule without cache will panic Signed-off-by: Yadong Ding --- misc/benchmark/benchmark_summary.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/misc/benchmark/benchmark_summary.py b/misc/benchmark/benchmark_summary.py index da574ea5054..78d7f24dd39 100644 --- a/misc/benchmark/benchmark_summary.py +++ b/misc/benchmark/benchmark_summary.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import csv -import subprocess import os +import subprocess from argparse import ArgumentParser COMMANDS_BENCHMARK = [ @@ -72,10 +72,10 @@ def print_csv_compare(self): print_compare(item[0], item[1]) def print_csv_schedule(self): - print("| bench-result(current vs last) | pull(s) | create(s) | run(s) | total(s) | size(MB) | read-amount(MB) | read-count |") - print("|:------------------------------|:-------:|:---------:|:------:|:--------:|:--------:|:---------------:|:----------:|") data = [] if os.path.exists(BENCHMARK_CACHE): + print("| bench-result(current vs last) | pull(s) | create(s) | run(s) | total(s) | size(MB) | read-amount(MB) | read-count |") + print("|:------------------------------|:-------:|:---------:|:------:|:--------:|:--------:|:---------------:|:----------:|") with open(BENCHMARK_CACHE, "r", newline='') as f: reader = csv.reader(f, delimiter='|') next(reader) # head @@ -83,11 +83,13 @@ def print_csv_schedule(self): next(reader) # oci for row in reader: data.append(row[2:-1]) - for index, file in enumerate(FILE_LIST): - if(file == "oci.csv") or index > len(data): - print_schedule(file) - else: - print_schedule(file, data[index-1]) + for index, file in enumerate(FILE_LIST): + if (file == "oci.csv"): + print_schedule(file) + else: + print_schedule(file, data[index-1]) + else: + self.print_csv_result() self.save_cache() def prepare_csv(self): From e518e0b7aba858890a398e97d04b5c0438765293 Mon Sep 17 00:00:00 2001 From: Yadong Ding Date: Sat, 6 May 2023 10:44:18 +0800 Subject: [PATCH 2/2] action: benchmark will be triggered by pr Signed-off-by: Yadong Ding --- .github/workflows/benchmark.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 24af26014ef..9d42d15c107 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,6 +4,10 @@ on: schedule: # Run at 03:00 clock UTC on Monday and Wednesday - cron: "0 03 * * 1,3" + pull_request: + paths: + - '.github/workflows/benchmark.yml' + - 'misc/benchmark/*' workflow_dispatch: env: