2016-06-22 11:42:04 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-07-31 21:04:15 -07:00
|
|
|
set -x
|
|
|
|
|
2016-11-02 20:56:25 -07:00
|
|
|
# Cause the script to exit if a single command fails.
|
|
|
|
set -e
|
|
|
|
|
2020-02-10 12:32:23 -06:00
|
|
|
# As the supported Python versions change, edit this array:
|
2020-04-01 10:03:23 -07:00
|
|
|
SUPPORTED_PYTHONS=( "3.5" "3.6" "3.7" "3.8" )
|
2020-02-10 12:32:23 -06:00
|
|
|
|
2016-06-22 11:42:04 -07:00
|
|
|
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
|
|
|
|
|
2018-05-19 10:09:23 +08:00
|
|
|
function usage()
|
|
|
|
{
|
2020-02-10 12:32:23 -06:00
|
|
|
cat <<EOF
|
|
|
|
Usage: build.sh [<args>]
|
|
|
|
|
|
|
|
Options:
|
|
|
|
-h|--help print the help info
|
|
|
|
-l|--language language1[,language2]
|
|
|
|
a list of languages to build native libraries.
|
|
|
|
Supported languages include "python" and "java".
|
|
|
|
If not specified, only python library will be built.
|
|
|
|
-p|--python mypython which python executable (default: result of "which python")
|
|
|
|
EOF
|
2018-05-19 10:09:23 +08:00
|
|
|
}
|
2018-03-01 14:29:56 -08:00
|
|
|
|
2016-06-25 14:02:33 -07:00
|
|
|
# Determine how many parallel jobs to use for make based on the number of cores
|
|
|
|
unamestr="$(uname)"
|
|
|
|
if [[ "$unamestr" == "Linux" ]]; then
|
2019-02-23 11:58:59 -08:00
|
|
|
PARALLEL=1
|
2016-06-25 14:02:33 -07:00
|
|
|
elif [[ "$unamestr" == "Darwin" ]]; then
|
|
|
|
PARALLEL=$(sysctl -n hw.ncpu)
|
|
|
|
else
|
|
|
|
echo "Unrecognized platform."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-08-15 02:33:51 +08:00
|
|
|
RAY_BUILD_PYTHON="YES"
|
|
|
|
RAY_BUILD_JAVA="NO"
|
2018-05-19 10:09:23 +08:00
|
|
|
PYTHON_EXECUTABLE=""
|
|
|
|
BUILD_DIR=""
|
|
|
|
|
|
|
|
# Parse options
|
2019-05-01 21:29:48 -07:00
|
|
|
while [[ $# -gt 0 ]]; do
|
2018-05-19 10:09:23 +08:00
|
|
|
key="$1"
|
|
|
|
case $key in
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2020-02-10 12:32:23 -06:00
|
|
|
-l|--language)
|
2018-05-19 10:09:23 +08:00
|
|
|
LANGUAGE="$2"
|
2018-08-15 02:33:51 +08:00
|
|
|
RAY_BUILD_PYTHON="NO"
|
|
|
|
RAY_BUILD_JAVA="NO"
|
|
|
|
if [[ "$LANGUAGE" == *"python"* ]]; then
|
|
|
|
RAY_BUILD_PYTHON="YES"
|
|
|
|
fi
|
|
|
|
if [[ "$LANGUAGE" == *"java"* ]]; then
|
|
|
|
RAY_BUILD_JAVA="YES"
|
|
|
|
fi
|
|
|
|
if [ "$RAY_BUILD_PYTHON" == "NO" ] && [ "$RAY_BUILD_JAVA" == "NO" ]; then
|
|
|
|
echo "Unrecognized language: $LANGUAGE"
|
2018-05-19 10:09:23 +08:00
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-p|--python)
|
|
|
|
PYTHON_EXECUTABLE="$2"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "ERROR: unknown option \"$key\""
|
|
|
|
echo
|
|
|
|
usage
|
|
|
|
exit -1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ -z "$PYTHON_EXECUTABLE" ]]; then
|
2019-05-01 21:29:48 -07:00
|
|
|
PYTHON_EXECUTABLE=$(which python)
|
2018-05-19 10:09:23 +08:00
|
|
|
fi
|
2020-02-10 12:32:23 -06:00
|
|
|
|
|
|
|
PYTHON_VERSION=`"$PYTHON_EXECUTABLE" -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))'`
|
|
|
|
found=
|
|
|
|
for allowed in ${SUPPORTED_PYTHONS[@]}
|
|
|
|
do
|
|
|
|
if [[ "$PYTHON_VERSION" == $allowed ]]
|
|
|
|
then
|
|
|
|
found=$allowed
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ -z $found ]]
|
|
|
|
then
|
|
|
|
cat <<EOF
|
|
|
|
ERROR: Detected Python version $PYTHON_VERSION, which is not supported.
|
|
|
|
Please use version 3.6 or 3.7.
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-05-19 10:09:23 +08:00
|
|
|
echo "Using Python executable $PYTHON_EXECUTABLE."
|
|
|
|
|
2019-05-01 21:29:48 -07:00
|
|
|
# Find the bazel executable. The script ci/travis/install-bazel.sh doesn't
|
|
|
|
# always put the bazel executable on the PATH.
|
|
|
|
BAZEL_EXECUTABLE=$(PATH="$PATH:$HOME/.bazel/bin" which bazel)
|
|
|
|
echo "Using Bazel executable $BAZEL_EXECUTABLE."
|
|
|
|
|
2018-01-11 11:09:01 -08:00
|
|
|
# Now we build everything.
|
2018-06-02 07:28:27 +08:00
|
|
|
BUILD_DIR="$ROOT_DIR/build/"
|
|
|
|
if [ ! -d "${BUILD_DIR}" ]; then
|
2019-05-01 21:29:48 -07:00
|
|
|
mkdir -p "${BUILD_DIR}"
|
2018-05-19 10:09:23 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
pushd "$BUILD_DIR"
|
update ray cmake build process (#2853)
* use cmake to build ray project, no need to appply build.sh before cmake, fix some abuse of cmake, improve the build performance
* support boost external project, avoid using the system or build.sh boost
* keep compatible with build.sh, remove boost and arrow build from it.
* bugfix: parquet bison version control, plasma_java lib install problem
* bugfix: cmake, do not compile plasma java client if no need
* bugfix: component failures test timeout machenism has problem for plasma manager failed case
* bugfix: arrow use lib64 in centos, travis check-git-clang-format-output.sh does not support other branches except master
* revert some fix
* set arrow python executable, fix format error in component_failures_test.py
* make clean arrow python build directory
* update cmake code style, back to support cmake minimum version 3.4
2018-09-13 02:19:33 +08:00
|
|
|
|
2019-11-08 15:58:28 -08:00
|
|
|
|
2020-02-10 12:32:23 -06:00
|
|
|
WORK_DIR=`mktemp -d`
|
|
|
|
pushd $WORK_DIR
|
|
|
|
git clone https://github.com/suquark/pickle5-backport
|
|
|
|
pushd pickle5-backport
|
2020-02-15 21:16:13 -08:00
|
|
|
git checkout 8ffe41ceba9d5e2ce8a98190f6b3d2f3325e5a72
|
2020-02-10 12:32:23 -06:00
|
|
|
"$PYTHON_EXECUTABLE" setup.py bdist_wheel
|
|
|
|
unzip -o dist/*.whl -d "$ROOT_DIR/python/ray/pickle5_files"
|
|
|
|
popd
|
|
|
|
popd
|
2019-11-10 18:12:18 -08:00
|
|
|
|
2020-02-05 14:16:58 -08:00
|
|
|
|
2020-02-10 22:40:09 -08:00
|
|
|
if [ -z "$SKIP_THIRDPARTY_INSTALL" ]; then
|
|
|
|
"$PYTHON_EXECUTABLE" -m pip install -q psutil setproctitle \
|
|
|
|
--target="$ROOT_DIR/python/ray/thirdparty_files"
|
|
|
|
fi
|
2020-02-05 14:16:58 -08:00
|
|
|
|
2019-11-08 15:58:28 -08:00
|
|
|
export PYTHON3_BIN_PATH="$PYTHON_EXECUTABLE"
|
2019-04-02 22:17:33 -07:00
|
|
|
|
|
|
|
if [ "$RAY_BUILD_JAVA" == "YES" ]; then
|
2020-01-10 11:41:00 +08:00
|
|
|
"$BAZEL_EXECUTABLE" build //java:ray_java_pkg --verbose_failures
|
2019-04-02 22:17:33 -07:00
|
|
|
fi
|
2019-03-22 14:30:05 +08:00
|
|
|
|
2019-04-02 22:17:33 -07:00
|
|
|
if [ "$RAY_BUILD_PYTHON" == "YES" ]; then
|
2019-10-26 20:46:55 -07:00
|
|
|
"$BAZEL_EXECUTABLE" build //:ray_pkg --verbose_failures
|
2019-02-23 11:58:59 -08:00
|
|
|
fi
|
2018-05-19 10:09:23 +08:00
|
|
|
|
2016-11-18 19:57:51 -08:00
|
|
|
popd
|