Skip to content

Commit

Permalink
[ci] fix pip-compile dependency job + upgrade ipywidgets (ray-project…
Browse files Browse the repository at this point in the history
…#45870)

- Use the oss_ci_base_test to compile the dependency list; need to
install miniconda into the base_test
- Upgrade ipywidgets, need to resolve a lot of dependency issues
- Rebuild the byod_requirements for release test as well

Test:
- CI

---------

Signed-off-by: can <[email protected]>
  • Loading branch information
can-anyscale authored Jun 24, 2024
1 parent 4f40e1d commit 841c0d1
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 477 deletions.
5 changes: 2 additions & 3 deletions .buildkite/others.rayci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ steps:
- ./ci/ci.sh compile_pip_dependencies
- cp -f ./python/requirements_compiled.txt /artifact-mount/
soft_fail: true
job_env: oss-ci-base_build-py3.11
job_env: oss-ci-base_test-py3.11
depends_on:
- forge
- oss-ci-base_build-multipy
- oss-ci-base_test-multipy

# test
- label: doc tests
Expand Down
10 changes: 8 additions & 2 deletions ci/docker/base.build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ RUN apt-get install -y -qq maven openjdk-8-jre openjdk-8-jdk

COPY . .

# init also calls install-dependencies.sh (again)
RUN BUILD=1 ./ci/ci.sh init
RUN <<EOF
#!/bin/bash -i

set -euo pipefail

BUILD=1 ./ci/ci.sh init

EOF
1 change: 1 addition & 0 deletions ci/docker/base.gpu.py39.wanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ srcs:
- ci/env/install-dependencies.sh
- ci/env/install-llvm-binaries.sh
- ci/env/install-bazel.sh
- ci/env/install-miniconda.sh
- ci/pipeline/determine_tests_to_run.py
- ci/suppress_output
- python/requirements.txt
Expand Down
1 change: 1 addition & 0 deletions ci/docker/base.gpu.wanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ srcs:
- ci/env/install-dependencies.sh
- ci/env/install-llvm-binaries.sh
- ci/env/install-bazel.sh
- ci/env/install-miniconda.sh
- ci/pipeline/determine_tests_to_run.py
- ci/suppress_output
- python/requirements.txt
Expand Down
3 changes: 1 addition & 2 deletions ci/docker/base.ml.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ FROM $DOCKER_IMAGE_BASE_TEST

COPY . .

RUN BUILD=1 ./ci/ci.sh init

RUN <<EOF
#!/bin/bash -i

set -e

BUILD=1 ./ci/ci.sh init
RLLIB_TESTING=1 TRAIN_TESTING=1 TUNE_TESTING=1 bash --login -i ./ci/env/install-dependencies.sh

pip uninstall -y ray
Expand Down
1 change: 1 addition & 0 deletions ci/docker/base.test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ WORKDIR /ray
# Below should be re-run each time
COPY . .

RUN ./ci/env/install-miniconda.sh
RUN ./ci/env/install-bazel.sh
2 changes: 2 additions & 0 deletions ci/docker/base.test.aarch64.wanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ froms: ["ubuntu:focal"]
dockerfile: ci/docker/base.test.Dockerfile
srcs:
- ci/env/install-bazel.sh
- ci/env/install-miniconda.sh
- ci/suppress_output
- .bazelversion
build_args:
- BUILDKITE_BAZEL_CACHE_URL
Expand Down
2 changes: 2 additions & 0 deletions ci/docker/base.test.py39.wanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ froms: ["ubuntu:focal"]
dockerfile: ci/docker/base.test.Dockerfile
srcs:
- ci/env/install-bazel.sh
- ci/env/install-miniconda.sh
- ci/suppress_output
- .bazelversion
build_args:
- BUILDKITE_BAZEL_CACHE_URL
Expand Down
2 changes: 2 additions & 0 deletions ci/docker/base.test.wanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ froms: ["ubuntu:focal"]
dockerfile: ci/docker/base.test.Dockerfile
srcs:
- ci/env/install-bazel.sh
- ci/env/install-miniconda.sh
- ci/suppress_output
- .bazelversion
build_args:
- BUILDKITE_BAZEL_CACHE_URL
Expand Down
108 changes: 3 additions & 105 deletions ci/env/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ set -euxo pipefail
SCRIPT_DIR=$(builtin cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
WORKSPACE_DIR="${SCRIPT_DIR}/../.."

# importing install_miniconda function
source "${SCRIPT_DIR}/install-miniconda.sh"

pkg_install_helper() {
case "${OSTYPE}" in
darwin*)
Expand Down Expand Up @@ -65,111 +68,6 @@ install_base() {
esac
}

install_miniconda() {
if [ "${OSTYPE}" = msys ]; then
# Windows is on GitHub Actions, whose built-in Python installations we added direct support for.
python --version
return 0
fi

local conda="${CONDA_EXE-}" # Try to get the activated conda executable
if [ -z "${conda}" ]; then # If no conda is found, try to find it in PATH
conda="$(command -v conda || true)"
fi

if [ ! -x "${conda}" ] || [ "${MINIMAL_INSTALL-}" = 1 ]; then # If no conda is found, install it
local miniconda_dir # Keep directories user-independent, to help with Bazel caching
local miniconda_version="Miniconda3-py311_24.4.0-0"
local miniconda_platform=""
local exe_suffix=".sh"

case "${OSTYPE}" in
linux*)
miniconda_dir="/opt/miniconda"
miniconda_platform=Linux
;;
darwin*)
if [ "$(uname -m)" = "arm64" ]; then
HOSTTYPE="arm64"
miniconda_dir="/opt/homebrew/opt/miniconda"
else
HOSTTYPE="x86_64"
miniconda_dir="/usr/local/opt/miniconda"
fi
miniconda_platform=MacOSX
;;
msys*)
miniconda_dir="${ALLUSERSPROFILE}\Miniconda3" # Avoid spaces; prefer the default path
miniconda_platform=Windows
exe_suffix=".exe"
;;
esac

