From 50dacbcdde182cb8ef3d60c0c9de3f3510c25f35 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Fri, 24 Jan 2020 15:43:03 +0100 Subject: [PATCH] SDK: update DDSTopology::GetTasks() --- fairmq/plugins/DDS/DDS.h | 4 ++-- fairmq/sdk/DDSTopology.cxx | 26 ++++++-------------------- fairmq/sdk/DDSTopology.h | 7 ++----- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/fairmq/plugins/DDS/DDS.h b/fairmq/plugins/DDS/DDS.h index b9c94ab5..2629ae89 100644 --- a/fairmq/plugins/DDS/DDS.h +++ b/fairmq/plugins/DDS/DDS.h @@ -48,8 +48,8 @@ struct DDSConfig struct DDSSubscription { DDSSubscription() - : fDDSCustomCmd(fService) - , fDDSKeyValue(fService) + : fDDSCustomCmd(fService) + , fDDSKeyValue(fService) { LOG(debug) << "$DDS_TASK_PATH: " << dds::env_prop(); LOG(debug) << "$DDS_GROUP_NAME: " << dds::env_prop(); diff --git a/fairmq/sdk/DDSTopology.cxx b/fairmq/sdk/DDSTopology.cxx index 4ca2b039..941e5b76 100644 --- a/fairmq/sdk/DDSTopology.cxx +++ b/fairmq/sdk/DDSTopology.cxx @@ -64,30 +64,16 @@ auto DDSTopology::GetNumRequiredAgents() const -> int return fImpl->fTopo.getRequiredNofAgents(); } -auto DDSTopology::GetTasks() const -> std::vector +auto DDSTopology::GetTasks(const std::string& path /* = "" */) const -> std::vector { std::vector list; - list.reserve(GetNumRequiredAgents()); - auto itPair = fImpl->fTopo.getRuntimeTaskIterator(nullptr); // passing nullptr will get all tasks - auto tasks = boost::make_iterator_range(itPair.first, itPair.second); - - for (const auto& task : tasks) { - LOG(debug) << "Found task with id: " << task.first << ", " - << "Path: " << task.second.m_taskPath << ", " - << "Collection id: " << task.second.m_taskCollectionId << ", " - << "Name: " << task.second.m_task->getName() << "_" << task.second.m_taskIndex; - list.emplace_back(task.first, task.second.m_taskCollectionId); + dds::topology_api::STopoRuntimeTask::FilterIteratorPair_t itPair; + if (path == "") { + itPair = fImpl->fTopo.getRuntimeTaskIterator(nullptr); // passing nullptr will get all tasks + } else { + itPair = fImpl->fTopo.getRuntimeTaskIteratorMatchingPath(path); } - - return list; -} - -auto DDSTopology::GetTasksMatchingPath(const std::string& path) const -> std::vector -{ - std::vector list; - - auto itPair = fImpl->fTopo.getRuntimeTaskIteratorMatchingPath(path); auto tasks = boost::make_iterator_range(itPair.first, itPair.second); for (const auto& task : tasks) { diff --git a/fairmq/sdk/DDSTopology.h b/fairmq/sdk/DDSTopology.h index dcb36e65..b85ad7d7 100644 --- a/fairmq/sdk/DDSTopology.h +++ b/fairmq/sdk/DDSTopology.h @@ -53,11 +53,8 @@ class DDSTopology /// @brief Get number of required agents for this topology auto GetNumRequiredAgents() const -> int; - /// @brief Get list of tasks in this topology - auto GetTasks() const -> std::vector; - - /// @brief Get list of tasks matching the provided topology path - auto GetTasksMatchingPath(const std::string&) const -> std::vector; + /// @brief Get list of tasks in this topology, optionally matching provided path + auto GetTasks(const std::string& = "") const -> std::vector; /// @brief Get list of tasks in this topology auto GetCollections() const -> std::vector;