From 7646803de4827963b8e748c58da558a88c6140b0 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:12:11 -0500 Subject: [PATCH] chore: switch benchmark results branch (#1041) * chore: switch benchmark results branch `gh-pages` -> `benchmark-results` * fix: more renamings --- .github/workflows/benchmark-call.yml | 30 ++++++++++++++-------------- .github/workflows/benchmarks.yml | 22 ++++++++++---------- README.md | 2 +- ci/scripts/metric_unify/summarize.py | 10 +++++----- ci/scripts/utils.sh | 8 ++++---- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/benchmark-call.yml b/.github/workflows/benchmark-call.yml index 436b00bdec..7d5fc12cb0 100644 --- a/.github/workflows/benchmark-call.yml +++ b/.github/workflows/benchmark-call.yml @@ -261,11 +261,11 @@ jobs: fi ########################################################################## - # Update gh-pages with individual results # + # Update benchmark-results with individual results # ########################################################################## - uses: actions/checkout@v4 with: - ref: gh-pages + ref: benchmark-results - name: Set up git run: | @@ -274,28 +274,28 @@ jobs: - name: Set github pages path for dispatch run: | - GH_PAGES_PATH="benchmarks-dispatch/${{ github.head_ref || github.ref }}" - echo "GH_PAGES_PATH=${GH_PAGES_PATH}" >> $GITHUB_ENV + BENCHMARK_RESULTS_PATH="benchmarks-dispatch/${{ github.head_ref || github.ref }}" + echo "BENCHMARK_RESULTS_PATH=${BENCHMARK_RESULTS_PATH}" >> $GITHUB_ENV - name: Set github pages path for PR if: github.event_name == 'pull_request' run: | - GH_PAGES_PATH="benchmarks-pr/${{ github.event.pull_request.number }}/individual" - echo "GH_PAGES_PATH=${GH_PAGES_PATH}" >> $GITHUB_ENV + BENCHMARK_RESULTS_PATH="benchmarks-pr/${{ github.event.pull_request.number }}/individual" + echo "BENCHMARK_RESULTS_PATH=${BENCHMARK_RESULTS_PATH}" >> $GITHUB_ENV - name: Set github pages path for push if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | - GH_PAGES_PATH="benchmarks/individual" - echo "GH_PAGES_PATH=${GH_PAGES_PATH}" >> $GITHUB_ENV + BENCHMARK_RESULTS_PATH="benchmarks/individual" + echo "BENCHMARK_RESULTS_PATH=${BENCHMARK_RESULTS_PATH}" >> $GITHUB_ENV - name: Update PR github pages with new bench results run: | - mkdir -p ${GH_PAGES_PATH} + mkdir -p ${BENCHMARK_RESULTS_PATH} s3_md_file="${METRIC_NAME}-${current_sha}.md" - s5cmd cp "${{ env.S3_PATH }}/${s3_md_file}" ${GH_PAGES_PATH}/${s3_md_file} - git add ${GH_PAGES_PATH}/${s3_md_file} - git commit --allow-empty -m "Update benchmark result at ${GH_PAGES_PATH}/${s3_md_file}" + s5cmd cp "${{ env.S3_PATH }}/${s3_md_file}" ${BENCHMARK_RESULTS_PATH}/${s3_md_file} + git add ${BENCHMARK_RESULTS_PATH}/${s3_md_file} + git commit --allow-empty -m "Update benchmark result at ${BENCHMARK_RESULTS_PATH}/${s3_md_file}" MAX_RETRIES=10 RETRY_DELAY=5 @@ -304,9 +304,9 @@ jobs: while [ $ATTEMPT -lt $MAX_RETRIES ]; do echo "Attempt $((ATTEMPT + 1)) to push of $MAX_RETRIES..." - git fetch origin gh-pages - git merge origin/gh-pages --no-edit - if git push origin gh-pages; then + git fetch origin benchmark-results + git merge origin/benchmark-results --no-edit + if git push origin benchmark-results; then SUCCESS=true break else diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 547f793f11..e88ff179d6 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -138,14 +138,14 @@ jobs: - name: Set github pages path for PR if: github.event_name == 'pull_request' run: | - GH_PAGES_PATH="benchmarks-pr/${{ github.event.pull_request.number }}" - echo "GH_PAGES_PATH=${GH_PAGES_PATH}" >> $GITHUB_ENV + BENCHMARK_RESULTS_PATH="benchmarks-pr/${{ github.event.pull_request.number }}" + echo "BENCHMARK_RESULTS_PATH=${BENCHMARK_RESULTS_PATH}" >> $GITHUB_ENV - name: Set github pages path for push if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | - GH_PAGES_PATH="benchmarks" - echo "GH_PAGES_PATH=${GH_PAGES_PATH}" >> $GITHUB_ENV + BENCHMARK_RESULTS_PATH="benchmarks" + echo "BENCHMARK_RESULTS_PATH=${BENCHMARK_RESULTS_PATH}" >> $GITHUB_ENV - name: Load all metadata files from S3 run: | @@ -189,7 +189,7 @@ jobs: python3 ci/scripts/metric_unify/summarize.py "${md_file_list}" \ --e2e-md-files "${E2E_FILE_LIST}" \ --aggregation-json ci/scripts/metric_unify/aggregation.json \ - --gh-pages-link "https://github.com/${{ github.repository }}/blob/gh-pages/${GH_PAGES_PATH}" + --benchmark-results-link "https://github.com/${{ github.repository }}/blob/benchmark-results/${BENCHMARK_RESULTS_PATH}" echo "" >> summary.md echo "Commit: https://github.com/${{ github.repository }}/commit/${CURRENT_SHA}" >> summary.md @@ -199,12 +199,12 @@ jobs: cp summary.md /tmp/benchmark-results/ ########################################################################## - # Update gh-pages with summary upon a PR event # + # Update benchmark-results with summary upon a PR event # ########################################################################## - uses: actions/checkout@v4 if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') with: - ref: gh-pages + ref: benchmark-results - name: Set up git if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') @@ -215,14 +215,14 @@ jobs: - name: Update github pages with new bench results if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') run: | - mkdir -p ${GH_PAGES_PATH} - cp /tmp/benchmark-results/summary.md ${GH_PAGES_PATH}/summary.md - git add ${GH_PAGES_PATH}/summary.md + mkdir -p ${BENCHMARK_RESULTS_PATH} + cp /tmp/benchmark-results/summary.md ${BENCHMARK_RESULTS_PATH}/summary.md + git add ${BENCHMARK_RESULTS_PATH}/summary.md if [[ "${{ github.event_name }}" == "push" ]]; then cp /tmp/benchmark-results/summary.md index.md git add index.md fi - git commit --allow-empty -m "Update summarized benchmark result at ${GH_PAGES_PATH}/summary.md" + git commit --allow-empty -m "Update summarized benchmark result at ${BENCHMARK_RESULTS_PATH}/summary.md" git push --force ########################################################################## diff --git a/README.md b/README.md index 02d5f3433e..815ba4898a 100644 --- a/README.md +++ b/README.md @@ -45,5 +45,5 @@ The flamegraphs will be written to `*.svg` files in `.bench_metrics/flamegraphs` ### Latest Benchmark Results -Latest benchmark results can be found [here](https://github.com/axiom-crypto/afs-prototype/blob/gh-pages/index.md). +Latest benchmark results can be found [here](https://github.com/axiom-crypto/afs-prototype/blob/benchmark-results/index.md). These are run via [github workflows](./.github/workflows/benchmark-call.yml) and should always be up to date with the latest `main` branch. diff --git a/ci/scripts/metric_unify/summarize.py b/ci/scripts/metric_unify/summarize.py index 39f7def71e..c0040c36fd 100644 --- a/ci/scripts/metric_unify/summarize.py +++ b/ci/scripts/metric_unify/summarize.py @@ -100,7 +100,7 @@ def read_first_markdown_table(md_file): return table, other_info # group stats (ex. app, agg, root) are either added to the row as is, or aggregated together -def generate_row(md_file, sections, aggregation_groups, gh_pages_link): +def generate_row(md_file, sections, aggregation_groups, benchmark_results_link): table, other_info = read_first_markdown_table(md_file) sections = [table[0].group] + sections section_by_group = {}; @@ -116,7 +116,7 @@ def generate_row(md_file, sections, aggregation_groups, gh_pages_link): section_by_group[group_name] = row break - res = [f"[ {table[0].group} ]({gh_pages_link}/individual/{md_file})"] + res = [f"[ {table[0].group} ]({benchmark_results_link}/individual/{md_file})"] for section in sections: group_row = section_by_group.get(section) if group_row is None: @@ -142,7 +142,7 @@ def main(): argparser.add_argument('metrics_md_files', type=str, help="Comma separated list of metrics markdown file names") argparser.add_argument('--e2e-md-files', type=str, required=False, help="Comma separated list of e2e metrics markdown file names") argparser.add_argument('--aggregation-json', type=str, required=True, help="Path to a JSON file with metrics to aggregate") - argparser.add_argument('--gh-pages-link', type=str, required=True, help="Link to this PR's gh-pages directory") + argparser.add_argument('--benchmark-results-link', type=str, required=True, help="Link to this PR's benchmark-results directory") args = argparser.parse_args() aggregations = read_aggregations(args.aggregation_json) @@ -154,14 +154,14 @@ def main(): md_files = args.metrics_md_files.split(',') outputs = [] for md_file in md_files: - outputs.append(generate_row(md_file, ["leaf"], {}, args.gh_pages_link)) + outputs.append(generate_row(md_file, ["leaf"], {}, args.benchmark_results_link)) write_md_table(outputs, "Benchmarks", headers, rewrite=True) if args.e2e_md_files and args.e2e_md_files.strip(): outputs = [] md_files = args.e2e_md_files.split(',') for md_file in md_files: - outputs.append(generate_row(md_file, ["root", "leaf", "internal"], {"internal.*": "internal"}, args.gh_pages_link)) + outputs.append(generate_row(md_file, ["root", "leaf", "internal"], {"internal.*": "internal"}, args.benchmark_results_link)) if outputs: write_md_table(outputs, "E2E Benchmarks", e2e_headers) diff --git a/ci/scripts/utils.sh b/ci/scripts/utils.sh index 29bd3d60d4..7c45813bb8 100644 --- a/ci/scripts/utils.sh +++ b/ci/scripts/utils.sh @@ -54,7 +54,7 @@ add_metadata() { echo "[Benchmark Workflow](https://github.com/${repo}/actions/runs/${run_id})" >> $result_path } -commit_and_push_gh_pages() { +commit_and_push_benchmark_results() { local files=$1 local commit_message=$2 git add ${files} @@ -67,9 +67,9 @@ commit_and_push_gh_pages() { while [ $ATTEMPT -lt $MAX_RETRIES ]; do echo "Attempt $((ATTEMPT + 1)) to push of $MAX_RETRIES..." - git fetch origin gh-pages - git merge origin/gh-pages --no-edit - if git push origin gh-pages; then + git fetch origin benchmark-results + git merge origin/benchmark-results --no-edit + if git push origin benchmark-results; then SUCCESS=true break else