mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 20:53:14 +08:00
[Java] fix redis-server binary path (#9398)
This commit is contained in:
+10
-1
@@ -155,15 +155,24 @@ genrule(
|
||||
""",
|
||||
)
|
||||
|
||||
# `//:redis-server`'s full path is `external/com_github_antirez_redis/redis-server`,
|
||||
# This rule removes the prefix, and only keeps `redis-server`.
|
||||
genrule(
|
||||
name = "redis-server-without-prefix",
|
||||
srcs = ["//:redis-server"],
|
||||
outs = ["redis-server"],
|
||||
cmd = "cp $< $@",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "java_native_deps",
|
||||
srcs = [
|
||||
":cp_plasma_store_server",
|
||||
":redis-server-without-prefix",
|
||||
"//:core_worker_library_java",
|
||||
"//:gcs_server",
|
||||
"//:libray_redis_module.so",
|
||||
"//:raylet",
|
||||
"//:redis-server",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ public class RunManager {
|
||||
|
||||
private String startRedisInstance(String ip, int port, String password, Integer shard) {
|
||||
final File redisServerFile = BinaryFileUtil.getFile(
|
||||
rayConfig.sessionDir, BinaryFileUtil.REDIS_SERVER_BINARY_PATH);
|
||||
rayConfig.sessionDir, BinaryFileUtil.REDIS_SERVER_BINARY_NAME);
|
||||
Preconditions.checkState(redisServerFile.setExecutable(true));
|
||||
List<String> command = Lists.newArrayList(
|
||||
// The redis-server executable file.
|
||||
|
||||
@@ -11,9 +11,7 @@ import java.nio.file.Paths;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
public class BinaryFileUtil {
|
||||
// We use a path here because the top-level Bazel target is an alias
|
||||
public static final String REDIS_SERVER_BINARY_PATH =
|
||||
"external/com_github_antirez_redis/redis-server";
|
||||
public static final String REDIS_SERVER_BINARY_NAME = "redis-server";
|
||||
|
||||
public static final String GCS_SERVER_BINARY_NAME = "gcs_server";
|
||||
|
||||
@@ -32,11 +30,10 @@ public class BinaryFileUtil {
|
||||
* directory concurrently, this operation will be protected by a file lock.
|
||||
*
|
||||
* @param destDir a directory to extract resource file to
|
||||
* @param filePath resource file path
|
||||
* @param fileName resource file name
|
||||
* @return extracted resource file
|
||||
*/
|
||||
public static File getFile(String destDir, String filePath) {
|
||||
String fileName = new File(filePath).getName();
|
||||
public static File getFile(String destDir, String fileName) {
|
||||
final File dir = new File(destDir);
|
||||
if (!dir.exists()) {
|
||||
try {
|
||||
@@ -54,11 +51,11 @@ public class BinaryFileUtil {
|
||||
}
|
||||
|
||||
// File does not exist.
|
||||
try (InputStream is = BinaryFileUtil.class.getResourceAsStream("/" + filePath)) {
|
||||
Preconditions.checkNotNull(is, "{} doesn't exist.", filePath);
|
||||
try (InputStream is = BinaryFileUtil.class.getResourceAsStream("/" + fileName)) {
|
||||
Preconditions.checkNotNull(is, "{} doesn't exist.", fileName);
|
||||
Files.copy(is, Paths.get(file.getCanonicalPath()));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Couldn't get temp file from resource " + filePath, e);
|
||||
throw new RuntimeException("Couldn't get temp file from resource " + fileName, e);
|
||||
}
|
||||
return file;
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -47,4 +47,6 @@ popd
|
||||
pushd $ROOT_DIR
|
||||
echo "Testing maven install."
|
||||
mvn -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN clean install -DskipTests
|
||||
# Ensure mvn test works
|
||||
mvn test -pl test -Dtest="io.ray.test.HelloWorldTest"
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user