-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[Java] Build Java code with Bazel #4284
Conversation
…nce/ray into ruifang.crf_stage
Note that, after removing |
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.
Thanks for submitting this! I left some quick comments. Will also try it out myself.
java/test.sh
Outdated
pushd $ROOT_DIR/../java/test | ||
java -jar -Dray.home=$ROOT_DIR/../ -Djava.library.path=$ROOT_DIR/../bazel-bin:$ROOT_DIR/../bazel-bin/externl/plasma:$ROOT_DIR/../bazel-genfiles $ROOT_DIR/../bazel-bin/java/AllTests_deploy.jar $ROOT_DIR/../java/testng.xml | ||
|
||
java -jar -Dray.home=$ROOT_DIR/../ -Dray.run-mode=SINGLE_PROCESS -Djava.library.path=$ROOT_DIR/../bazel-bin:$ROOT_DIR/../bazel-bin/externl/plasma:$ROOT_DIR/../bazel-genfiles $ROOT_DIR/../bazel-bin/java/AllTests_deploy.jar $ROOT_DIR/../java/testng.xml |
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.
It seems that you already link the binaries to /build/...
. Why do we still need to overwrite -Djava.library.path
?
BTW, I'm refining also this script at #4265.
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.
also, it seems that we're not running checkstyle
in bazel?
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.
It seems that you already link the binaries to
/build/...
. Why do we still need to overwrite-Djava.library.path
?BTW, I'm refining also this script at #4265.
I forgot to delete the -Djava.library.path. I will fix it in this pr.
build.sh
Outdated
cp -r $ROOT_DIR/bazel-genfiles/ray_pkg/ray $ROOT_DIR/python || true | ||
|
||
if [ "$RAY_BUILD_JAVA" == "YES" ]; then | ||
bazel build //:ray_java_pkg -c opt |
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.
The arrow python package is now downloaded from AWS. It looks like arrow Java package still goes with the old way, say, downloading source files from GitHub and building locally. I remember there is a special fix for arrow to enable bazel. Is that special fix only for Python? @pcmoritz
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.
We download the pyarrow files from AWS because it is compile differently from the official pyarrow package. This only concerns the python part (the official package is not compatible with the official tensorflow wheels).
I run the test locally and got the following error:
It seems that we need to chmod the generated files. |
Also, we need to delete this to make Java CI job run on bazel. Line 28 in ff5e338
|
The same to me. This could be reprod on mac. |
Test FAILed. |
I forgot to be compatible with the mac system, i will fix it in the pr. |
delete the setting of -Djava.library.path
Modified according to the recommendations of raulchen Co-Authored-By: alegithub111 <ruif_chen111@126.com>
Modified according to the recommendations of raulchen
Modified according to the recommendations of raulchen
…nce/ray into ruifang.crf_stage
add the mvn ckeckstyle
Revert accidentally deleted code
Delete useless comments
build.sh
Outdated
ln -sf $ROOT_DIR/bazel-genfiles/redis-server $ROOT_DIR/build/src/ray/thirdparty/redis/src/redis-server | ||
ln -sf $ROOT_DIR/bazel-bin/ray_redis_module.so $ROOT_DIR/build/src/ray/gcs/redis_module/libray_redis_module.so | ||
ln -sf $ROOT_DIR/bazel-bin/external/plasma/plasma_store_server $ROOT_DIR/build/src/plasma/plasma_store_server | ||
ln -sf $ROOT_DIR/bazel-bin/raylet $ROOT_DIR/build/src/ray/raylet/raylet |
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.
maybe just link these files to java/build
(also need to change code accordingly). because after this PR, we don't need to support cmake.
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.
if don't support cmake, we can delete these links and change the code.
java/build.sh
Outdated
@@ -1,3 +1,3 @@ | |||
#!/usr/bin/env bash | |||
|
|||
mvn clean install -Dmaven.test.skip | |||
bazel build -c opt //java:all |
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.
IIRC, this file isn't being used any more, we can just delete it.
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.
leave the job to developers
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.
if it's not used, the file should be deleted as part of this PR I'd say
bazel/ray_java.bzl
Outdated
@@ -0,0 +1,1577 @@ | |||
# The following dependencies were calculated from: |
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.
If we don't auto-generate this file in this PR, let's leave a TODO
comment here to take a note.
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.
OK
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.
So do we truely need all these dependencies? It seems to me that this file could be slimmed down a lot, for example GRPC should not be needed to build this.
Test FAILed. |
This reverts commit b504a22.
Test FAILed. |
Test FAILed. |
Test FAILed. |
Test FAILed. |
This reverts commit ba2b535.
Test PASSed. |
This reverts commit 101fbd1.
Fixed some bugs, and CI is finally passing. |
@raulchen: Awesome! #4385 is done now and just needs to be merged, see apache/arrow#4001. I'm also happy to merge this one first, depending on which one is ready first. One thing I still don't like about this is that |
@pcmoritz |
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.
Ok, sounds good to me!
@pcmoritz Thanks. I'll merge this one first. |
Test PASSed. |
After this PR, we can build Java code with Bazel as well.
To build Ray Java code, we should build Ray C++ code for Java as the following commands(under
ray
directory) firstly:then
Then the Ray jar package will stand under generated directory.
Also, we can run Java tests by following
java/test.sh
Related issue number
Fixes #4273