From 845f79bb5c33c33be38251f30ea98b5deaedb0a1 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Sat, 24 Nov 2018 19:15:32 -0800 Subject: [PATCH 1/4] format --- src/ray/raylet/actor_registration.cc | 11 ----------- src/ray/raylet/actor_registration.h | 5 ----- src/ray/raylet/node_manager.cc | 16 ++++++++++++---- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/ray/raylet/actor_registration.cc b/src/ray/raylet/actor_registration.cc index 3f4a67c1d21c..6dbb5e74795f 100644 --- a/src/ray/raylet/actor_registration.cc +++ b/src/ray/raylet/actor_registration.cc @@ -44,17 +44,6 @@ bool ActorRegistration::IsAlive() const { return actor_table_data_.state == ActorState::ALIVE; } -std::string ActorRegistration::DebugString() const { - std::stringstream result; - if (alive_) { - result << "alive"; - } else { - result << "dead"; - } - result << ", num handles: " << frontier_.size(); - return result.str(); -} - } // namespace raylet } // namespace ray diff --git a/src/ray/raylet/actor_registration.h b/src/ray/raylet/actor_registration.h index faa05eb2686c..e842958f7793 100644 --- a/src/ray/raylet/actor_registration.h +++ b/src/ray/raylet/actor_registration.h @@ -94,11 +94,6 @@ class ActorRegistration { /// \return True if the local actor is alive and false if it is dead. bool IsAlive() const; - /// Returns debug string for class. - /// - /// \return string. - std::string DebugString() const; - private: /// Information from the global actor table about this actor, including the /// node manager location. diff --git a/src/ray/raylet/node_manager.cc b/src/ray/raylet/node_manager.cc index a0b7526e8713..728d11559f4e 100644 --- a/src/ray/raylet/node_manager.cc +++ b/src/ray/raylet/node_manager.cc @@ -1764,14 +1764,22 @@ std::string NodeManager::DebugString() const { result << "\n" << reconstruction_policy_.DebugString(); result << "\n" << task_dependency_manager_.DebugString(); result << "\n" << lineage_cache_.DebugString(); + result << "\nActorRegistry:"; + int live_actors = 0; + int dead_actors = 0; + for (auto &pair : actor_registry_) { + if (pair.second.IsAlive()) { + live_actors += 1; + } else { + dead_actors += 1; + } + } + result << "\n- num live actors: " << live_actors; + result << "\n- num dead actors: " << dead_actors; result << "\nRemoteConnections:"; for (auto &pair : remote_server_connections_) { result << "\n" << pair.first.hex() << ": " << pair.second->DebugString(); } - result << "\nActorRegistry:"; - for (auto &pair : actor_registry_) { - result << "\n" << pair.first.hex() << ": " << pair.second.DebugString(); - } result << "\nDebugString() time ms: " << (current_time_ms() - now_ms); return result.str(); } From 4b539ead756feca3cd98fc57b0dfeb5b9947e0f6 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Sat, 24 Nov 2018 19:17:42 -0800 Subject: [PATCH 2/4] max --- src/ray/raylet/actor_registration.cc | 2 ++ src/ray/raylet/actor_registration.h | 5 +++++ src/ray/raylet/node_manager.cc | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/src/ray/raylet/actor_registration.cc b/src/ray/raylet/actor_registration.cc index 6dbb5e74795f..569e987b186a 100644 --- a/src/ray/raylet/actor_registration.cc +++ b/src/ray/raylet/actor_registration.cc @@ -44,6 +44,8 @@ bool ActorRegistration::IsAlive() const { return actor_table_data_.state == ActorState::ALIVE; } +int ActorRegistration::NumHandles() const { return frontier_.size(); } + } // namespace raylet } // namespace ray diff --git a/src/ray/raylet/actor_registration.h b/src/ray/raylet/actor_registration.h index e842958f7793..e2ec1f17a240 100644 --- a/src/ray/raylet/actor_registration.h +++ b/src/ray/raylet/actor_registration.h @@ -94,6 +94,11 @@ class ActorRegistration { /// \return True if the local actor is alive and false if it is dead. bool IsAlive() const; + /// Returns num handles to this actor entry. + /// + /// \return int. + int NumHandles() const; + private: /// Information from the global actor table about this actor, including the /// node manager location. diff --git a/src/ray/raylet/node_manager.cc b/src/ray/raylet/node_manager.cc index 728d11559f4e..457fa4bba834 100644 --- a/src/ray/raylet/node_manager.cc +++ b/src/ray/raylet/node_manager.cc @@ -1767,15 +1767,20 @@ std::string NodeManager::DebugString() const { result << "\nActorRegistry:"; int live_actors = 0; int dead_actors = 0; + int max_num_handles = 0; for (auto &pair : actor_registry_) { if (pair.second.IsAlive()) { live_actors += 1; } else { dead_actors += 1; } + if (pair.second.NumHandles() > max_num_handles) { + max_num_handles = pair.second.NumHandles(); + } } result << "\n- num live actors: " << live_actors; result << "\n- num dead actors: " << dead_actors; + result << "\n- max num handles: " << max_num_handles; result << "\nRemoteConnections:"; for (auto &pair : remote_server_connections_) { result << "\n" << pair.first.hex() << ": " << pair.second->DebugString(); From 3450a7f775dacd8be6bb753399bb1d911ac5e467 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Tue, 27 Nov 2018 13:56:12 -0800 Subject: [PATCH 3/4] Update actor_registration.cc --- src/ray/raylet/actor_registration.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ray/raylet/actor_registration.cc b/src/ray/raylet/actor_registration.cc index 569e987b186a..7ea95e656642 100644 --- a/src/ray/raylet/actor_registration.cc +++ b/src/ray/raylet/actor_registration.cc @@ -10,7 +10,6 @@ namespace raylet { ActorRegistration::ActorRegistration(const ActorTableDataT &actor_table_data) : actor_table_data_(actor_table_data), - alive_(true), execution_dependency_(ObjectID::nil()), frontier_() {} From 63f1c26dda11a6b1f0e55257f0bf7af7ff0f5dc7 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Tue, 27 Nov 2018 13:56:22 -0800 Subject: [PATCH 4/4] Update actor_registration.h --- src/ray/raylet/actor_registration.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ray/raylet/actor_registration.h b/src/ray/raylet/actor_registration.h index e2ec1f17a240..4cf9b110afe1 100644 --- a/src/ray/raylet/actor_registration.h +++ b/src/ray/raylet/actor_registration.h @@ -103,8 +103,6 @@ class ActorRegistration { /// Information from the global actor table about this actor, including the /// node manager location. ActorTableDataT actor_table_data_; - /// True if the actor is alive and false otherwise. - bool alive_; /// The object representing the state following the actor's most recently /// executed task. The next task to execute on the actor should be marked as /// execution-dependent on this object.