Skip to content

Commit c2108ca

Browse files
ericlrobertnishihara
authored andcommitted
Don't put entire actor registry in debug string since it's too long (#3395)
1 parent 0d56fc1 commit c2108ca

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

src/ray/raylet/actor_registration.cc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace raylet {
1010

1111
ActorRegistration::ActorRegistration(const ActorTableDataT &actor_table_data)
1212
: actor_table_data_(actor_table_data),
13-
alive_(true),
1413
execution_dependency_(ObjectID::nil()),
1514
frontier_() {}
1615

@@ -44,16 +43,7 @@ bool ActorRegistration::IsAlive() const {
4443
return actor_table_data_.state == ActorState::ALIVE;
4544
}
4645

47-
std::string ActorRegistration::DebugString() const {
48-
std::stringstream result;
49-
if (alive_) {
50-
result << "alive";
51-
} else {
52-
result << "dead";
53-
}
54-
result << ", num handles: " << frontier_.size();
55-
return result.str();
56-
}
46+
int ActorRegistration::NumHandles() const { return frontier_.size(); }
5747

5848
} // namespace raylet
5949

src/ray/raylet/actor_registration.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,15 @@ class ActorRegistration {
9494
/// \return True if the local actor is alive and false if it is dead.
9595
bool IsAlive() const;
9696

97-
/// Returns debug string for class.
97+
/// Returns num handles to this actor entry.
9898
///
99-
/// \return string.
100-
std::string DebugString() const;
99+
/// \return int.
100+
int NumHandles() const;
101101

102102
private:
103103
/// Information from the global actor table about this actor, including the
104104
/// node manager location.
105105
ActorTableDataT actor_table_data_;
106-
/// True if the actor is alive and false otherwise.
107-
bool alive_;
108106
/// The object representing the state following the actor's most recently
109107
/// executed task. The next task to execute on the actor should be marked as
110108
/// execution-dependent on this object.

src/ray/raylet/node_manager.cc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,14 +1764,27 @@ std::string NodeManager::DebugString() const {
17641764
result << "\n" << reconstruction_policy_.DebugString();
17651765
result << "\n" << task_dependency_manager_.DebugString();
17661766
result << "\n" << lineage_cache_.DebugString();
1767+
result << "\nActorRegistry:";
1768+
int live_actors = 0;
1769+
int dead_actors = 0;
1770+
int max_num_handles = 0;
1771+
for (auto &pair : actor_registry_) {
1772+
if (pair.second.IsAlive()) {
1773+
live_actors += 1;
1774+
} else {
1775+
dead_actors += 1;
1776+
}
1777+
if (pair.second.NumHandles() > max_num_handles) {
1778+
max_num_handles = pair.second.NumHandles();
1779+
}
1780+
}
1781+
result << "\n- num live actors: " << live_actors;
1782+
result << "\n- num dead actors: " << dead_actors;
1783+
result << "\n- max num handles: " << max_num_handles;
17671784
result << "\nRemoteConnections:";
17681785
for (auto &pair : remote_server_connections_) {
17691786
result << "\n" << pair.first.hex() << ": " << pair.second->DebugString();
17701787
}
1771-
result << "\nActorRegistry:";
1772-
for (auto &pair : actor_registry_) {
1773-
result << "\n" << pair.first.hex() << ": " << pair.second.DebugString();
1774-
}
17751788
result << "\nDebugString() time ms: " << (current_time_ms() - now_ms);
17761789
return result.str();
17771790
}

0 commit comments

Comments
 (0)