11#! /usr/bin/env bash
2- set -euo pipefail
2+ # set -euo pipefail
33
4- : " ${REPO_URL:? Need to set REPO_URL} "
54: " ${COMMIT_SHA:? Need to set COMMIT_SHA} "
5+ : " ${ASV_ARGS:? Need to set ASV_ARGS} "
66: " ${ASV_CONF_PATH:? Need to set ASV_CONF_PATH} "
7- : " ${BENCH:- } "
8-
9- # Optional: which physical core was this container pinned to?
10- : " ${CPU_CORE:- } "
117
128# 0) Hook in micromamba and activate `base`
139eval " $( micromamba shell hook --shell=bash) "
@@ -16,15 +12,35 @@ micromamba activate base
1612# 0.5) Tune the container so all CPUs stay at fixed frequency.
1713# This requires root; Docker runs as root by default.
1814# python -m pyperf system tune || true
19-
20- # 1) Clone & checkout the desired commit
21- git clone " $REPO_URL " repo
22- cd repo
23- # git checkout "$COMMIT_SHA" # Uncomment if detached commits are required
15+ git checkout --quiet " ${COMMIT_SHA} "
2416
2517# 2) cd into the folder containing the asv.conf.json
2618cd " $( dirname " $ASV_CONF_PATH " ) "
2719
20+ # asv run "$COMMIT_SHA^!" \
21+ # --show-stderr \
22+ # ${BENCH_REGEX:+--bench "$BENCH_REGEX"} \
23+ # ${INTERLEAVE_ROUNDS:+--interleave-rounds} \
24+ # ${APPEND_SAMPLES:+--append-samples --record-samples} \
25+ # -a rounds=$ROUNDS \
26+ # -a number=$NUMBER \
27+ # -a repeat=$REPEAT \
28+ # ${CPU_CORE:+-a cpu_affinity=[$CPU_CORE]} \
29+ # | tee "$OUTPUT_DIR/benchmark_${COMMIT_SHA}.log"
30+
31+ # change the "results_dir" in asv.conf.json to "/output/{COMMIT_SHA}/"
32+ # using python
33+ python -c " import asv, os, pathlib
34+ path = pathlib.Path('/output/'\" $COMMIT_SHA \" '/')
35+ path.mkdir(parents=True, exist_ok=True)
36+
37+ config = asv.config.Config.load('asv.conf.json')
38+ config.results_dir = str(path / 'results')
39+ config.html_dir = str(path / 'html')
40+
41+ asv.util.write_json('asv.conf.json', config.__dict__, api_version=1)
42+ "
43+
2844# Read the python versions from the asv.conf.json (without jq)
2945python_versions=$( python -c " import asv; pythons = asv.config.Config.load('asv.conf.json').pythons; print(' '.join(pythons))" )
3046for version in $python_versions ; do
@@ -36,15 +52,8 @@ for version in $python_versions; do
3652 mamba \
3753 conda
3854 micromamba run -n " asv_${version} " pip install asv
39-
40- # Build common flag list
41- mkdir -p " /output/${COMMIT_SHA} /${version} "
42- extra=( --commit-sha " $COMMIT_SHA " --output-dir " /output/${COMMIT_SHA} /${version} " )
43- [[ -n " ${BENCH:- } " ]] && extra+=( --bench " $BENCH " )
44- [[ -n " ${CPU_CORE:- } " ]] && extra+=( --cpu-affinity " $CPU_CORE " )
45-
46- # Always request interleaved rounds & sample appending (tuning done in script)
47- micromamba run -n " asv_${version} " python /run_asv.py " ${extra[@]} "
55+ micromamba run asv machine --yes
56+ micromamba run asv run --show-stderr " $COMMIT_SHA ^!" ${ASV_ARGS}
4857done
4958
50- echo " Benchmarks complete. Logs → /output/benchmark_ ${COMMIT_SHA} .log "
59+ echo " Benchmarks complete."
0 commit comments