Add __commit__ field to ray package in wheels (#7305)

This commit is contained in:
Edward Oakes 2020-02-26 17:54:23 -08:00 committed by GitHub
parent 2ad9bc5684
commit ee0f71e398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 2 deletions

View file

@ -144,7 +144,7 @@ matrix:
# This command should be kept in sync with ray/python/README-building-wheels.md,
# except the `$MOUNT_BAZEL_CACHE` part.
- ./ci/suppress_output docker run --rm -w /ray -v `pwd`:/ray $MOUNT_BAZEL_CACHE -ti rayproject/arrow_linux_x86_64_base:ARROW-5631 /ray/python/build-wheel-manylinux1.sh
- ./ci/suppress_output docker run -e TRAVIS_COMMIT=$TRAVIS_COMMIT --rm -w /ray -v `pwd`:/ray $MOUNT_BAZEL_CACHE -ti rayproject/arrow_linux_x86_64_base:ARROW-5631 /ray/python/build-wheel-manylinux1.sh
script:
- if [ $RAY_CI_LINUX_WHEELS_AFFECTED != "1" ]; then exit; fi

View file

@ -40,6 +40,9 @@ if [[ "$platform" == "linux" ]]; then
# Install the wheel.
$PIP_CMD install -q "$PYTHON_WHEEL"
# Check that ray.__commit__ was set properly.
$PYTHON_EXE -u -c "import ray; print(ray.__commit__)" | grep $TRAVIS_COMMIT || (echo "ray.__commit__ not set properly!" && exit 1)
# Run a simple test script to make sure that the wheel works.
INSTALLED_RAY_DIRECTORY=$(dirname "$($PYTHON_EXE -u -c "import ray; print(ray.__file__)" | tail -n1)")
$PYTHON_EXE "$TEST_SCRIPT"

View file

@ -79,6 +79,13 @@ for ((i=0; i<${#PY_VERSIONS[@]}; ++i)); do
$PIP_CMD install -q numpy==$NUMPY_VERSION cython==0.29.0
# Install wheel to avoid the error "invalid command 'bdist_wheel'".
$PIP_CMD install -q wheel
# Set the commit SHA in __init__.py.
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
# Add the correct Python to the path and build the wheel. This is only
# needed so that the installation finds the cython executable.
PATH=$MACPYTHON_PY_PREFIX/$PY_MM/bin:$PATH $PYTHON_EXE setup.py bdist_wheel

View file

@ -28,6 +28,7 @@ sudo apt-get install unzip
export PATH=$PATH:/root/bin
# Install and use the latest version of Node.js in order to build the dashboard.
set +x
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source $HOME/.nvm/nvm.sh
nvm install node
@ -38,6 +39,7 @@ pushd python/ray/dashboard/client
npm ci
npm run build
popd
set -x
mkdir .whl
for ((i=0; i<${#PYTHONS[@]}; ++i)); do
@ -54,6 +56,14 @@ for ((i=0; i<${#PYTHONS[@]}; ++i)); do
# 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.0
# Set the commit SHA in __init__.py.
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
PATH=/opt/python/${PYTHON}/bin:$PATH /opt/python/${PYTHON}/bin/python setup.py bdist_wheel
# In the future, run auditwheel here.
mv dist/*.whl ../.whl/

View file

@ -98,7 +98,8 @@ from ray.runtime_context import _get_runtime_context # noqa: E402
from ray.cross_language import java_function, java_actor_class # noqa: E402
from ray import util # noqa: E402
# Ray version string.
# Replaced with the current commit when building the wheels.
__commit__ = "{{RAY_COMMIT_SHA}}"
__version__ = "0.9.0.dev0"
__all__ = [