Skip to content

Commit 67c9f50

Browse files
committed
updating docker orchestrator with working code
1 parent 48959f2 commit 67c9f50

4 files changed

Lines changed: 169 additions & 531 deletions

File tree

docker/Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
# 1) Start from Ubuntu 22.04 with full build tools
21
FROM buildpack-deps:jammy
32

4-
# 2) Install micromamba (standalone binary)
3+
ARG REPO_URL
4+
55
RUN curl -Ls "https://micromamba.snakepit.net/api/micromamba/linux-64/latest" \
66
| tar -xvj -C /usr/local/bin --strip-components=1 bin/micromamba
77

8-
# 3) Configure micromamba
98
ENV MAMBA_ROOT_PREFIX=/opt/conda \
109
PATH=/opt/conda/bin:$PATH \
1110
MAMBA_DOCKERFILE_ACTIVATE=1 \
12-
# Force single‑threaded math inside every container
1311
OPENBLAS_NUM_THREADS=1 \
1412
MKL_NUM_THREADS=1 \
1513
OMP_NUM_THREADS=1
1614

17-
# 4) Bootstrap Python/ASV/pyperf stack
1815
RUN micromamba install -y -p $MAMBA_ROOT_PREFIX -c conda-forge \
1916
python=3.10 \
2017
git \
@@ -25,14 +22,13 @@ RUN micromamba install -y -p $MAMBA_ROOT_PREFIX -c conda-forge \
2522
conda \
2623
&& micromamba clean --all --yes
2724

28-
# 5) Create workspace/output
2925
RUN mkdir /workspace /output
30-
3126
WORKDIR /workspace
3227

33-
# 6) Copy and make executable the entrypoint
3428
COPY entrypoint.sh /entrypoint.sh
3529
COPY run_asv.py /run_asv.py
3630
RUN chmod +x /entrypoint.sh
3731

32+
RUN git clone ${REPO_URL} /workspace/repo
33+
WORKDIR /workspace/repo
3834
ENTRYPOINT ["/entrypoint.sh"]

docker/entrypoint.sh

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
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`
139
eval "$(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
2618
cd "$(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)
2945
python_versions=$(python -c "import asv; pythons = asv.config.Config.load('asv.conf.json').pythons; print(' '.join(pythons))")
3046
for 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}
4857
done
4958

50-
echo "Benchmarks complete. Logs → /output/benchmark_${COMMIT_SHA}.log"
59+
echo "Benchmarks complete."

0 commit comments

Comments
 (0)