mirror of
https://github.com/wassname/ray.git
synced 2026-07-10 06:28:16 +08:00
Fix .exe file extensions (#9197)
Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
+14
-35
@@ -1754,43 +1754,22 @@ filegroup(
|
||||
]),
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "redis",
|
||||
srcs = [
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"@com_github_tporadowski_redis_bin//file",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"@com_github_antirez_redis//:file", # This is necessary so we can access the root of the directory
|
||||
"@com_github_antirez_redis//:files", # This is necessary to ensure entire directory tree is accessible
|
||||
],
|
||||
alias(
|
||||
name = "redis-server",
|
||||
actual = select({
|
||||
"@bazel_tools//src/conditions:windows": "@com_github_tporadowski_redis_bin//:redis-server.exe",
|
||||
"//conditions:default": "@com_github_antirez_redis//:redis-server",
|
||||
}),
|
||||
outs = [
|
||||
"redis-server",
|
||||
"redis-cli",
|
||||
],
|
||||
cmd = select({
|
||||
"@bazel_tools//src/conditions:windows": """
|
||||
unzip -q -o -- $(location @com_github_tporadowski_redis_bin//file) redis-server.exe redis-cli.exe &&
|
||||
mv -f -- redis-server.exe $(location redis-server) &&
|
||||
mv -f -- redis-cli.exe $(location redis-cli)
|
||||
""",
|
||||
"//conditions:default": """
|
||||
tmpdir="redis.tmp" &&
|
||||
path=$(location @com_github_antirez_redis//:file) &&
|
||||
cp -p -L -R -- "$${path%/*}" "$${tmpdir}" &&
|
||||
chmod +x "$${tmpdir}"/deps/jemalloc/configure &&
|
||||
parallel="$$(getconf _NPROCESSORS_ONLN || echo 1)"
|
||||
make -s -C "$${tmpdir}" -j"$${parallel}" V=0 CFLAGS="$${CFLAGS-} -DLUA_USE_MKSTEMP -Wno-pragmas -Wno-empty-body" &&
|
||||
mv "$${tmpdir}"/src/redis-server $(location redis-server) &&
|
||||
chmod +x $(location redis-server) &&
|
||||
mv "$${tmpdir}"/src/redis-cli $(location redis-cli) &&
|
||||
chmod +x $(location redis-cli) &&
|
||||
rm -r -f -- "$${tmpdir}"
|
||||
""",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "redis-cli",
|
||||
actual = select({
|
||||
"@bazel_tools//src/conditions:windows": "@com_github_tporadowski_redis_bin//:redis-cli.exe",
|
||||
"//conditions:default": "@com_github_antirez_redis//:redis-cli",
|
||||
}),
|
||||
visibility = ["//java:__subpackages__"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
|
||||
+25
-6
@@ -1,12 +1,31 @@
|
||||
filegroup(
|
||||
name = "files",
|
||||
srcs = glob(["**"]),
|
||||
exports_files(
|
||||
[
|
||||
"redis-server.exe",
|
||||
"redis-cli.exe",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "file",
|
||||
srcs = ["Makefile"],
|
||||
genrule(
|
||||
name = "bin",
|
||||
srcs = glob(["**"]),
|
||||
outs = [
|
||||
"redis-server",
|
||||
"redis-cli",
|
||||
],
|
||||
cmd = """
|
||||
tmpdir="redis.tmp"
|
||||
path=$(location Makefile)
|
||||
cp -p -L -R -- "$${path%/*}" "$${tmpdir}"
|
||||
chmod +x "$${tmpdir}"/deps/jemalloc/configure
|
||||
parallel="$$(getconf _NPROCESSORS_ONLN || echo 1)"
|
||||
make -s -C "$${tmpdir}" -j"$${parallel}" V=0 CFLAGS="$${CFLAGS-} -DLUA_USE_MKSTEMP -Wno-pragmas -Wno-empty-body"
|
||||
mv "$${tmpdir}"/src/redis-server $(location redis-server)
|
||||
chmod +x $(location redis-server)
|
||||
mv "$${tmpdir}"/src/redis-cli $(location redis-cli)
|
||||
chmod +x $(location redis-cli)
|
||||
rm -r -f -- "$${tmpdir}"
|
||||
""",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
@@ -100,10 +100,12 @@ def ray_deps_setup():
|
||||
],
|
||||
)
|
||||
|
||||
http_file(
|
||||
auto_http_archive(
|
||||
name = "com_github_tporadowski_redis_bin",
|
||||
build_file = "//bazel:BUILD.redis",
|
||||
strip_prefix = None,
|
||||
url = "https://github.com/tporadowski/redis/releases/download/v4.0.14.2/Redis-x64-4.0.14.2.zip",
|
||||
sha256 = "6fac443543244c803311de5883b714a7ae3c4fa0594cad51d75b24c4ef45b353",
|
||||
urls = ["https://github.com/tporadowski/redis/releases/download/v4.0.14.2/Redis-x64-4.0.14.2.zip"],
|
||||
)
|
||||
|
||||
auto_http_archive(
|
||||
|
||||
@@ -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_NAME);
|
||||
rayConfig.sessionDir, BinaryFileUtil.REDIS_SERVER_BINARY_PATH);
|
||||
Preconditions.checkState(redisServerFile.setExecutable(true));
|
||||
List<String> command = Lists.newArrayList(
|
||||
// The redis-server executable file.
|
||||
|
||||
@@ -11,7 +11,9 @@ import java.nio.file.Paths;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
public class BinaryFileUtil {
|
||||
public static final String REDIS_SERVER_BINARY_NAME = "redis-server";
|
||||
// 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 GCS_SERVER_BINARY_NAME = "gcs_server";
|
||||
|
||||
@@ -30,10 +32,11 @@ public class BinaryFileUtil {
|
||||
* directory concurrently, this operation will be protected by a file lock.
|
||||
*
|
||||
* @param destDir a directory to extract resource file to
|
||||
* @param fileName resource file name
|
||||
* @param filePath resource file path
|
||||
* @return extracted resource file
|
||||
*/
|
||||
public static File getFile(String destDir, String fileName) {
|
||||
public static File getFile(String destDir, String filePath) {
|
||||
String fileName = new File(filePath).getName();
|
||||
final File dir = new File(destDir);
|
||||
if (!dir.exists()) {
|
||||
try {
|
||||
@@ -51,11 +54,11 @@ public class BinaryFileUtil {
|
||||
}
|
||||
|
||||
// File does not exist.
|
||||
try (InputStream is = BinaryFileUtil.class.getResourceAsStream("/" + fileName)) {
|
||||
Preconditions.checkNotNull(is, "{} doesn't exist.", fileName);
|
||||
try (InputStream is = BinaryFileUtil.class.getResourceAsStream("/" + filePath)) {
|
||||
Preconditions.checkNotNull(is, "{} doesn't exist.", filePath);
|
||||
Files.copy(is, Paths.get(file.getCanonicalPath()));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Couldn't get temp file from resource " + fileName, e);
|
||||
throw new RuntimeException("Couldn't get temp file from resource " + filePath, e);
|
||||
}
|
||||
return file;
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -23,6 +23,8 @@ resource = None
|
||||
if sys.platform != "win32":
|
||||
import resource
|
||||
|
||||
EXE_SUFFIX = ".exe" if sys.platform == "win32" else ""
|
||||
|
||||
# True if processes are run in the valgrind profiler.
|
||||
RUN_RAYLET_PROFILER = False
|
||||
RUN_PLASMA_STORE_PROFILER = False
|
||||
@@ -31,7 +33,7 @@ RUN_PLASMA_STORE_PROFILER = False
|
||||
RAY_HOME = os.path.join(os.path.dirname(__file__), "../..")
|
||||
REDIS_EXECUTABLE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/ray/thirdparty/redis/src/redis-server")
|
||||
"core/src/ray/thirdparty/redis/src/redis-server" + EXE_SUFFIX)
|
||||
REDIS_MODULE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/ray/gcs/redis_module/libray_redis_module.so")
|
||||
@@ -40,7 +42,7 @@ REDIS_MODULE = os.path.join(
|
||||
# credis will be enabled if the environment variable RAY_USE_NEW_GCS is set.
|
||||
CREDIS_EXECUTABLE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/credis/redis/src/redis-server")
|
||||
"core/src/credis/redis/src/redis-server" + EXE_SUFFIX)
|
||||
CREDIS_MASTER_MODULE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/credis/build/src/libmaster.so")
|
||||
@@ -51,13 +53,15 @@ CREDIS_MEMBER_MODULE = os.path.join(
|
||||
# Location of the plasma object store executable.
|
||||
PLASMA_STORE_EXECUTABLE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/plasma/plasma_store_server")
|
||||
"core/src/plasma/plasma_store_server" + EXE_SUFFIX)
|
||||
|
||||
# Location of the raylet executables.
|
||||
RAYLET_EXECUTABLE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), "core/src/ray/raylet/raylet")
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/ray/raylet/raylet" + EXE_SUFFIX)
|
||||
GCS_SERVER_EXECUTABLE = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), "core/src/ray/gcs/gcs_server")
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
"core/src/ray/gcs/gcs_server" + EXE_SUFFIX)
|
||||
|
||||
DEFAULT_JAVA_WORKER_CLASSPATH = [
|
||||
os.path.join(
|
||||
|
||||
@@ -9,6 +9,7 @@ import time
|
||||
import socket
|
||||
|
||||
import ray
|
||||
import ray.services
|
||||
|
||||
import psutil # We must import psutil after ray because we bundle it with ray.
|
||||
|
||||
@@ -87,7 +88,7 @@ def wait_for_children_of_pid_to_exit(pid, timeout=20):
|
||||
|
||||
def kill_process_by_name(name, SIGKILL=False):
|
||||
for p in psutil.process_iter(attrs=["name"]):
|
||||
if p.info["name"] == name:
|
||||
if p.info["name"] == name + ray.services.EXE_SUFFIX:
|
||||
if SIGKILL:
|
||||
p.kill()
|
||||
else:
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ pyd_suffix = ".pyd" if sys.platform == "win32" else ".so"
|
||||
|
||||
# NOTE: The lists below must be kept in sync with ray/BUILD.bazel.
|
||||
ray_files = [
|
||||
"ray/core/src/ray/thirdparty/redis/src/redis-server",
|
||||
"ray/core/src/ray/thirdparty/redis/src/redis-server" + exe_suffix,
|
||||
"ray/core/src/ray/gcs/redis_module/libray_redis_module.so",
|
||||
"ray/core/src/plasma/plasma_store_server" + exe_suffix,
|
||||
"ray/_raylet" + pyd_suffix,
|
||||
@@ -76,7 +76,7 @@ if "RAY_USE_NEW_GCS" in os.environ and os.environ["RAY_USE_NEW_GCS"] == "on":
|
||||
ray_files += [
|
||||
"ray/core/src/credis/build/src/libmember.so",
|
||||
"ray/core/src/credis/build/src/libmaster.so",
|
||||
"ray/core/src/credis/redis/src/redis-server"
|
||||
"ray/core/src/credis/redis/src/redis-server" + exe_suffix,
|
||||
]
|
||||
|
||||
extras = {
|
||||
|
||||
@@ -46,7 +46,7 @@ if [ ! -d "$RAY_ROOT/python" ]; then
|
||||
fi
|
||||
|
||||
REDIS_MODULE="./bazel-bin/libray_redis_module.so"
|
||||
REDIS_SERVER_EXEC="./bazel-bin/redis-server"
|
||||
REDIS_SERVER_EXEC="./bazel-bin/external/com_github_antirez_redis/redis-server"
|
||||
STORE_EXEC="./bazel-bin/plasma_store_server"
|
||||
REDIS_CLIENT_EXEC="./bazel-bin/redis-cli"
|
||||
RAYLET_EXEC="./bazel-bin/raylet"
|
||||
|
||||
Reference in New Issue
Block a user