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

chore: switch benchmark results branch #1041

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/benchmark-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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

##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 5 additions & 5 deletions ci/scripts/metric_unify/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -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:
Expand All @@ -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)
Expand All @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions ci/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down