local miniconda_url="https://repo.continuum.io/miniconda/${miniconda_version}-${miniconda_platform}-${HOSTTYPE}${exe_suffix}"
local miniconda_target="${HOME}/${miniconda_url##*/}"
curl -f -s -L -o "${miniconda_target}" "${miniconda_url}"
chmod +x "${miniconda_target}"

case "${OSTYPE}" in
msys*)
# We set /AddToPath=0 because
# (1) it doesn't take care of the current shell, and
# (2) it's consistent with -b in the UNIX installers.
MSYS2_ARG_CONV_EXCL="*" "${miniconda_target}" \
/RegisterPython=0 /AddToPath=0 /InstallationType=AllUsers /S /D="${miniconda_dir}"
conda="${miniconda_dir}\Scripts\conda.exe"
;;
*)
if [ "${MINIMAL_INSTALL-}" = 1 ]; then
rm -rf "${miniconda_dir}"
fi
mkdir -p -- "${miniconda_dir}"
# We're forced to pass -b for non-interactive mode.
# Unfortunately it inhibits PATH modifications as a side effect.
"${WORKSPACE_DIR}"/ci/suppress_output "${miniconda_target}" -f -b -p "${miniconda_dir}"
conda="${miniconda_dir}/bin/conda"
;;
esac
fi

if [ ! -x "${CONDA_PYTHON_EXE-}" ]; then # If conda isn't activated, activate it
local restore_shell_state=""
if [ -o xtrace ]; then set +x && restore_shell_state="set -x"; fi # Disable set -x (noisy here)

# TODO(mehrdadn): conda activation is buggy on MSYS2; it adds C:/... to PATH,
# which gets split on a colon. Is it necessary to work around this?
eval "$("${conda}" shell."${SHELL##*/}" hook)" # Activate conda
conda init "${SHELL##*/}" # Add to future shells

${restore_shell_state} # Restore set -x
fi

local python_version
python_version="$(python -s -c "import sys; print('%s.%s' % sys.version_info[:2])")"
if [ -n "${PYTHON-}" ] && [ "${PYTHON}" != "${python_version}" ]; then # Update Python version
(
set +x
echo "Updating Anaconda Python ${python_version} to ${PYTHON}..."
"${WORKSPACE_DIR}"/ci/suppress_output conda install -q -y python="${PYTHON}"
)
elif [ "${MINIMAL_INSTALL-}" = "1" ]; then # Reset environment
(
set +x
echo "Resetting Anaconda Python ${python_version}..."
"${WORKSPACE_DIR}"/ci/suppress_output conda install -q -y --rev 0
)
fi

if [[ "${PYTHON-}" != "3.12" ]]; then
# Install mpi4py as a test dependency for Python <3.12; currently mpi4py is not
# available for Python 3.12
"${WORKSPACE_DIR}"/ci/suppress_output conda install -c anaconda mpi4py -y
fi

command -V python
test -x "${CONDA_PYTHON_EXE}" # make sure conda is activated
}

install_shellcheck() {
local shellcheck_version="0.7.1"
if [ "${shellcheck_version}" != "$(command -v shellcheck > /dev/null && shellcheck --version | sed -n "s/version: //p")" ]; then
Expand Down
115 changes: 115 additions & 0 deletions ci/env/install-miniconda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env bash

install_miniconda() {
if [ "${OSTYPE}" = msys ]; then
# Windows is on GitHub Actions, whose built-in Python installations we added direct support for.
python --version
return 0
fi

local conda="${CONDA_EXE-}" # Try to get the activated conda executable
if [ -z "${conda}" ]; then # If no conda is found, try to find it in PATH
conda="$(command -v conda || true)"
fi

if [ ! -x "${conda}" ] || [ "${MINIMAL_INSTALL-}" = 1 ]; then # If no conda is found, install it
local miniconda_dir # Keep directories user-independent, to help with Bazel caching
local miniconda_version="Miniconda3-py311_24.4.0-0"
local miniconda_platform=""
local exe_suffix=".sh"

case "${OSTYPE}" in
linux*)
miniconda_dir="/opt/miniconda"
miniconda_platform=Linux
;;
darwin*)
if [ "$(uname -m)" = "arm64" ]; then
HOSTTYPE="arm64"
miniconda_dir="/opt/homebrew/opt/miniconda"
else
HOSTTYPE="x86_64"
miniconda_dir="/usr/local/opt/miniconda"
fi
miniconda_platform=MacOSX
;;
msys*)
miniconda_dir="${ALLUSERSPROFILE}\Miniconda3" # Avoid spaces; prefer the default path
miniconda_platform=Windows
exe_suffix=".exe"
;;
esac

