2020-07-21 14:47:09 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-09-14 11:39:08 +08:00
|
|
|
# This script automatically download ray and run the sanity check (sanity_check.py and sanity_check_cpp.sh)
|
2020-05-28 09:37:19 -07:00
|
|
|
# in various Python version. This script requires conda command to exist.
|
|
|
|
|
2020-09-08 15:45:06 -07:00
|
|
|
unset RAY_ADDRESS
|
|
|
|
export RAY_HASH=$RAY_HASH
|
|
|
|
export RAY_VERSION=$RAY_VERSION
|
|
|
|
|
2020-05-28 09:37:19 -07:00
|
|
|
if [[ -z "$RAY_HASH" ]]; then
|
|
|
|
echo "RAY_HASH env var should be provided"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$RAY_VERSION" ]]; then
|
|
|
|
echo "RAY_VERSION env var should be provided"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -x "$(command -v conda)" ]; then
|
|
|
|
echo "conda doesn't exist. Please download conda for this machine"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "conda exists"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Start downloading Ray version ${RAY_VERSION} of commit ${RAY_HASH}"
|
|
|
|
|
|
|
|
pip install --upgrade pip
|
|
|
|
|
|
|
|
# This is required to use conda activate
|
|
|
|
source "$(conda info --base)/etc/profile.d/conda.sh"
|
|
|
|
|
2021-11-29 11:38:38 -08:00
|
|
|
if [[ $(uname -m) == 'arm64' ]] && [[ $OSTYPE == "darwin"* ]]; then
|
2022-05-20 08:46:15 +09:00
|
|
|
PYTHON_VERSIONS=( "3.8" "3.9" "3.10" )
|
2021-11-29 11:38:38 -08:00
|
|
|
else
|
2022-05-20 08:46:15 +09:00
|
|
|
PYTHON_VERSIONS=( "3.6" "3.7" "3.8" "3.9" "3.10" )
|
2021-11-29 11:38:38 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
for PYTHON_VERSION in "${PYTHON_VERSIONS[@]}"
|
2020-05-28 09:37:19 -07:00
|
|
|
do
|
|
|
|
env_name="${RAY_VERSION}-${PYTHON_VERSION}-env"
|
2021-11-29 11:38:38 -08:00
|
|
|
conda create -y -n "${env_name}" python="${PYTHON_VERSION}"
|
2020-05-28 09:37:19 -07:00
|
|
|
conda activate "${env_name}"
|
2020-07-24 15:24:19 -07:00
|
|
|
printf "\n\n\n"
|
|
|
|
echo "========================================================="
|
2020-05-28 09:37:19 -07:00
|
|
|
echo "Python version."
|
|
|
|
python --version
|
|
|
|
echo "This should be equal to ${PYTHON_VERSION}"
|
2020-07-24 15:24:19 -07:00
|
|
|
echo "========================================================="
|
|
|
|
printf "\n\n\n"
|
2020-05-28 09:37:19 -07:00
|
|
|
|
2021-11-29 11:38:38 -08:00
|
|
|
# TODO (Alex): Get rid of this once grpc adds working PyPI wheels for M1 macs.
|
|
|
|
if [[ $(uname -m) == 'arm64' ]] && [[ $OSTYPE == "darwin"* ]]; then
|
|
|
|
conda install -y grpcio
|
|
|
|
fi
|
|
|
|
|
2021-09-23 12:10:03 +08:00
|
|
|
# shellcheck disable=SC2102
|
|
|
|
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ray[cpp]=="${RAY_VERSION}"
|
2020-05-28 09:37:19 -07:00
|
|
|
|
|
|
|
failed=false
|
2021-09-14 11:39:08 +08:00
|
|
|
cpp_failed=false
|
2020-07-24 15:24:19 -07:00
|
|
|
printf "\n\n\n"
|
|
|
|
echo "========================================================="
|
2020-05-28 09:37:19 -07:00
|
|
|
if python sanity_check.py; then
|
|
|
|
echo "PYTHON ${PYTHON_VERSION} succeed sanity check."
|
|
|
|
else
|
|
|
|
failed=true
|
|
|
|
fi
|
2021-10-07 05:34:25 -07:00
|
|
|
if bash sanity_check_cpp.sh; then
|
2021-09-14 11:39:08 +08:00
|
|
|
echo "PYTHON ${PYTHON_VERSION} succeed sanity check C++."
|
|
|
|
else
|
|
|
|
cpp_failed=true
|
|
|
|
fi
|
2020-07-24 15:24:19 -07:00
|
|
|
echo "========================================================="
|
|
|
|
printf "\n\n\n"
|
2020-05-28 09:37:19 -07:00
|
|
|
conda deactivate
|
2020-07-21 19:56:41 -07:00
|
|
|
conda remove -y --name "${env_name}" --all
|
2020-05-28 09:37:19 -07:00
|
|
|
if [ "$failed" = true ]; then
|
|
|
|
echo "PYTHON ${PYTHON_VERSION} failed sanity check."
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-09-14 11:39:08 +08:00
|
|
|
if [ "$cpp_failed" = true ]; then
|
|
|
|
echo "PYTHON ${PYTHON_VERSION} failed sanity check C++."
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-05-28 09:37:19 -07:00
|
|
|
done
|