From 1e2b64958054be4252721fe8d544ab4998468fb7 Mon Sep 17 00:00:00 2001 From: Philipp Moritz Date: Mon, 10 Jun 2019 23:46:37 -0700 Subject: [PATCH] Use proper session directory for debug_string.txt (#4960) --- python/ray/services.py | 1 + src/ray/raylet/main.cc | 3 +++ src/ray/raylet/node_manager.cc | 3 ++- src/ray/raylet/node_manager.h | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/ray/services.py b/python/ray/services.py index 00ae4e1a2b090..2c843f7bbbc7c 100644 --- a/python/ray/services.py +++ b/python/ray/services.py @@ -1194,6 +1194,7 @@ def start_raylet(redis_address, "--java_worker_command={}".format(java_worker_command), "--redis_password={}".format(redis_password or ""), "--temp_dir={}".format(temp_dir), + "--session_dir={}".format(session_dir), ] process_info = start_ray_process( command, diff --git a/src/ray/raylet/main.cc b/src/ray/raylet/main.cc index e75981d8b7520..c6e581cec9b7e 100644 --- a/src/ray/raylet/main.cc +++ b/src/ray/raylet/main.cc @@ -22,6 +22,7 @@ DEFINE_string(python_worker_command, "", "Python worker command."); DEFINE_string(java_worker_command, "", "Java worker command."); DEFINE_string(redis_password, "", "The password of redis."); DEFINE_string(temp_dir, "", "Temporary directory."); +DEFINE_string(session_dir, "", "The path of this ray session directory."); DEFINE_bool(disable_stats, false, "Whether disable the stats."); DEFINE_string(stat_address, "127.0.0.1:8888", "The address that we report metrics to."); DEFINE_bool(enable_stdout_exporter, false, @@ -61,6 +62,7 @@ int main(int argc, char *argv[]) { const std::string java_worker_command = FLAGS_java_worker_command; const std::string redis_password = FLAGS_redis_password; const std::string temp_dir = FLAGS_temp_dir; + const std::string session_dir = FLAGS_session_dir; const bool disable_stats = FLAGS_disable_stats; const std::string stat_address = FLAGS_stat_address; const bool enable_stdout_exporter = FLAGS_enable_stdout_exporter; @@ -132,6 +134,7 @@ int main(int argc, char *argv[]) { node_manager_config.max_lineage_size = RayConfig::instance().max_lineage_size(); node_manager_config.store_socket_name = store_socket_name; node_manager_config.temp_dir = temp_dir; + node_manager_config.session_dir = session_dir; // Configuration for the object manager. ray::ObjectManagerConfig object_manager_config; diff --git a/src/ray/raylet/node_manager.cc b/src/ray/raylet/node_manager.cc index b710b0873b0cd..5a97239faaf8f 100644 --- a/src/ray/raylet/node_manager.cc +++ b/src/ray/raylet/node_manager.cc @@ -2334,7 +2334,8 @@ void NodeManager::ForwardTask( void NodeManager::DumpDebugState() const { std::fstream fs; - fs.open(temp_dir_ + "/debug_state.txt", std::fstream::out | std::fstream::trunc); + fs.open(initial_config_.session_dir + "/debug_state.txt", + std::fstream::out | std::fstream::trunc); fs << DebugString(); fs.close(); } diff --git a/src/ray/raylet/node_manager.h b/src/ray/raylet/node_manager.h index 576ffbc23f720..3f7e4d7da97c9 100644 --- a/src/ray/raylet/node_manager.h +++ b/src/ray/raylet/node_manager.h @@ -48,6 +48,8 @@ struct NodeManagerConfig { std::string store_socket_name; /// The path to the ray temp dir. std::string temp_dir; + /// The path of this ray session dir. + std::string session_dir; }; class NodeManager {