local miniconda_url="https://repo.continuum.io/miniconda/${miniconda_version}-${miniconda_platform}-${HOSTTYPE}${exe_suffix}"
local miniconda_target="${HOME}/${miniconda_url##*/}"
curl -f -s -L -o "${miniconda_target}" "${miniconda_url}"
chmod +x "${miniconda_target}"

case "${OSTYPE}" in
msys*)
# We set /AddToPath=0 because
# (1) it doesn't take care of the current shell, and
# (2) it's consistent with -b in the UNIX installers.
MSYS2_ARG_CONV_EXCL="*" "${miniconda_target}" \
/RegisterPython=0 /AddToPath=0 /InstallationType=AllUsers /S /D="${miniconda_dir}"
conda="${miniconda_dir}\Scripts\conda.exe"
;;
*)
if [ "${MINIMAL_INSTALL-}" = 1 ]; then
rm -rf "${miniconda_dir}"
fi
mkdir -p -- "${miniconda_dir}"
# We're forced to pass -b for non-interactive mode.
# Unfortunately it inhibits PATH modifications as a side effect.
"${WORKSPACE_DIR}"/ci/suppress_output "${miniconda_target}" -f -b -p "${miniconda_dir}"
conda="${miniconda_dir}/bin/conda"
;;
esac
fi

if [ ! -x "${CONDA_PYTHON_EXE-}" ]; then # If conda isn't activated, activate it
local restore_shell_state=""
if [ -o xtrace ]; then set +x && restore_shell_state="set -x"; fi # Disable set -x (noisy here)

# TODO(mehrdadn): conda activation is buggy on MSYS2; it adds C:/... to PATH,
# which gets split on a colon. Is it necessary to work around this?
eval "$("${conda}" shell."${SHELL##*/}" hook)" # Activate conda
conda init "${SHELL##*/}" # Add to future shells

${restore_shell_state} # Restore set -x
fi

local python_version
python_version="$(python -s -c "import sys; print('%s.%s' % sys.version_info[:2])")"
if [ -n "${PYTHON-}" ] && [ "${PYTHON}" != "${python_version}" ]; then # Update Python version
(
set +x
echo "Updating Anaconda Python ${python_version} to ${PYTHON}..."
"${WORKSPACE_DIR}"/ci/suppress_output conda install -q -y python="${PYTHON}"
)
elif [ "${MINIMAL_INSTALL-}" = "1" ]; then # Reset environment
(
set +x
echo "Resetting Anaconda Python ${python_version}..."
"${WORKSPACE_DIR}"/ci/suppress_output conda install -q -y --rev 0
)
fi

if [[ "${PYTHON-}" != "3.12" ]]; then
# Install mpi4py as a test dependency for Python <3.12; currently mpi4py is not
# available for Python 3.12
"${WORKSPACE_DIR}"/ci/suppress_output conda install -c anaconda mpi4py -y
fi

command -V python
test -x "${CONDA_PYTHON_EXE}" # make sure conda is activated
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -exuo pipefail

SCRIPT_DIR=$(builtin cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
WORKSPACE_DIR="${SCRIPT_DIR}/../.."
install_miniconda
fi

2 changes: 1 addition & 1 deletion python/requirements/ml/tune-test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aim==3.17.5

gpy==1.13.1

jupyterlab==3.6.1
jupyterlab
matplotlib!=3.4.3

pytest-remotedata==0.3.2
Expand Down
13 changes: 7 additions & 6 deletions python/requirements/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ xlrd==2.0.1
yq==3.2.2
memray; platform_system != "Windows" and sys_platform != "darwin" and platform_machine != 'aarch64'
numpy==1.24.4
ipywidgets==7.7.2
ipywidgets==8.0.6
colorama

# For doc tests
myst-parser==0.15.2
myst-nb==0.13.1
sphinx==4.3.2
jupytext==1.13.6
jinja2==3.1.2
myst-parser
myst-nb
sphinx
jupytext
jinja2
pytest-docker-tools==3.1.3
pytest-forked==1.4.0

Expand Down
Loading

0 comments on commit 841c0d1

Please sign in to comment.