Skip to content

Commit

Permalink
GH-415: SAgentInfoResponseData provides agent group name
Browse files Browse the repository at this point in the history
Added: SAgentInfoResponseData provides the agent group name. (GH-415)
  • Loading branch information
AnarManafov committed Apr 17, 2022
1 parent 9c8ac69 commit 3517b34
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Added: Support for SessionID (GH-411)
### dds-tools-api
Modified: Logs of user processes which use Tools API are moved now to the DDS root log directory, instead of sessions directory.
Added: An ability to unsubscribe from either individual events or all events of requests. (GH-382)
Added: SAgentInfoResponseData provides the agent group name. (GH-415)

## v3.6 (2022-01-11)

Expand Down
1 change: 1 addition & 0 deletions dds-commander/src/ConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@ void CConnectionManager::sendUIAgentInfo(const dds::tools_api::SAgentInfoRequest
info.m_username = inf.m_remoteHostInfo.m_username;
info.m_host = inf.m_remoteHostInfo.m_host;
info.m_DDSPath = inf.m_remoteHostInfo.m_DDSPath;
info.m_groupName = inf.m_remoteHostInfo.m_groupName;
info.m_agentPid = inf.m_remoteHostInfo.m_agentPid;
auto slots{ inf.getSlots() };
info.m_nSlots = slots.size();
Expand Down
1 change: 1 addition & 0 deletions dds-info/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void requestAgentInfo(CSession& _session, const SOptions_t& /*_options*/)
{
LOG(log_stdout_clean) << "Agent " << _info.m_index << ": id (" << _info.m_agentID << "), pid ("
<< _info.m_agentPid << "),"
<< " group name (" << _info.m_groupName << "),"
<< " startup time (" << chrono::duration<double>(_info.m_startUpTime).count()
<< "s), slots total/executing/idle (" << _info.m_nSlots << "/"
<< _info.m_nExecutingSlots << "/" << _info.m_nIdleSlots << "), host ("
Expand Down
16 changes: 10 additions & 6 deletions dds-tools-lib/src/ToolsProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ void SAgentInfoResponseData::_toPT(boost::property_tree::ptree& _pt) const
_pt.put<string>("username", m_username);
_pt.put<string>("host", m_host);
_pt.put<string>("DDSPath", m_DDSPath);
_pt.put<string>("groupName", m_groupName);
_pt.put<uint32_t>("agentPid", m_agentPid);
_pt.put<uint32_t>("slots", m_nSlots);
_pt.put<uint32_t>("idleSlots", m_nIdleSlots);
Expand All @@ -421,6 +422,7 @@ void SAgentInfoResponseData::_fromPT(const boost::property_tree::ptree& _pt)
m_username = _pt.get<string>("username", "");
m_host = _pt.get<string>("host", "");
m_DDSPath = _pt.get<string>("DDSPath", "");
m_groupName = _pt.get<string>("groupName", "");
m_agentPid = _pt.get<uint32_t>("agentPid", 0);
m_nSlots = _pt.get<uint32_t>("slots", 0);
m_nIdleSlots = _pt.get<uint32_t>("idleSlots", 0);
Expand All @@ -431,8 +433,9 @@ bool SAgentInfoResponseData::operator==(const SAgentInfoResponseData& _val) cons
{
return (SBaseData::operator==(_val) && m_index == _val.m_index && m_agentID == _val.m_agentID &&
m_startUpTime == _val.m_startUpTime && m_username == _val.m_username && m_host == _val.m_host &&
m_DDSPath == _val.m_DDSPath && m_agentPid == _val.m_agentPid && m_nSlots == _val.m_nSlots &&
m_nIdleSlots == _val.m_nIdleSlots && m_nExecutingSlots == _val.m_nExecutingSlots);
m_DDSPath == _val.m_DDSPath && m_groupName == _val.m_groupName && m_agentPid == _val.m_agentPid &&
m_nSlots == _val.m_nSlots && m_nIdleSlots == _val.m_nIdleSlots &&
m_nExecutingSlots == _val.m_nExecutingSlots);
}

// We need to put function implementation in the same "dds::tools_api" namespace as a friend function declaration.
Expand All @@ -445,10 +448,11 @@ namespace dds
std::ostream& operator<<(std::ostream& _os, const SAgentInfoResponseData& _data)
{
return _os << _data.defaultToString() << "; index: " << _data.m_index << "; agentID: " << _data.m_agentID
<< "; startUpTime: " << _data.m_startUpTime.count() << "; username: " << _data.m_username
<< "; host: " << _data.m_host << "; DDSPath: " << _data.m_DDSPath
<< "; agentPid: " << _data.m_agentPid << "; nSlots: " << _data.m_nSlots
<< "; nIdleSlots: " << _data.m_nIdleSlots << "; nExecutingSlots: " << _data.m_nExecutingSlots;
<< "; groupName: " << _data.m_groupName << "; startUpTime: " << _data.m_startUpTime.count()
<< "; username: " << _data.m_username << "; host: " << _data.m_host
<< "; DDSPath: " << _data.m_DDSPath << "; agentPid: " << _data.m_agentPid
<< "; nSlots: " << _data.m_nSlots << "; nIdleSlots: " << _data.m_nIdleSlots
<< "; nExecutingSlots: " << _data.m_nExecutingSlots;
}
} // namespace tools_api
} // namespace dds
Expand Down
1 change: 1 addition & 0 deletions dds-tools-lib/src/ToolsProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ namespace dds
std::string m_username; ///< Username
std::string m_host; ///< Hostname
std::string m_DDSPath; ///< DDS path
std::string m_groupName; ///< Agent group name
uint32_t m_agentPid{ 0 }; ///< Agent's process ID
uint32_t m_nSlots{ 0 }; ///< Number of task slots
uint32_t m_nIdleSlots{ 0 }; ///< Number of idle slots
Expand Down
1 change: 1 addition & 0 deletions dds-tools-lib/tests/TestProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ BOOST_AUTO_TEST_CASE(test_dds_tools_protocol)
testData.m_username = "user1";
testData.m_host = "host1";
testData.m_DDSPath = "/path/to/dds";
testData.m_groupName = "testGroup";
testData.m_agentPid = 34;
testData.m_requestID = 123;
testData.m_nSlots = 10;
Expand Down

0 comments on commit 3517b34

Please sign in to comment.