Skip to content

Commit

Permalink
[CI] Build only one wheel for ray containers (ray-project#34963)
Browse files Browse the repository at this point in the history
Signed-off-by: Lonnie Liu <[email protected]>
  • Loading branch information
aslonnie committed May 3, 2023
1 parent 1eb276b commit b6c74c0
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 46 deletions.
16 changes: 8 additions & 8 deletions .buildkite/pipeline.arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.7 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -70,7 +70,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.7 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -80,7 +80,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.8 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -90,7 +90,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.8 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -100,7 +100,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.9 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -110,7 +110,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.9 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -120,7 +120,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.10 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -130,7 +130,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: arm64-medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.10 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
- python ./ci/build/build-docker-images.py --py-versions py310 -T cu113 -T cu116 -T cu118 --build-type BUILDKITE --build-base --suffix aarch64
16 changes: 8 additions & 8 deletions .buildkite/pipeline.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.7 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -98,7 +98,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.7 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -108,7 +108,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.8 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -118,7 +118,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.8 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -128,7 +128,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.9 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -138,7 +138,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.9 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -148,7 +148,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.10 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- ./ci/env/env_info.sh
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
Expand All @@ -158,7 +158,7 @@
conditions: ["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_DOCKER_AFFECTED", "RAY_CI_CORE_CPP_AFFECTED"]
instance_size: medium
commands:
- LINUX_WHEELS=1 ./ci/ci.sh build
- LINUX_WHEELS=1 BUILD_ONE_PYTHON_ONLY=3.10 ./ci/ci.sh build
- pip install -q docker aws_requests_auth boto3
- if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then python .buildkite/copy_files.py --destination docker_login; fi
- python ./ci/build/build-docker-images.py --py-versions py310 -T cu111 -T cu112 -T cu113 -T cu116 -T cu118 --build-type BUILDKITE --build-base
Expand Down
1 change: 1 addition & 0 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ build_wheels() {
-e "BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST:-}"
-e "BUILDKITE_BAZEL_CACHE_URL=${BUILDKITE_BAZEL_CACHE_URL:-}"
-e "RAY_DEBUG_BUILD=${RAY_DEBUG_BUILD:-}"
-e "BUILD_ONE_PYTHON_ONLY=${BUILD_ONE_PYTHON_ONLY:-}"
)

IMAGE_NAME="quay.io/pypa/manylinux2014_${HOSTTYPE}"
Expand Down
68 changes: 38 additions & 30 deletions python/build-wheel-manylinux2014.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,30 @@ EOF
chmod +x /usr/bin/nproc

NODE_VERSION="14"
PYTHONS=("cp37-cp37m"
"cp38-cp38"
"cp39-cp39"
"cp310-cp310"
"cp311-cp311")

NUMPY_VERSIONS=("1.14.5"
"1.14.5"
"1.19.3"
"1.22.0"
"1.22.0")

# Python version key, interpreter version code, numpy tuples.
PYTHON_NUMPYS=(
"3.7 cp37-cp37m 1.14.5"
"3.8 cp38-cp38 1.14.5"
"3.9 cp39-cp39 1.19.3"
"3.10 cp310-cp310 1.22.0"
"3.11 cp311-cp311 1.22.0"
)

yum -y install unzip zip sudo
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel xz
yum -y install openssl

if [ "${HOSTTYPE-}" = "x86_64" ]; then
if [[ "${HOSTTYPE-}" == "x86_64" ]]; then
yum install "libasan-4.8.5-44.el7.${HOSTTYPE}" -y
yum install "libubsan-7.3.1-5.10.el7.${HOSTTYPE}" -y
yum install "devtoolset-8-libasan-devel.${HOSTTYPE}" -y
fi

java -version
java_bin=$(readlink -f "$(command -v java)")
echo "java_bin path $java_bin"
java_home=${java_bin%jre/bin/java}
export JAVA_HOME="$java_home"
JAVA_BIN="$(readlink -f "$(command -v java)")"
echo "java_bin path ${JAVA_BIN}"
export JAVA_HOME="${JAVA_BIN%jre/bin/java}"

/ray/ci/env/install-bazel.sh
# Put bazel into the PATH if building Bazel from source
Expand All @@ -63,10 +60,11 @@ nvm use "$NODE_VERSION"

# Build the dashboard so its static assets can be included in the wheel.
# TODO(mfitton): switch this back when deleting old dashboard code.
pushd python/ray/dashboard/client
(
cd python/ray/dashboard/client
npm ci
npm run build
popd
)
set -x

# Add the repo folder to the safe.dictory global variable to avoid the failure
Expand All @@ -75,45 +73,55 @@ set -x
git config --global --add safe.directory /ray

mkdir -p .whl
for ((i=0; i<${#PYTHONS[@]}; ++i)); do
PYTHON=${PYTHONS[i]}
NUMPY_VERSION=${NUMPY_VERSIONS[i]}
for PYTHON_NUMPY in "${PYTHON_NUMPYS[@]}" ; do
PYTHON_VERSION_KEY="$(echo "${PYTHON_NUMPY}" | cut -d' ' -f1)"
if [[ "${BUILD_ONE_PYTHON_ONLY:-}" != "" && "${PYTHON_VERSION_KEY}" != "${BUILD_ONE_PYTHON_ONLY}" ]]; then
continue
fi

PYTHON="$(echo "${PYTHON_NUMPY}" | cut -d' ' -f2)"
NUMPY_VERSION="$(echo "${PYTHON_NUMPY}" | cut -d' ' -f3)"

echo "---- Build wheel for ${PYTHON}, numpy=${NUMPY_VERSION}"

# The -f flag is passed twice to also run git clean in the arrow subdirectory.
# The -d flag removes directories. The -x flag ignores the .gitignore file,
# and the -e flag ensures that we don't remove the .whl directory, the
# dashboard directory and jars directory.
git clean -f -f -x -d -e .whl -e python/ray/dashboard/client -e dashboard/client -e python/ray/jars

pushd python
(
cd python
# Fix the numpy version because this will be the oldest numpy version we can
# support.
/opt/python/"${PYTHON}"/bin/pip install -q numpy=="${NUMPY_VERSION}" cython==0.29.32
# Set the commit SHA in __init__.py.
if [ -n "$TRAVIS_COMMIT" ]; then
if [[ -n "$TRAVIS_COMMIT" ]]; then
sed -i.bak "s/{{RAY_COMMIT_SHA}}/$TRAVIS_COMMIT/g" ray/__init__.py && rm ray/__init__.py.bak
else
echo "TRAVIS_COMMIT variable not set - required to populated ray.__commit__."
exit 1
fi

# build ray wheel
PATH=/opt/python/${PYTHON}/bin:/root/bazel-3.2.0/output:$PATH \
/opt/python/"${PYTHON}"/bin/python setup.py bdist_wheel
PATH="/opt/python/${PYTHON}/bin:/root/bazel-3.2.0/output:$PATH" \
"/opt/python/${PYTHON}/bin/python" setup.py bdist_wheel

# build ray-cpp wheel
PATH=/opt/python/${PYTHON}/bin:/root/bazel-3.2.0/output:$PATH \
RAY_INSTALL_CPP=1 /opt/python/"${PYTHON}"/bin/python setup.py bdist_wheel
PATH="/opt/python/${PYTHON}/bin:/root/bazel-3.2.0/output:$PATH" \
RAY_INSTALL_CPP=1 "/opt/python/${PYTHON}/bin/python" setup.py bdist_wheel

# In the future, run auditwheel here.
mv dist/*.whl ../.whl/
popd
)
done

# Rename the wheels so that they can be uploaded to PyPI. TODO(rkn): This is a
# hack, we should use auditwheel instead.
for path in .whl/*.whl; do
if [ -f "${path}" ]; then
if [[ -f "${path}" ]]; then
out="${path//-linux/-manylinux2014}"
if [ "$out" != "$path" ]; then
if [[ "$out" != "$path" ]]; then
mv "${path}" "${out}"
fi
fi
Expand Down

0 comments on commit b6c74c0

Please sign in to comment.