mirror of
https://github.com/wassname/ray.git
synced 2026-09-11 12:43:20 +08:00
[Object spilling] Add policy to automatically spill objects on OutOfMemory (#11673)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import base64
|
||||
import collections
|
||||
import errno
|
||||
import io
|
||||
@@ -69,6 +70,21 @@ ProcessInfo = collections.namedtuple("ProcessInfo", [
|
||||
])
|
||||
|
||||
|
||||
def serialize_config(config):
|
||||
config_pairs = []
|
||||
for key, value in config.items():
|
||||
if isinstance(value, str):
|
||||
value = value.encode("utf-8")
|
||||
if isinstance(value, bytes):
|
||||
value = base64.b64encode(value).decode("utf-8")
|
||||
config_pairs.append((key, value))
|
||||
config_str = ";".join(["{},{}".format(*kv) for kv in config_pairs])
|
||||
assert " " not in config_str, (
|
||||
"Config parameters currently do not support "
|
||||
"spaces:", config_str)
|
||||
return config_str
|
||||
|
||||
|
||||
class ConsolePopen(subprocess.Popen):
|
||||
if sys.platform == "win32":
|
||||
|
||||
@@ -1121,7 +1137,7 @@ def start_gcs_server(redis_address,
|
||||
"""
|
||||
gcs_ip_address, gcs_port = redis_address.split(":")
|
||||
redis_password = redis_password or ""
|
||||
config_str = ",".join(["{},{}".format(*kv) for kv in config.items()])
|
||||
config_str = serialize_config(config)
|
||||
if gcs_server_port is None:
|
||||
gcs_server_port = 0
|
||||
|
||||
@@ -1176,7 +1192,6 @@ def start_raylet(redis_address,
|
||||
socket_to_use=None,
|
||||
head_node=False,
|
||||
start_initial_python_workers_for_first_job=False,
|
||||
object_spilling_config=None,
|
||||
code_search_path=None):
|
||||
"""Start a raylet, which is a combined local scheduler and object manager.
|
||||
|
||||
@@ -1223,7 +1238,7 @@ def start_raylet(redis_address,
|
||||
# The caller must provide a node manager port so that we can correctly
|
||||
# populate the command to start a worker.
|
||||
assert node_manager_port is not None and node_manager_port != 0
|
||||
config_str = ",".join(["{},{}".format(*kv) for kv in config.items()])
|
||||
config_str = serialize_config(config)
|
||||
|
||||
if use_valgrind and use_profiler:
|
||||
raise ValueError("Cannot use valgrind and profiler at the same time.")
|
||||
@@ -1315,10 +1330,6 @@ def start_raylet(redis_address,
|
||||
if load_code_from_local:
|
||||
start_worker_command += ["--load-code-from-local"]
|
||||
|
||||
if object_spilling_config:
|
||||
start_worker_command.append(
|
||||
f"--object-spilling-config={json.dumps(object_spilling_config)}")
|
||||
|
||||
# Create agent command
|
||||
agent_command = [
|
||||
sys.executable,
|
||||
|
||||
Reference in New Issue
Block a user