mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 07:04:46 +08:00
Package ray java jars into wheels (#6600)
This commit is contained in:
@@ -207,3 +207,30 @@ genrule(
|
||||
local = 1,
|
||||
tags = ["no-cache"],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "ray_dist",
|
||||
# This rule is used to package all Ray Java code and the third-party dependencies into a
|
||||
# fat jar file. It's not really an executable jar. So we set its `main_class` to empty.
|
||||
main_class = "",
|
||||
runtime_deps = [
|
||||
"//java:org_ray_ray_api",
|
||||
"//java:org_ray_ray_runtime",
|
||||
"//streaming/java:org_ray_ray_streaming-api",
|
||||
"//streaming/java:org_ray_ray_streaming-runtime",
|
||||
]
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "ray_java_pkg",
|
||||
srcs = ["//java:ray_dist_deploy.jar"],
|
||||
outs = ["ray_java_pkg.out"],
|
||||
cmd = """
|
||||
WORK_DIR=$$(pwd)
|
||||
rm -rf $$WORK_DIR/python/ray/jars && mkdir -p $$WORK_DIR/python/ray/jars
|
||||
cp -f $(location //java:ray_dist_deploy.jar) $$WORK_DIR/python/ray/jars/ray_dist.jar
|
||||
echo $$(date) > $@
|
||||
""",
|
||||
local = 1,
|
||||
tags = ["no-cache"],
|
||||
)
|
||||
|
||||
@@ -21,6 +21,12 @@ echo "Linting Java code with checkstyle."
|
||||
# Thus, we add the `build_tests_only` option to avoid re-building everything.
|
||||
bazel test //java:all --test_tag_filters="checkstyle" --build_tests_only
|
||||
|
||||
echo "Build java maven deps."
|
||||
bazel build //java:gen_maven_deps
|
||||
|
||||
echo "Build test jar."
|
||||
bazel build //java:all_tests_deploy.jar
|
||||
|
||||
echo "Running tests under cluster mode."
|
||||
# TODO(hchen): Ideally, we should use the following bazel command to run Java tests. However, if there're skipped tests,
|
||||
# TestNG will exit with code 2. And bazel treats it as test failure.
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -71,9 +73,15 @@ public abstract class BaseMultiLanguageTest {
|
||||
|
||||
String nodeManagerPort = String.valueOf(NetworkUtil.getUnusedPort());
|
||||
|
||||
// Start ray cluster.
|
||||
// jars in the `ray` wheel doesn't contains test classes, so we add test classes explicitly.
|
||||
// Since mvn test classes contains `test` in path and bazel test classes is located at a jar
|
||||
// with `test` included in the name, we can check classpath `test` to filter out test classes.
|
||||
String classpath = Stream.of(System.getProperty("java.class.path").split(":"))
|
||||
.filter(s -> !s.contains(" ") && s.contains("test"))
|
||||
.collect(Collectors.joining(":"));
|
||||
String workerOptions =
|
||||
" -classpath " + System.getProperty("java.class.path");
|
||||
" -classpath " + classpath;
|
||||
// Start ray cluster.
|
||||
List<String> startCommand = ImmutableList.of(
|
||||
"ray",
|
||||
"start",
|
||||
|
||||
Reference in New Issue
Block a user