[Java] Enable GCS server when running java unit tests (#7041)

* enable gcs service when run java testcase

* fix ci bug

* fix windows compile bug

* fix ci bug

* restart ci job

* enable java testcase

* restart ci job

* restart ci job

* add debug log

* add debug log

* restart ci job

* add debug log

* restart ci

* add debug log

* fix java testcase bug

* restart ci job

* restart ci job

* restart ci job

* restart ci job

* restart ci job

* restart ci job

* restart ci job

* restart ci job
This commit is contained in:
fangfengbin
2020-02-10 09:39:14 +08:00
committed by GitHub
parent 48e2adbc21
commit 694c0f2867
8 changed files with 107 additions and 9 deletions
+29
View File
@@ -513,6 +513,22 @@ class Node:
process_info
]
def start_gcs_server(self):
"""Start the gcs server.
"""
stdout_file, stderr_file = self.new_log_files("gcs_server")
process_info = ray.services.start_gcs_server(
self._redis_address,
stdout_file=stdout_file,
stderr_file=stderr_file,
redis_password=self._ray_params.redis_password,
config=self._config)
assert (
ray_constants.PROCESS_TYPE_GCS_SERVER not in self.all_processes)
self.all_processes[ray_constants.PROCESS_TYPE_GCS_SERVER] = [
process_info
]
def start_raylet(self, use_valgrind=False, use_profiler=False):
"""Start the raylet.
@@ -592,6 +608,10 @@ class Node:
assert self._redis_address is None
# If this is the head node, start the relevant head node processes.
self.start_redis()
if os.environ.get("RAY_GCS_SERVICE_ENABLED", None):
self.start_gcs_server()
self.start_monitor()
self.start_raylet_monitor()
if self._ray_params.include_webui:
@@ -770,6 +790,15 @@ class Node:
self._kill_process_type(
ray_constants.PROCESS_TYPE_MONITOR, check_alive=check_alive)
def kill_gcs_server(self, check_alive=True):
"""Kill the gcs server.
Args:
check_alive (bool): Raise an exception if the process was already
dead.
"""
self._kill_process_type(
ray_constants.PROCESS_TYPE_GCS_SERVER, check_alive=check_alive)
def kill_raylet_monitor(self, check_alive=True):
"""Kill the raylet monitor.
+1
View File
@@ -180,6 +180,7 @@ PROCESS_TYPE_RAYLET = "raylet"
PROCESS_TYPE_PLASMA_STORE = "plasma_store"
PROCESS_TYPE_REDIS_SERVER = "redis_server"
PROCESS_TYPE_WEB_UI = "web_ui"
PROCESS_TYPE_GCS_SERVER = "gcs_server"
LOG_MONITOR_MAX_OPEN_FILES = 200
+1
View File
@@ -439,6 +439,7 @@ def stop(force, verbose):
["raylet", True],
["plasma_store", True],
["raylet_monitor", True],
["gcs_server", True],
["monitor.py", False],
["redis-server", False],
["default_worker.py", False], # Python worker.
+40
View File
@@ -55,6 +55,8 @@ RAYLET_MONITOR_EXECUTABLE = os.path.join(
"core/src/ray/raylet/raylet_monitor")
RAYLET_EXECUTABLE = os.path.join(
os.path.abspath(os.path.dirname(__file__)), "core/src/ray/raylet/raylet")
GCS_SERVER_EXECUTABLE = os.path.join(
os.path.abspath(os.path.dirname(__file__)), "core/src/ray/gcs/gcs_server")
DEFAULT_JAVA_WORKER_OPTIONS = "-classpath {}".format(
os.path.join(
@@ -1083,6 +1085,44 @@ def start_dashboard(require_webui,
return None, None
def start_gcs_server(redis_address,
stdout_file=None,
stderr_file=None,
redis_password=None,
config=None):
"""Start a gcs server.
Args:
redis_address (str): The address that the Redis server is listening on.
stdout_file: A file handle opened for writing to redirect stdout to. If
no redirection should happen, then this should be None.
stderr_file: A file handle opened for writing to redirect stderr to. If
no redirection should happen, then this should be None.
redis_password (str): The password of the redis server.
config (dict|None): Optional configuration that will
override defaults in RayConfig.
Returns:
ProcessInfo for the process that was started.
"""
gcs_ip_address, gcs_port = redis_address.split(":")
redis_password = redis_password or ""
config = config or {}
config_str = ",".join(["{},{}".format(*kv) for kv in config.items()])
command = [
GCS_SERVER_EXECUTABLE,
"--redis_address={}".format(gcs_ip_address),
"--redis_port={}".format(gcs_port),
"--config_list={}".format(config_str),
]
if redis_password:
command += ["--redis_password={}".format(redis_password)]
process_info = start_ray_process(
command,
ray_constants.PROCESS_TYPE_GCS_SERVER,
stdout_file=stdout_file,
stderr_file=stderr_file)
return process_info
def start_raylet(redis_address,
node_ip_address,
node_manager_port,