diff --git a/README.md b/README.md index 3e4c559..340050c 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,10 @@ In this order, since each step builds on the previous one: `requirements.txt`, build and push your image from `tools/Dockerfile`, and set `docker_image` in `competition.yaml`. `codabench-benchopt-gpu` is the CUDA variant, for a self-hosted GPU worker. + Once the challenge runs, add a package to `extra-deps.txt` and build + `tools/Dockerfile.extra`: it installs the package on top of the running + image without upgrading what is already there, so scored submissions keep + their stack. 6. **Pages, dates and quotas** in `pages/` and `competition.yaml`. The Participate page summarizes the notebook. diff --git a/extra-deps.txt b/extra-deps.txt new file mode 100644 index 0000000..09e4020 --- /dev/null +++ b/extra-deps.txt @@ -0,0 +1,2 @@ +# Dependencies added during the challenge. tools/Dockerfile.extra installs +# them on top of the running image without moving the packages it holds. diff --git a/pages/participate.md b/pages/participate.md index 8ef6283..5aa1ba7 100755 --- a/pages/participate.md +++ b/pages/participate.md @@ -58,6 +58,11 @@ platform **trains your code**, once per fold, then evaluates it. Copy `benchmark/solvers/random-forest.py`, a working baseline, to `my_submission/submission.py`. +The platform installs nothing at submission time: `submission.py` can only +import the packages of `requirements.txt`, and a solver's benchopt +`requirements` are ignored. To use another package, open a pull request on +the challenge repository that adds it to `extra-deps.txt`. + ## Run it locally, same code as the server `local_config.yml` sets the dataset, the solvers, the seed and the 5 folds diff --git a/requirements.txt b/requirements.txt index 3eda32c..28aba4d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,5 @@ benchopt>=1.10 pandas scikit-learn +# Dependencies added once the challenge runs (installed on top of its image). +-r extra-deps.txt diff --git a/tools/Dockerfile b/tools/Dockerfile index a2aea50..6fb5d56 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -11,5 +11,5 @@ ARG BASE=ghcr.io/x-datascience-datacamp/codabench-benchopt FROM ${BASE} -COPY requirements.txt /tmp/requirements.txt +COPY requirements.txt extra-deps.txt /tmp/ RUN pip install --no-cache-dir -r /tmp/requirements.txt diff --git a/tools/Dockerfile.extra b/tools/Dockerfile.extra new file mode 100644 index 0000000..9022ade --- /dev/null +++ b/tools/Dockerfile.extra @@ -0,0 +1,14 @@ +# Adds extra-deps.txt to the running image without a full rebuild: the +# installed packages are frozen as constraints, so pip cannot upgrade them and +# fails instead of moving the stack under scored submissions. Build from the +# repo root, with IMAGE the running image pinned by digest so rebuilds do not +# stack on each other, and push under the docker_image tag: +# +# docker build -f tools/Dockerfile.extra -t /:v1 \ +# --build-arg IMAGE=/@sha256: . +ARG IMAGE +FROM ${IMAGE} + +COPY extra-deps.txt /tmp/extra-deps.txt +RUN pip list --format=freeze > /tmp/frozen.txt && \ + pip install --no-cache-dir -r /tmp/extra-deps.txt -c /tmp/frozen.txt