Skip to content

Commit

Permalink
Merge pull request #38966 from fwyzard/improve_unsafe_lables_for_DQM
Browse files Browse the repository at this point in the history
Improve the handling of module labels unsafe for DQM
  • Loading branch information
cmsbuild committed Aug 5, 2022
2 parents f365212 + aad8b57 commit 5f2e30a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions HLTrigger/Timer/plugins/FastTimerService.cc
Expand Up @@ -731,8 +731,10 @@ void FastTimerService::PlotsPerJob::book(dqm::reco::DQMStore::IBooker& booker,
if (bymodule) {
booker.setCurrentFolder(basedir + "/process " + process.name_ + " modules");
for (unsigned int id : process.modules_) {
auto const& module_name = fix_for_dqm(job.module(id).moduleLabel());
modules_[id].book(booker, module_name, module_name, module_ranges, lumisections, byls);
std::string const& module_label = job.module(id).moduleLabel();
std::string safe_label = module_label;
fixForDQM(safe_label);
modules_[id].book(booker, safe_label, module_label, module_ranges, lumisections, byls);
}
booker.setCurrentFolder(basedir);
}
Expand Down Expand Up @@ -942,14 +944,13 @@ void FastTimerService::postGlobalBeginRun(edm::GlobalContext const& gc) { ignore

void FastTimerService::preStreamBeginRun(edm::StreamContext const& sc) { ignoredSignal(__func__); }

std::string FastTimerService::fix_for_dqm(std::string input) {
void FastTimerService::fixForDQM(std::string& label) {
// clean characters that are deemed unsafe for DQM
// see the definition of `s_safe` in DQMServices/Core/src/DQMStore.cc
auto safe_for_dqm = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "s;
for (auto& c : input)
static const auto safe_for_dqm = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "s;
for (auto& c : label)
if (safe_for_dqm.find(c) == std::string::npos)
c = '_';
return input;
}

void FastTimerService::preallocate(edm::service::SystemBounds const& bounds) {
Expand All @@ -962,7 +963,8 @@ void FastTimerService::preallocate(edm::service::SystemBounds const& bounds) {
dqm_path_ += fmt::sprintf(
"/Running on %s with %d streams on %d threads", processor_model, concurrent_streams_, concurrent_threads_);

dqm_path_ = fix_for_dqm(dqm_path_);
// fix the DQM path to avoid invalid characters
fixForDQM(dqm_path_);

// allocate atomic variables to keep track of the completion of each step, process by process
subprocess_event_check_ = std::make_unique<std::atomic<unsigned int>[]>(concurrent_streams_);
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/Timer/plugins/FastTimerService.h
Expand Up @@ -183,7 +183,7 @@ class FastTimerService : public tbb::task_scheduler_observer {

public:
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
static std::string fix_for_dqm(std::string input);
static void fixForDQM(std::string& label);

private:
// forward declarations
Expand Down

0 comments on commit 5f2e30a

Please sign in to comment.