Commit 4f1a7fa7 authored by Remi Mommsen's avatar Remi Mommsen Committed by Remi Mommsen
Browse files

references #144: add whitelist for FUs

parent e7649d8f
......@@ -71,6 +71,8 @@ namespace evb {
xdata::Vector<xdata::String> hltFiles; // List of file names to retrieve from hltParameterSetURL
xdata::String blacklistName; // Name of the blacklist file
xdata::String fuBlacklist; // The FUs to blacklist as string
xdata::String whitelistName; // Name of the whitelist file
xdata::String fuWhitelist; // The FUs to whitelist as string
xdata::UnsignedInteger32 roundTripTimeSamples; // Rolling average of round trip times for the last N I2O mesage (0 disables it)
xdata::UnsignedInteger32 maxPostRetries; // Max. attempts to post an I2O message
......@@ -122,6 +124,8 @@ namespace evb {
hltParameterSetURL(""),
blacklistName("blacklist"),
fuBlacklist("[]"),
whitelistName("whitelist"),
fuWhitelist("[]"),
roundTripTimeSamples(1000),
maxPostRetries(10)
{
......@@ -182,6 +186,8 @@ namespace evb {
params.add("hltFiles", &hltFiles);
params.add("blacklistName", &blacklistName);
params.add("fuBlacklist", &fuBlacklist);
params.add("whitelistName", &whitelistName);
params.add("fuWhitelist", &fuWhitelist);
params.add("roundTripTimeSamples", &roundTripTimeSamples);
params.add("maxPostRetries", &maxPostRetries);
}
......
......@@ -151,6 +151,8 @@ namespace evb {
void populateHltdDirectory(const boost::filesystem::path& runDir) const;
void getHLTmenu(const boost::filesystem::path& tmpDir) const;
void writeBlacklist(const boost::filesystem::path& tmpDir) const;
void writeWhitelist(const boost::filesystem::path& tmpDir) const;
void writeHostList(const boost::filesystem::path&, const xdata::String& hosts) const;
void retrieveFromURL(CURL*, const std::string& url, const boost::filesystem::path& output) const;
void createLockFile(const boost::filesystem::path&) const;
void writeEoLS(const LumiInfoPtr&) const;
......
......@@ -719,25 +719,38 @@ void evb::bu::DiskWriter::getHLTmenu(const boost::filesystem::path& tmpPath) con
void evb::bu::DiskWriter::writeBlacklist(const boost::filesystem::path& tmpPath) const
{
const boost::filesystem::path blacklistPath( tmpPath / configuration_->blacklistName.value_ );
const char* path = blacklistPath.string().c_str();
std::ofstream blacklist(path);
writeHostList(blacklistPath, configuration_->fuBlacklist);
}
void evb::bu::DiskWriter::writeWhitelist(const boost::filesystem::path& tmpPath) const
{
const boost::filesystem::path whitelistPath( tmpPath / configuration_->whitelistName.value_ );
writeHostList(whitelistPath, configuration_->fuWhitelist);
}
void evb::bu::DiskWriter::writeHostList(const boost::filesystem::path& path, const xdata::String& hosts) const
{
std::ofstream hostlist(path.string().c_str());
const std::regex regex("[a-zA-Z]+-[a-zA-Z0-9-]+");
std::sregex_iterator res(configuration_->fuBlacklist.value_.begin(), configuration_->fuBlacklist.value_.end(), regex);
std::sregex_iterator res(hosts.value_.begin(), hosts.value_.end(), regex);
const std::sregex_iterator end;
if ( res == end )
{
blacklist << "[]" << std::endl;
hostlist << "[]" << std::endl;
}
else
{
blacklist << "[\"" << res->str() << "\"";
hostlist << "[\"" << res->str() << "\"";
while (++res != end) {
blacklist << ", \"" << res->str() << "\"";
hostlist << ", \"" << res->str() << "\"";
}
blacklist << "]" << std::endl;
hostlist << "]" << std::endl;
}
blacklist.close();
hostlist.close();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment