LoLBench / arrow_2 /environment /Dockerfile
lolbench26's picture
Publish LoLBench Harbor tasks from artifact branch
d0faac4 verified
Raw History Blame Contribute Delete
6.23 kB
# LoLBench eval image: Apache-Arrow PR-45360
# Requirement: Issue-45750 C++/Python/Parquet — Content Defined Chunking
# base_commit: 12424cdf2fda068e973ebd89cda045fee297943a
#
# Agent-facing contract (the agent does NOT run anything inside this
# image; the evaluator runs the container after the agent submits a
# solution.patch):
#
# docker run --rm \
# -v $(pwd)/solution.patch:/in/solution.patch:ro \
# -v $(pwd)/out:/out \
# lolbench/apache-arrow-pr-45360:1
#
# Because the agent's code never executes here, the container runs every
# step as root — no agent UID, no chown of /opt/conda, no runuser dance.
#
# Layered build per docs/executable_environment_plan.md §4:
# layer 1: condaforge/mambaforge
# layer 2: lolbench/arrow-base:1 (conda env with Arrow build deps)
# layer 3: THIS image (source @ base_commit + pre-built Arrow + private bundle)
ARG BASE_IMAGE=lolbench/arrow-base:1
FROM ${BASE_IMAGE}
ARG BASE_COMMIT=12424cdf2fda068e973ebd89cda045fee297943a
# ---- Per-instance dirs ------------------------------------------------
# /opt/lolbench/private/ holds the eval-side artifacts (eval_tests.patch,
# selectors, golden solution.patch, run_tests.sh). We keep the path name
# `private` to document intent; perms are default since the container is
# only ever run by the trusted evaluator.
RUN mkdir -p /opt/lolbench/private /in /out /workspace
# ---- Source tree at base_commit ---------------------------------------
# Fetch the upstream base commit with ancestor history, then keep only refs
# reachable from the processed LoLBench baseline.
WORKDIR /workspace
RUN git init arrow && \
cd arrow && \
git remote add origin https://github.com/apache/arrow.git && \
git fetch --no-tags origin ${BASE_COMMIT} && \
git checkout ${BASE_COMMIT} && \
echo 'version = "21.0.0.dev0"' > python/pyarrow/_generated_version.py && \
git config user.email lolbench@local && \
git config user.name lolbench && \
git add -f python/pyarrow/_generated_version.py && \
if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then \
git add -A && git add -f python/pyarrow/_generated_version.py && git -c commit.gpgsign=false commit -q -m "LoLBench environment overlay"; \
fi && \
git tag -f base && git tag -f lolbench-base && \
git for-each-ref --format='%(refname)' refs/heads refs/remotes refs/tags | \
while read ref; do \
case "$ref" in refs/tags/base|refs/tags/lolbench-base) ;; *) git update-ref -d "$ref" ;; esac; \
done && \
( git remote remove origin 2>/dev/null || true ) && \
rm -f .git/FETCH_HEAD && \
git reflog expire --expire=now --all && \
git repack -Ad && \
git prune --expire=now && \
git config --global --add safe.directory /workspace/arrow
# ---- Pre-build Arrow C++ + PyArrow + pandas (single layer) ------------
# Folding all three installs into one RUN keeps the layer count small.
RUN bash -lc '\
set -e ; \
source /opt/conda/etc/profile.d/conda.sh && conda activate base ; \
mkdir -p /workspace/build && cd /workspace/build && \
cmake -GNinja \
-DCMAKE_INSTALL_PREFIX=/opt/conda \
-DCMAKE_BUILD_TYPE=Release \
-DARROW_SIMD_LEVEL=AVX2 \
-DARROW_RUNTIME_SIMD_LEVEL=AVX2 \
-DARROW_BUILD_STATIC=OFF \
-DARROW_BUILD_TESTS=OFF \
-DARROW_BUILD_UTILITIES=OFF \
-DARROW_DEPENDENCY_SOURCE=CONDA \
-DARROW_PARQUET=ON \
-DARROW_PYTHON=OFF \
-DARROW_FILESYSTEM=ON \
-DARROW_DATASET=ON \
-DARROW_COMPUTE=ON \
-DARROW_JSON=ON \
-DARROW_CSV=ON \
-DARROW_ACERO=ON \
-DARROW_S3=OFF -DARROW_GCS=OFF -DARROW_AZURE=OFF \
-DARROW_WITH_BROTLI=ON -DARROW_WITH_SNAPPY=ON -DARROW_WITH_LZ4=ON -DARROW_WITH_ZSTD=ON -DARROW_WITH_BZ2=ON \
/workspace/arrow/cpp && \
ninja -j4 install ; \
cd /workspace/arrow/python && \
PYARROW_WITH_PARQUET=1 PYARROW_PARALLEL=4 PYARROW_CMAKE_GENERATOR=Ninja \
pip install -e . --no-build-isolation ; \
mamba install -y -c conda-forge pandas && \
mamba clean --all -y \
'
# ---- Eval bundle ------------------------------------------------------
# All eval-side files live in the instance directory's root. The
# previous public/ + private/ split was only a distribution-policy
# label; since the container runs as root throughout, a single bundle
# directory is simpler. The path /opt/lolbench/private/ is kept inside
# the container as a stable name for tooling.
# Augmented (opt-in) suite — see docs/test_augmentation_plan.md §10.
# These sidecar files are independent of the original eval contract; if the
# evaluator never passes LOLBENCH_SUITE=aug|union, they are unused.
# Harbor runtime adapter: keep the image public/agent-safe.
RUN if ! command -v rg >/dev/null 2>&1; then \
if command -v apt-get >/dev/null 2>&1; then apt-get update && apt-get install -y --no-install-recommends ripgrep && rm -rf /var/lib/apt/lists/*; \
elif command -v apk >/dev/null 2>&1; then apk add --no-cache ripgrep; \
elif command -v dnf >/dev/null 2>&1; then dnf install -y ripgrep && dnf clean all; \
elif command -v yum >/dev/null 2>&1; then yum install -y ripgrep && yum clean all; \
else echo 'ripgrep is required by the agent harness' >&2; exit 1; fi; \
fi
RUN mkdir -p /opt/lolbench /logs/artifacts /logs/agent /logs/verifier /in /out && \
if ! id -u agent >/dev/null 2>&1; then useradd -m -s /bin/bash agent; fi && \
mkdir -p /home/agent/.cache/opencode/bin && \
ln -sf "$(command -v rg)" /home/agent/.cache/opencode/bin/rg
COPY metadata.json /opt/lolbench/metadata.json
COPY lolbench-submit /usr/local/bin/lolbench-submit
RUN chmod +x /usr/local/bin/lolbench-submit && \
git config --global --add safe.directory /workspace/arrow && \
if [ -d /workspace/arrow/.git ]; then \
cd /workspace/arrow && git ls-files --others --exclude-standard | sort > /opt/lolbench/base_untracked.txt; \
else \
: > /opt/lolbench/base_untracked.txt; \
fi && \
chown -R agent:agent /workspace /in /out /logs /home/agent/.cache
USER agent
WORKDIR /workspace/arrow
ENV LOLBENCH_INSTANCE_ID=arrow_2
ENV LOLBENCH_SOURCE_SLUG=Apache-Arrow_Issue-45750_PR-45360