Windows changes (#7315)

This commit is contained in:
mehrdadn 2020-02-27 15:14:10 -08:00 committed by GitHub
parent 0c9e5db9cb
commit 8730996682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 18 deletions

View file

@ -51,7 +51,7 @@ jobs:
--show_task_finish \
--show_timestamps \
--verbose_failures \
"//:*" # TODO(mehrdadn): Should be "//:*", but we get a linking error with _streaming.so
"//:*"
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
@ -99,4 +99,4 @@ jobs:
--show_task_finish \
--show_timestamps \
--verbose_failures \
"//:ray_pkg"
"//:ray_pkg" # TODO(mehrdadn): Should be "//:*", but we get a linking error with _streaming.so

View file

@ -1304,7 +1304,18 @@ genrule(
cmd = """
set -x &&
WORK_DIR="$$(pwd)" &&
cp -f $(location python/ray/_raylet.so) "$$WORK_DIR/python/ray" &&
RAYDIR="$$WORK_DIR/python/ray"
RAYLET="$(location python/ray/_raylet.so)"
RAYLET_TARGET_FILENAME="$${RAYLET##*/}" &&
if [ "$${OSTYPE-}" = "msys" ]; then
# If Windows, we need to do things differently (e.g. use .pyd instead of .so)
RAYLET_TARGET_FILENAME="$${RAYLET_TARGET_FILENAME%.*}" &&
RAYLET_TARGET_FILENAME="$${RAYLET_TARGET_FILENAME}.pyd" &&
if [ -f "$${RAYLET%.*}.pdb" ]; then
cp -f "$${RAYLET%.*}.pdb" "$${RAYDIR}";
fi;
fi &&
cp -f "$${RAYLET}" "$${RAYDIR}/$${RAYLET_TARGET_FILENAME}" &&
mkdir -p "$$WORK_DIR/python/ray/core/src/ray/thirdparty/redis/src/" &&
cp -f $(location //:redis-server) "$$WORK_DIR/python/ray/core/src/ray/thirdparty/redis/src/" &&
cp -f $(location //:redis-cli) "$$WORK_DIR/python/ray/core/src/ray/thirdparty/redis/src/" &&

View file

@ -32,7 +32,8 @@ sys.path.insert(0, thirdparty_files)
# Expose ray ABI symbols which may be dependent by other shared
# libraries such as _streaming.so. See BUILD.bazel:_raylet
so_path = os.path.join(dirname(__file__), "_raylet.so")
python_shared_lib_suffix = ".so" if sys.platform != "win32" else ".pyd"
so_path = os.path.join(dirname(__file__), "_raylet" + python_shared_lib_suffix)
if os.path.exists(so_path):
import ctypes
from ctypes import CDLL
@ -158,13 +159,3 @@ __all__ += [
"TaskID",
"UniqueID",
]
import ctypes # noqa: E402
# Windows only
if hasattr(ctypes, "windll"):
# Makes sure that all child processes die when we die. Also makes sure that
# fatal crashes result in process termination rather than an error dialog
# (the latter is annoying since we have a lot of processes). This is done
# by associating all child processes with a "job" object that imposes this
# behavior.
(lambda kernel32: (lambda job: (lambda n: kernel32.SetInformationJobObject(job, 9, "\0" * 17 + chr(0x8 | 0x4 | 0x20) + "\0" * (n - 18), n))(0x90 if ctypes.sizeof(ctypes.c_void_p) > ctypes.sizeof(ctypes.c_int) else 0x70) and kernel32.AssignProcessToJobObject(job, ctypes.c_void_p(kernel32.GetCurrentProcess())))(ctypes.c_void_p(kernel32.CreateJobObjectW(None, None))) if kernel32 is not None else None)(ctypes.windll.kernel32) # noqa: E501

View file

@ -6,7 +6,6 @@ import multiprocessing
import os
import random
import re
import resource
import socket
import subprocess
import sys
@ -19,6 +18,10 @@ import ray
import ray.ray_constants as ray_constants
import psutil
resource = None
if sys.platform != "win32":
import resource
# True if processes are run in the valgrind profiler.
RUN_RAYLET_PROFILER = False
RUN_PLASMA_STORE_PROFILER = False
@ -903,7 +906,7 @@ def _start_redis_instance(executable,
# number of Redis clients.
if redis_max_clients is not None:
redis_client.config_set("maxclients", str(redis_max_clients))
else:
elif resource is not None:
# If redis_max_clients is not provided, determine the current ulimit.
# We will use this to attempt to raise the maximum number of Redis
# clients.

View file

@ -120,7 +120,6 @@ cc_library(
]),
copts = COPTS,
deps = [
"core_worker_lib.so",
"ray_common.so",
"ray_util.so",
":streaming_config",
@ -129,7 +128,15 @@ cc_library(
":streaming_util",
"@boost//:asio",
"@boost//:thread",
],
] + select({
"@bazel_tools//src/conditions:windows": [
# TODO(mehrdadn): This is to resolve symbols on Windows for now. Should remove this later. (See d7f8d18.)
"//:core_worker_lib",
],
"//conditions:default": [
"core_worker_lib.so",
],
}),
)
cc_library(