Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
log an error if several policies share the same name
  • Loading branch information
Barthelemy committed Apr 26, 2022
commit 50e71efc3c8d4c98931bf53ff017fdd7b37d691c
5 changes: 5 additions & 0 deletions Utilities/DataSampling/src/DataSampling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ void DataSampling::GenerateInfrastructure(WorkflowSpec& workflow, const boost::p
void DataSampling::DoGenerateInfrastructure(Dispatcher& dispatcher, WorkflowSpec& workflow, const boost::property_tree::ptree& policiesTree, size_t threads, const std::string& host)
{
LOG(debug) << "Generating Data Sampling infrastructure...";
std::set<std::string> ids; // keep track of the ids we have met so far

for (auto&& policyConfig : policiesTree) {

// We don't want the Dispatcher to exit due to one faulty Policy
try {
auto policy = DataSamplingPolicy::fromConfiguration(policyConfig.second);
if(ids.count(policy.getName()) == 1) {
LOG(error) << "A policy with the same id has already been encountered (" + policy.getName() + ")";
}
ids.insert(policy.getName());
std::vector<std::string> machines;
if (policyConfig.second.count("machines") > 0) {
for (const auto& machine : policyConfig.second.get_child("machines")) {
Expand Down