Skip to content

Commit

Permalink
[wip][dependencies] pip-compile dependencies as a build step (ray-pro…
Browse files Browse the repository at this point in the history
…ject#39610)

It's currently complicated to update dependencies, as it requires a (manual) recompilation of the `requirements_compiled.txt` file.

This PR adds a separate build job that runs pip compile on all input files to generate an updated `requirements_compiled.txt`, that is than exposed as an artifact in the buildkite job.

To update a dependency in the future, the process would be:

1. Open a PR that updates the respective requirements in the input requirements file
2. Wait for the CI job to run through and output the updated compiled requirements file
3. If the compilation was successful, add the contents of the file to the PR

Signed-off-by: Kai Fricke <[email protected]>
  • Loading branch information
krfricke authored Sep 22, 2023
1 parent 1bf3e9f commit f311495
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .buildkite/build.rayci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,18 @@ steps:
commands:
- bazel run //ci/ray_ci:build_in_docker -- docker --python-version py38
--platform cu118 --image-type ray-ml
depends_on:
depends_on:
- manylinux
- forge
- ray-mlpy38cu118base
job_env: forge

- label: ":tapioca: build: pip-compile dependencies"
instance_type: small
commands:
- rm ./python/requirements_compiled.txt
- ./ci/ci.sh compile_pip_dependencies
- cp -f ./python/requirements_compiled.txt /artifact-mount/
depends_on:
- forge
job_env: forge
4 changes: 4 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ if [ -d "/tmp/artifacts" ]; then
find /tmp/artifacts -print || true
fi

echo "Creating var/ artifact directory..."
docker run --rm -v /tmp/artifacts:/artifact-mount alpine:latest /bin/sh -c 'chown -R 2000 /artifact-mount/' || true


RAYCI_CHECKOUT_DIR="$(pwd)"
export RAYCI_CHECKOUT_DIR
2 changes: 1 addition & 1 deletion ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ compile_pip_dependencies() {
pip install --no-cache-dir numpy torch

pip-compile --resolver=backtracking -q \
--pip-args --no-deps --strip-extras --no-annotate --no-header -o \
--pip-args --no-deps --strip-extras --no-header -o \
"${WORKSPACE_DIR}/python/$TARGET" \
"${WORKSPACE_DIR}/python/requirements.txt" \
"${WORKSPACE_DIR}/python/requirements/lint-requirements.txt" \
Expand Down

0 comments on commit f311495

Please sign in to comment.