mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
sdk: Add DDSTopology::GetCollections() and extend DDSTask
This commit is contained in:
parent
456b65871a
commit
e1b6b804bd
|
@ -254,7 +254,7 @@ auto DDSSession::RequestTaskInfo() -> std::vector<DDSTask>
|
||||||
std::vector<DDSTask> taskInfo;
|
std::vector<DDSTask> taskInfo;
|
||||||
taskInfo.reserve(res.size());
|
taskInfo.reserve(res.size());
|
||||||
for (auto& a : res) {
|
for (auto& a : res) {
|
||||||
taskInfo.emplace_back(a.m_taskID);
|
taskInfo.emplace_back(a.m_taskID, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return taskInfo;
|
return taskInfo;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#ifndef FAIR_MQ_SDK_DDSTASK_H
|
#ifndef FAIR_MQ_SDK_DDSTASK_H
|
||||||
#define FAIR_MQ_SDK_DDSTASK_H
|
#define FAIR_MQ_SDK_DDSTASK_H
|
||||||
|
|
||||||
// #include <fairmq/sdk/DDSAgent.h>
|
#include <fairmq/sdk/DDSCollection.h>
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -27,19 +27,22 @@ class DDSTask
|
||||||
public:
|
public:
|
||||||
using Id = std::uint64_t;
|
using Id = std::uint64_t;
|
||||||
|
|
||||||
explicit DDSTask(Id id)
|
explicit DDSTask(Id id, Id collectionId)
|
||||||
: fId(id)
|
: fId(id)
|
||||||
|
, fCollectionId(collectionId)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Id GetId() const { return fId; }
|
Id GetId() const { return fId; }
|
||||||
|
DDSCollection::Id GetCollectionId() const { return fCollectionId; }
|
||||||
|
|
||||||
friend auto operator<<(std::ostream& os, const DDSTask& task) -> std::ostream&
|
friend auto operator<<(std::ostream& os, const DDSTask& task) -> std::ostream&
|
||||||
{
|
{
|
||||||
return os << "DDSTask id: " << task.fId;
|
return os << "DDSTask id: " << task.fId << ", collection id: " << task.fCollectionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Id fId;
|
Id fId;
|
||||||
|
DDSCollection::Id fCollectionId;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sdk
|
} // namespace sdk
|
||||||
|
|
|
@ -80,10 +80,31 @@ auto DDSTopology::GetTasks() const -> std::vector<DDSTask>
|
||||||
auto tasks = boost::make_iterator_range(itPair.first, itPair.second);
|
auto tasks = boost::make_iterator_range(itPair.first, itPair.second);
|
||||||
|
|
||||||
for (const auto& task : tasks) {
|
for (const auto& task : tasks) {
|
||||||
LOG(debug) << "Found task " << task.first << ": "
|
LOG(debug) << "Found task with id: " << task.first << ", "
|
||||||
<< "Path: " << task.second.m_taskPath << ", "
|
<< "Path: " << task.second.m_taskPath << ", "
|
||||||
|
<< "Collection id: " << task.second.m_taskCollectionId << ", "
|
||||||
<< "Name: " << task.second.m_task->getName() << "_" << task.second.m_taskIndex;
|
<< "Name: " << task.second.m_task->getName() << "_" << task.second.m_taskIndex;
|
||||||
list.emplace_back(task.first);
|
list.emplace_back(task.first, task.second.m_taskCollectionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto DDSTopology::GetCollections() const -> std::vector<DDSCollection>
|
||||||
|
{
|
||||||
|
std::vector<DDSCollection> list;
|
||||||
|
|
||||||
|
auto itPair = fImpl->fTopo.getRuntimeCollectionIterator(
|
||||||
|
[](const dds::topology_api::STopoRuntimeCollection::FilterIterator_t::value_type&) -> bool {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
auto collections = boost::make_iterator_range(itPair.first, itPair.second);
|
||||||
|
|
||||||
|
for (const auto& c : collections) {
|
||||||
|
LOG(debug) << "Found collection with id: " << c.first << ", "
|
||||||
|
<< "Index: " << c.second.m_collectionIndex << ", "
|
||||||
|
<< "Path: " << c.second.m_collectionPath;
|
||||||
|
list.emplace_back(c.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#define FAIR_MQ_SDK_DDSTOPOLOGY_H
|
#define FAIR_MQ_SDK_DDSTOPOLOGY_H
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <fairmq/sdk/DDSCollection.h>
|
||||||
#include <fairmq/sdk/DDSEnvironment.h>
|
#include <fairmq/sdk/DDSEnvironment.h>
|
||||||
#include <fairmq/sdk/DDSInfo.h>
|
#include <fairmq/sdk/DDSInfo.h>
|
||||||
#include <fairmq/sdk/DDSTask.h>
|
#include <fairmq/sdk/DDSTask.h>
|
||||||
|
@ -54,6 +55,9 @@ class DDSTopology
|
||||||
/// @brief Get list of tasks in this topology
|
/// @brief Get list of tasks in this topology
|
||||||
auto GetTasks() const -> std::vector<DDSTask>;
|
auto GetTasks() const -> std::vector<DDSTask>;
|
||||||
|
|
||||||
|
/// @brief Get list of tasks in this topology
|
||||||
|
auto GetCollections() const -> std::vector<DDSCollection>;
|
||||||
|
|
||||||
/// @brief Get the name of the topology
|
/// @brief Get the name of the topology
|
||||||
auto GetName() const -> std::string;
|
auto GetName() const -> std::string;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user