[PlacementGroup]Add gcs placement group manager debug info (#12061)

Co-authored-by: 灵洵 <fengbin.ffb@antgroup.com>
This commit is contained in:
fangfengbin
2020-11-18 11:15:38 +08:00
committed by GitHub
co-authored by 灵洵
parent b96516e9d3
commit d87af0da88
3 changed files with 33 additions and 0 deletions
@@ -269,6 +269,7 @@ void GcsPlacementGroupManager::HandleCreatePlacementGroup(
}
GCS_RPC_SEND_REPLY(send_reply_callback, reply, status);
});
++counts_[CountType::CREATE_PLACEMENT_GROUP_REQUEST];
}
void GcsPlacementGroupManager::HandleRemovePlacementGroup(
@@ -285,6 +286,7 @@ void GcsPlacementGroupManager::HandleRemovePlacementGroup(
}
GCS_RPC_SEND_REPLY(send_reply_callback, reply, status);
});
++counts_[CountType::REMOVE_PLACEMENT_GROUP_REQUEST];
}
void GcsPlacementGroupManager::RemovePlacementGroup(
@@ -363,6 +365,7 @@ void GcsPlacementGroupManager::HandleGetPlacementGroup(
if (!status.ok()) {
on_done(status, boost::none);
}
++counts_[CountType::GET_PLACEMENT_GROUP_REQUEST];
}
void GcsPlacementGroupManager::HandleGetAllPlacementGroup(
@@ -382,6 +385,7 @@ void GcsPlacementGroupManager::HandleGetAllPlacementGroup(
if (!status.ok()) {
on_done(std::unordered_map<PlacementGroupID, PlacementGroupTableData>());
}
++counts_[CountType::GET_ALL_PLACEMENT_GROUP_REQUEST];
}
void GcsPlacementGroupManager::RetryCreatingPlacementGroup() {
@@ -501,5 +505,21 @@ void GcsPlacementGroupManager::LoadInitialData(const EmptyCallback &done) {
RAY_CHECK_OK(gcs_table_storage_->PlacementGroupTable().GetAll(callback));
}
std::string GcsPlacementGroupManager::DebugString() const {
std::ostringstream stream;
stream << "GcsPlacementGroupManager: {CreatePlacementGroup request count: "
<< counts_[CountType::CREATE_PLACEMENT_GROUP_REQUEST]
<< ", RemovePlacementGroup request count: "
<< counts_[CountType::REMOVE_PLACEMENT_GROUP_REQUEST]
<< ", GetPlacementGroup request count: "
<< counts_[CountType::GET_PLACEMENT_GROUP_REQUEST]
<< ", GetAllPlacementGroup request count: "
<< counts_[CountType::GET_ALL_PLACEMENT_GROUP_REQUEST]
<< ", Registered placement groups count: " << registered_placement_groups_.size()
<< ", Pending placement groups count: " << pending_placement_groups_.size()
<< "}";
return stream.str();
}
} // namespace gcs
} // namespace ray
@@ -237,6 +237,8 @@ class GcsPlacementGroupManager : public rpc::PlacementGroupInfoHandler {
/// \param done Callback that will be called when load is complete.
void LoadInitialData(const EmptyCallback &done);
std::string DebugString() const;
private:
/// Try to create placement group after a short time.
void RetryCreatingPlacementGroup();
@@ -298,6 +300,16 @@ class GcsPlacementGroupManager : public rpc::PlacementGroupInfoHandler {
/// Reference of GcsNodeManager.
GcsNodeManager &gcs_node_manager_;
// Debug info.
enum CountType {
CREATE_PLACEMENT_GROUP_REQUEST = 0,
REMOVE_PLACEMENT_GROUP_REQUEST = 1,
GET_PLACEMENT_GROUP_REQUEST = 2,
GET_ALL_PLACEMENT_GROUP_REQUEST = 3,
CountType_MAX = 4,
};
uint64_t counts_[CountType::CountType_MAX] = {0};
};
} // namespace gcs
+1
View File
@@ -305,6 +305,7 @@ void GcsServer::PrintDebugInfo() {
stream << gcs_node_manager_->DebugString() << "\n"
<< gcs_actor_manager_->DebugString() << "\n"
<< gcs_object_manager_->DebugString() << "\n"
<< gcs_placement_group_manager_->DebugString() << "\n"
<< ((rpc::DefaultTaskInfoHandler *)task_info_handler_.get())->DebugString();
// TODO(ffbin): We will get the session_dir in the next PR, and write the log to
// gcs_debug_state.txt.