-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Bazel the default build system #3898
Changes from all commits
cbedf31
20c529a
61fa6cf
7726166
8c2aec3
70ae8dd
cb7888a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ matrix: | |
env: | ||
- JDK='Oracle JDK 8' | ||
- PYTHON=3.5 PYTHONWARNINGS=ignore | ||
- RAY_USE_CMAKE=1 | ||
install: | ||
- ./ci/travis/install-dependencies.sh | ||
- export PATH="$HOME/miniconda/bin:$PATH" | ||
|
@@ -38,7 +39,7 @@ matrix: | |
|
||
- os: linux | ||
dist: trusty | ||
env: LINT=1 PYTHONWARNINGS=ignore | ||
env: LINT=1 PYTHONWARNINGS=ignore RAY_USE_CMAKE=1 | ||
before_install: | ||
# In case we ever want to use a different version of clang-format: | ||
#- wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
|
@@ -76,7 +77,7 @@ matrix: | |
|
||
- os: linux | ||
dist: trusty | ||
env: VALGRIND=1 PYTHON=2.7 PYTHONWARNINGS=ignore | ||
env: VALGRIND=1 PYTHON=2.7 PYTHONWARNINGS=ignore RAY_USE_CMAKE=1 | ||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq valgrind | ||
|
@@ -107,7 +108,7 @@ matrix: | |
# Build Linux wheels. | ||
- os: linux | ||
dist: trusty | ||
env: LINUX_WHEELS=1 PYTHONWARNINGS=ignore | ||
env: LINUX_WHEELS=1 PYTHONWARNINGS=ignore RAY_USE_CMAKE=1 | ||
install: | ||
- ./ci/travis/install-dependencies.sh | ||
# This command should be kept in sync with ray/python/README-building-wheels.md. | ||
|
@@ -118,7 +119,7 @@ matrix: | |
# Build MacOS wheels. | ||
- os: osx | ||
osx_image: xcode7 | ||
env: MAC_WHEELS=1 PYTHONWARNINGS=ignore | ||
env: MAC_WHEELS=1 PYTHONWARNINGS=ignore RAY_USE_CMAKE=1 | ||
install: | ||
- ./ci/travis/install-dependencies.sh | ||
# This command should be kept in sync with ray/python/README-building-wheels.md. | ||
|
@@ -133,28 +134,28 @@ matrix: | |
- PYTHON=3.5 | ||
- RAY_USE_NEW_GCS=on | ||
- PYTHONWARNINGS=ignore | ||
- RAY_USE_CMAKE=1 | ||
|
||
|
||
install: | ||
- ./ci/travis/install-bazel.sh | ||
- ./ci/travis/install-dependencies.sh | ||
- export PATH="$HOME/miniconda/bin:$PATH" | ||
- ./ci/travis/install-ray.sh | ||
- ./ci/travis/install-cython-examples.sh | ||
|
||
- cd build | ||
- bash ../src/ray/test/run_gcs_tests.sh | ||
- bash src/ray/test/run_gcs_tests.sh | ||
# Raylet tests. | ||
- bash ../src/ray/test/run_object_manager_tests.sh | ||
- ./src/ray/raylet/task_test | ||
- ./src/ray/raylet/worker_pool_test | ||
- ./src/ray/raylet/lineage_cache_test | ||
- ./src/ray/raylet/task_dependency_manager_test | ||
- ./src/ray/raylet/reconstruction_policy_test | ||
- ./src/ray/raylet/client_connection_test | ||
- ./src/ray/util/logging_test --gtest_filter=PrintLogTest* | ||
- ./src/ray/util/signal_test | ||
|
||
- cd .. | ||
- bash src/ray/test/run_object_manager_tests.sh | ||
- bazel build "//:task_test" "//:worker_pool_test" "//:lineage_cache_test" "//:task_dependency_manager_test" "//:reconstruction_policy_test" "//:client_connection_test" "//:logging_test" "//:signal_test" -c opt | ||
- ./bazel-bin/task_test | ||
- ./bazel-bin/worker_pool_test | ||
- ./bazel-bin/lineage_cache_test | ||
- ./bazel-bin/task_dependency_manager_test | ||
- ./bazel-bin/reconstruction_policy_test | ||
- ./bazel-bin/client_connection_test | ||
- ./bazel-bin/logging_test --gtest_filter=PrintLogTest* | ||
- ./bazel-bin/signal_test | ||
|
||
script: | ||
- export PATH="$HOME/miniconda/bin:$PATH" | ||
|
@@ -174,10 +175,10 @@ script: | |
- python -m pytest -v --durations=10 python/ray/tune/test/automl_searcher_test.py | ||
|
||
# ray rllib tests | ||
- python -m pytest -v --durations=10 python/ray/rllib/test/test_catalog.py | ||
- python -m pytest -v --durations=10 python/ray/rllib/test/test_filters.py | ||
- python -m pytest -v --durations=10 python/ray/rllib/test/test_optimizers.py | ||
- python -m pytest -v --durations=10 python/ray/rllib/test/test_evaluators.py | ||
- python python/ray/rllib/test/test_catalog.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The --pyargs ray argument doesn't work here (it would try to execute all tests, but some are to be executed only in jenkins); this is temporary anyways, so I think it's fine (see #4031 for context) |
||
- python python/ray/rllib/test/test_filters.py | ||
- python python/ray/rllib/test/test_optimizers.py | ||
- python python/ray/rllib/test/test_evaluators.py | ||
|
||
# Python3.5+ only. Otherwise we will get `SyntaxError` regardless of how we set the tester. | ||
- python -c 'import sys;exit(sys.version_info>=(3,5))' || python -m pytest -v --durations=10 python/ray/experimental/test/async_test.py | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,26 @@ cc_test( | |
], | ||
) | ||
|
||
cc_test( | ||
name = "client_connection_test", | ||
srcs = ["src/ray/raylet/client_connection_test.cc"], | ||
copts = COPTS, | ||
deps = [ | ||
":raylet_lib", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) | ||
|
||
cc_test( | ||
name = "signal_test", | ||
srcs = ["src/ray/util/signal_test.cc"], | ||
copts = COPTS, | ||
deps = [ | ||
":raylet_lib", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "object_manager", | ||
srcs = glob([ | ||
|
@@ -403,6 +423,7 @@ flatbuffer_py_library( | |
"src/ray/gcs/format/gcs.fbs", | ||
], | ||
outs = [ | ||
"ActorCheckpointIdData.py", | ||
"ActorState.py", | ||
"ActorTableData.py", | ||
"Arg.py", | ||
|
@@ -412,6 +433,7 @@ flatbuffer_py_library( | |
"CustomSerializerData.py", | ||
"DriverTableData.py", | ||
"ErrorTableData.py", | ||
"ErrorType.py", | ||
"FunctionTableData.py", | ||
"GcsTableEntry.py", | ||
"HeartbeatBatchTableData.py", | ||
|
@@ -470,6 +492,9 @@ filegroup( | |
srcs = glob([ | ||
"python/ray/*.py", | ||
"python/ray/autoscaler/*.py", | ||
"python/ray/autoscaler/aws/example-full.yaml", | ||
"python/ray/autoscaler/gcp/example-full.yaml", | ||
"python/ray/autoscaler/local/example-full.yaml", | ||
"python/ray/cloudpickle/*.py", | ||
"python/ray/core/__init__.py", | ||
"python/ray/core/generated/__init__.py", | ||
|
@@ -484,25 +509,31 @@ filegroup( | |
|
||
genrule( | ||
name = "redis", | ||
outs = ["redis-server"], | ||
outs = [ | ||
"redis-server", | ||
"redis-cli", | ||
], | ||
cmd = """ | ||
set -x && | ||
curl -sL \"https://github.com/antirez/redis/archive/5.0.3.tar.gz\" | tar xz --strip-components=1 -C . && | ||
make && | ||
mv ./src/redis-server $(location redis-server) | ||
mv ./src/redis-server $(location redis-server) && | ||
chmod +x $(location redis-server) && | ||
mv ./src/redis-cli $(location redis-cli) && | ||
chmod +x $(location redis-cli) | ||
""", | ||
) | ||
|
||
cc_library( | ||
name = "ray_redis_module", | ||
cc_binary( | ||
name = "ray_redis_module.so", | ||
srcs = [ | ||
"src/ray/gcs/redis_module/ray_redis_module.cc", | ||
"src/ray/util/logging.cc", | ||
], | ||
hdrs = [ | ||
"src/ray/gcs/redis_module/redis_string.h", | ||
"src/ray/gcs/redis_module/redismodule.h", | ||
], | ||
copts = COPTS, | ||
linkshared = 1, | ||
linkstatic = 1, | ||
deps = [ | ||
":ray_common", | ||
], | ||
|
@@ -516,12 +547,11 @@ genrule( | |
"//:python_gcs_fbs", | ||
"//:python_node_manager_fbs", | ||
"//:redis-server", | ||
"//:ray_redis_module", | ||
"//:redis-cli", | ||
"//:ray_redis_module.so", | ||
"//:raylet", | ||
"//:raylet_monitor", | ||
"@plasma//:plasma_store_server", | ||
"@plasma//:plasma_client_java", | ||
"//:raylet_library_java", | ||
], | ||
outs = ["ray_pkg"], | ||
cmd = """ | ||
|
@@ -530,16 +560,17 @@ genrule( | |
cp $(location python/ray/_raylet.so) python/ray && | ||
mkdir -p python/ray/core/src/ray/thirdparty/redis/src/ && | ||
cp $(location //:redis-server) python/ray/core/src/ray/thirdparty/redis/src/ && | ||
cp $(location //:redis-cli) python/ray/core/src/ray/thirdparty/redis/src/ && | ||
mkdir -p python/ray/core/src/ray/gcs/redis_module/ && | ||
for f in $(locations //:ray_redis_module); do cp $$f python/ray/core/src/ray/gcs/redis_module/; done && | ||
cp $(locations //:ray_redis_module.so) python/ray/core/src/ray/gcs/redis_module/libray_redis_module.so && | ||
mkdir -p python/ray/core/src/ray/raylet/ && | ||
cp $(location //:raylet_monitor) python/ray/core/src/ray/raylet/ && | ||
mkdir -p python/ray/core/src/plasma && | ||
cp $(location @plasma//:plasma_store_server) python/ray/core/src/plasma/ && | ||
cp $(location //:raylet) python/ray/core/src/ray/raylet/ && | ||
mv python $(location ray_pkg) && | ||
mkdir -p $(location ray_pkg)/java_lib && | ||
cp $(location @plasma//:plasma_client_java) $(location ray_pkg)/java_lib && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @guoyuhong We probably need a flag of some sort that only compiles the java extensions if the jdk is installed. Let's do this when we switch the jdk build over to bazel! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pcmoritz That is fine to me~ |
||
cp $(location //:raylet_library_java) $(location ray_pkg)/java_lib | ||
for f in $(locations //:python_gcs_fbs); do cp $$f python/ray/core/generated/; done && | ||
mkdir -p python/ray/core/generated/ray/protocol/ && | ||
for f in $(locations //:python_node_manager_fbs); do cp $$f python/ray/core/generated/ray/protocol/; done && | ||
mv python $(location ray_pkg) | ||
""", | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ function usage() | |
# Determine how many parallel jobs to use for make based on the number of cores | ||
unamestr="$(uname)" | ||
if [[ "$unamestr" == "Linux" ]]; then | ||
PARALLEL=$(nproc) | ||
PARALLEL=1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without this, I'm getting the bad filedescriptor error from #3767 in the valgrind build. It doesn't impact build times too much and this will go away soon anyways. |
||
elif [[ "$unamestr" == "Darwin" ]]; then | ||
PARALLEL=$(sysctl -n hw.ncpu) | ||
else | ||
|
@@ -101,16 +101,29 @@ fi | |
|
||
pushd "$BUILD_DIR" | ||
|
||
# avoid the command failed and exits | ||
# and cmake will check some directories to determine whether some targets built | ||
make clean || true | ||
rm -rf external/arrow-install | ||
if [ ! -z "$RAY_USE_CMAKE" ] ; then | ||
# avoid the command failed and exits | ||
# and cmake will check some directories to determine whether some targets built | ||
make clean || true | ||
rm -rf external/arrow-install | ||
|
||
cmake -DCMAKE_BUILD_TYPE=$CBUILD_TYPE \ | ||
-DCMAKE_RAY_LANG_JAVA=$RAY_BUILD_JAVA \ | ||
-DCMAKE_RAY_LANG_PYTHON=$RAY_BUILD_PYTHON \ | ||
-DRAY_USE_NEW_GCS=$RAY_USE_NEW_GCS \ | ||
-DPYTHON_EXECUTABLE:FILEPATH=$PYTHON_EXECUTABLE $ROOT_DIR | ||
cmake -DCMAKE_BUILD_TYPE=$CBUILD_TYPE \ | ||
-DCMAKE_RAY_LANG_JAVA=$RAY_BUILD_JAVA \ | ||
-DCMAKE_RAY_LANG_PYTHON=$RAY_BUILD_PYTHON \ | ||
-DRAY_USE_NEW_GCS=$RAY_USE_NEW_GCS \ | ||
-DPYTHON_EXECUTABLE:FILEPATH=$PYTHON_EXECUTABLE $ROOT_DIR | ||
|
||
make -j${PARALLEL} | ||
else | ||
# The following line installs pyarrow from S3, these wheels have been | ||
# generated from https://github.com/ray-project/arrow-build from | ||
# the commit listed in the command. | ||
$PYTHON_EXECUTABLE -m pip install \ | ||
--target=$ROOT_DIR/python/ray/pyarrow_files pyarrow==0.12.0-RAY \ | ||
--find-links https://s3-us-west-2.amazonaws.com/arrow-wheels/bf0f3a15e0d6583cfaedbca508627b06746fa41a/index.html | ||
bazel build //:ray_pkg -c opt | ||
# Copy files and skip existing files | ||
cp -r -n $ROOT_DIR/bazel-genfiles/ray_pkg/ray $ROOT_DIR/python || true | ||
fi | ||
|
||
make -j${PARALLEL} | ||
popd |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ flatbuffers | |
funcsigs | ||
mock | ||
numpy | ||
opencv-python | ||
opencv-python-headless | ||
pyarrow | ||
pyyaml | ||
recommonmark | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ echo 10 | |
EOF | ||
chmod +x /usr/bin/nproc | ||
|
||
export RAY_USE_CMAKE=1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed because this is run inside of docker (but will go away). |
||
|
||
PYTHONS=("cp27-cp27mu" | ||
"cp34-cp34m" | ||
"cp35-cp35m" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't be fooled, this will go away pretty soon, we don't intend keeping to support two build systems for long!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why introduce the flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because cmake is used for building the wheels and in the valgrind build (to do things a bit more incrementally).