test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamSchedule.cc
Go to the documentation of this file.
2 
26 
27 #include <algorithm>
28 #include <cassert>
29 #include <cstdlib>
30 #include <functional>
31 #include <iomanip>
32 #include <list>
33 #include <map>
34 #include <exception>
35 
36 namespace edm {
37  namespace {
38 
39  // Function template to transform each element in the input range to
40  // a value placed into the output range. The supplied function
41  // should take a const_reference to the 'input', and write to a
42  // reference to the 'output'.
43  template <typename InputIterator, typename ForwardIterator, typename Func>
44  void
45  transform_into(InputIterator begin, InputIterator end,
46  ForwardIterator out, Func func) {
47  for (; begin != end; ++begin, ++out) func(*begin, *out);
48  }
49 
50  // Function template that takes a sequence 'from', a sequence
51  // 'to', and a callable object 'func'. It and applies
52  // transform_into to fill the 'to' sequence with the values
53  // calcuated by the callable object, taking care to fill the
54  // outupt only if all calls succeed.
55  template <typename FROM, typename TO, typename FUNC>
56  void
57  fill_summary(FROM const& from, TO& to, FUNC func) {
58  if(to.size()!=from.size()) {
59  TO temp(from.size());
60  transform_into(from.begin(), from.end(), temp.begin(), func);
61  to.swap(temp);
62  } else {
63  transform_into(from.begin(), from.end(), to.begin(), func);
64  }
65  }
66 
67  // -----------------------------
68 
69  // Here we make the trigger results inserter directly. This should
70  // probably be a utility in the WorkerRegistry or elsewhere.
71 
73  makeInserter(ExceptionToActionTable const& actions,
74  std::shared_ptr<ActivityRegistry> areg,
75  std::shared_ptr<TriggerResultInserter> inserter) {
76  StreamSchedule::WorkerPtr ptr(new edm::WorkerT<TriggerResultInserter::ModuleType>(inserter, inserter->moduleDescription(), &actions));
77  ptr->setActivityRegistry(areg);
78  return ptr;
79  }
80 
81  void
82  initializeBranchToReadingWorker(ParameterSet const& opts,
83  ProductRegistry const& preg,
84  std::multimap<std::string,Worker*>& branchToReadingWorker)
85  {
86  // See if any data has been marked to be deleted early (removing any duplicates)
87  auto vBranchesToDeleteEarly = opts.getUntrackedParameter<std::vector<std::string>>("canDeleteEarly",std::vector<std::string>());
88  if(not vBranchesToDeleteEarly.empty()) {
89  std::sort(vBranchesToDeleteEarly.begin(),vBranchesToDeleteEarly.end(),std::less<std::string>());
90  vBranchesToDeleteEarly.erase(std::unique(vBranchesToDeleteEarly.begin(),vBranchesToDeleteEarly.end()),
91  vBranchesToDeleteEarly.end());
92 
93  // Are the requested items in the product registry?
94  auto allBranchNames = preg.allBranchNames();
95  //the branch names all end with a period, which we do not want to compare with
96  for(auto & b:allBranchNames) {
97  b.resize(b.size()-1);
98  }
99  std::sort(allBranchNames.begin(),allBranchNames.end(),std::less<std::string>());
100  std::vector<std::string> temp;
101  temp.reserve(vBranchesToDeleteEarly.size());
102 
103  std::set_intersection(vBranchesToDeleteEarly.begin(),vBranchesToDeleteEarly.end(),
104  allBranchNames.begin(),allBranchNames.end(),
105  std::back_inserter(temp));
106  vBranchesToDeleteEarly.swap(temp);
107  if(temp.size() != vBranchesToDeleteEarly.size()) {
108  std::vector<std::string> missingProducts;
109  std::set_difference(temp.begin(),temp.end(),
110  vBranchesToDeleteEarly.begin(),vBranchesToDeleteEarly.end(),
111  std::back_inserter(missingProducts));
112  LogInfo l("MissingProductsForCanDeleteEarly");
113  l<<"The following products in the 'canDeleteEarly' list are not available in this job and will be ignored.";
114  for(auto const& n:missingProducts){
115  l<<"\n "<<n;
116  }
117  }
118  //set placeholder for the branch, we will remove the nullptr if a
119  // module actually wants the branch.
120  for(auto const& branch:vBranchesToDeleteEarly) {
121  branchToReadingWorker.insert(std::make_pair(branch, static_cast<Worker*>(nullptr)));
122  }
123  }
124  }
125  }
126 
127  // -----------------------------
128 
129  typedef std::vector<std::string> vstring;
130 
131  // -----------------------------
132 
133  StreamSchedule::StreamSchedule(std::shared_ptr<TriggerResultInserter> inserter,
134  std::shared_ptr<ModuleRegistry> modReg,
135  ParameterSet& proc_pset,
139  BranchIDListHelper& branchIDListHelper,
140  ExceptionToActionTable const& actions,
141  std::shared_ptr<ActivityRegistry> areg,
142  std::shared_ptr<ProcessConfiguration> processConfiguration,
143  bool allowEarlyDelete,
144  StreamID streamID,
145  ProcessContext const* processContext) :
146  workerManager_(modReg,areg, actions),
147  actReg_(areg),
148  trig_name_list_(tns.getTrigPaths()),
149  end_path_name_list_(tns.getEndPaths()),
150  results_(new HLTGlobalStatus(trig_name_list_.size())),
151  results_inserter_(),
152  trig_paths_(),
153  end_paths_(),
154  total_events_(),
155  total_passed_(),
156  number_of_unscheduled_modules_(0),
157  streamID_(streamID),
158  streamContext_(streamID_, processContext),
160 
161  ParameterSet const& opts = proc_pset.getUntrackedParameterSet("options", ParameterSet());
162  bool hasPath = false;
163 
164  int trig_bitpos = 0;
165  trig_paths_.reserve(trig_name_list_.size());
166  vstring labelsOnTriggerPaths;
167  for (auto const& trig_name : trig_name_list_) {
168  fillTrigPath(proc_pset, preg, &prealloc, processConfiguration, trig_bitpos, trig_name, results(), &labelsOnTriggerPaths);
169  ++trig_bitpos;
170  hasPath = true;
171  }
172 
173  if (hasPath) {
174  // the results inserter stands alone
175  inserter->setTrigResultForStream(streamID.value(), results());
176 
177  results_inserter_ = makeInserter(actions, actReg_, inserter);
179  }
180 
181  // fill normal endpaths
182  int bitpos = 0;
183  end_paths_.reserve(end_path_name_list_.size());
184  for (auto const& end_path_name : end_path_name_list_) {
185  fillEndPath(proc_pset, preg, &prealloc, processConfiguration, bitpos, end_path_name);
186  ++bitpos;
187  }
188 
189  //See if all modules were used
190  std::set<std::string> usedWorkerLabels;
191  for (auto const& worker : allWorkers()) {
192  usedWorkerLabels.insert(worker->description().moduleLabel());
193  }
194  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string> >("@all_modules"));
195  std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
196  std::vector<std::string> unusedLabels;
197  set_difference(modulesInConfigSet.begin(), modulesInConfigSet.end(),
198  usedWorkerLabels.begin(), usedWorkerLabels.end(),
199  back_inserter(unusedLabels));
200  //does the configuration say we should allow on demand?
201  bool allowUnscheduled = opts.getUntrackedParameter<bool>("allowUnscheduled", false);
202  std::set<std::string> unscheduledLabels;
203  std::vector<std::string> shouldBeUsedLabels;
204  if (!unusedLabels.empty()) {
205  //Need to
206  // 1) create worker
207  // 2) if it is a WorkerT<EDProducer>, add it to our list
208  // 3) hand list to our delayed reader
209  for (auto const& label : unusedLabels) {
210  if (allowUnscheduled) {
211  bool isTracked;
212  ParameterSet* modulePSet(proc_pset.getPSetForUpdate(label, isTracked));
213  assert(isTracked);
214  assert(modulePSet != nullptr);
215  workerManager_.addToUnscheduledWorkers(*modulePSet, preg, &prealloc, processConfiguration, label, unscheduledLabels, shouldBeUsedLabels);
216  } else {
217  //everthing is marked are unused so no 'on demand' allowed
218  shouldBeUsedLabels.push_back(label);
219  }
220  }
221  if (!shouldBeUsedLabels.empty()) {
222  std::ostringstream unusedStream;
223  unusedStream << "'" << shouldBeUsedLabels.front() << "'";
224  for (std::vector<std::string>::iterator itLabel = shouldBeUsedLabels.begin() + 1,
225  itLabelEnd = shouldBeUsedLabels.end();
226  itLabel != itLabelEnd;
227  ++itLabel) {
228  unusedStream << ",'" << *itLabel << "'";
229  }
230  LogInfo("path")
231  << "The following module labels are not assigned to any path:\n"
232  << unusedStream.str()
233  << "\n";
234  }
235  }
236  if (!unscheduledLabels.empty()) {
237  number_of_unscheduled_modules_=unscheduledLabels.size();
238  workerManager_.setOnDemandProducts(preg, unscheduledLabels);
239  }
240 
241 
242  initializeEarlyDelete(*modReg, opts,preg,allowEarlyDelete);
243 
244  } // StreamSchedule::StreamSchedule
245 
246 
249  bool allowEarlyDelete) {
250  //for now, if have a subProcess, don't allow early delete
251  // In the future we should use the SubProcess's 'keep list' to decide what can be kept
252  if(not allowEarlyDelete) return;
253 
254  //see if 'canDeleteEarly' was set and if so setup the list with those products actually
255  // registered for this job
256  std::multimap<std::string,Worker*> branchToReadingWorker;
257  initializeBranchToReadingWorker(opts,preg,branchToReadingWorker);
258 
259  //If no delete early items have been specified we don't have to do anything
260  if(branchToReadingWorker.size()==0) {
261  return;
262  }
263  const std::vector<std::string> kEmpty;
264  std::map<Worker*,unsigned int> reserveSizeForWorker;
265  unsigned int upperLimitOnReadingWorker =0;
266  unsigned int upperLimitOnIndicies = 0;
267  unsigned int nUniqueBranchesToDelete=branchToReadingWorker.size();
268 
269  //talk with output modules first
270  modReg.forAllModuleHolders([this, &branchToReadingWorker,&nUniqueBranchesToDelete](maker::ModuleHolder* iHolder){
271  auto comm = iHolder->createOutputModuleCommunicator();
272  if (comm) {
273  if(branchToReadingWorker.size()>0) {
274  //If an OutputModule needs a product, we can't delete it early
275  // so we should remove it from our list
276  SelectedProductsForBranchType const&kept = comm->keptProducts();
277  for( auto const& item: kept[InEvent]) {
278  auto found = branchToReadingWorker.equal_range(item->branchName());
279  if(found.first !=found.second) {
280  --nUniqueBranchesToDelete;
281  branchToReadingWorker.erase(found.first,found.second);
282  }
283  }
284  }
285  }
286  });
287 
288  if(branchToReadingWorker.size()==0) {
289  return;
290  }
291 
292  for (auto w :allWorkers()) {
293  //determine if this module could read a branch we want to delete early
294  auto pset = pset::Registry::instance()->getMapped(w->description().parameterSetID());
295  if(0!=pset) {
296  auto branches = pset->getUntrackedParameter<std::vector<std::string>>("mightGet",kEmpty);
297  if(not branches.empty()) {
298  ++upperLimitOnReadingWorker;
299  }
300  for(auto const& branch:branches){
301  auto found = branchToReadingWorker.equal_range(branch);
302  if(found.first != found.second) {
303  ++upperLimitOnIndicies;
304  ++reserveSizeForWorker[w];
305  if(nullptr == found.first->second) {
306  found.first->second = w;
307  } else {
308  branchToReadingWorker.insert(make_pair(found.first->first,w));
309  }
310  }
311  }
312  }
313  }
314  {
315  auto it = branchToReadingWorker.begin();
316  std::vector<std::string> unusedBranches;
317  while(it !=branchToReadingWorker.end()) {
318  if(it->second == nullptr) {
319  unusedBranches.push_back(it->first);
320  //erasing the object invalidates the iterator so must advance it first
321  auto temp = it;
322  ++it;
323  branchToReadingWorker.erase(temp);
324  } else {
325  ++it;
326  }
327  }
328  if(not unusedBranches.empty()) {
329  LogWarning l("UnusedProductsForCanDeleteEarly");
330  l<<"The following products in the 'canDeleteEarly' list are not used in this job and will be ignored.\n"
331  " If possible, remove the producer from the job or add the product to the producer's own 'mightGet' list.";
332  for(auto const& n:unusedBranches){
333  l<<"\n "<<n;
334  }
335  }
336  }
337  if(0!=branchToReadingWorker.size()) {
338  earlyDeleteHelpers_.reserve(upperLimitOnReadingWorker);
339  earlyDeleteHelperToBranchIndicies_.resize(upperLimitOnIndicies,0);
340  earlyDeleteBranchToCount_.reserve(nUniqueBranchesToDelete);
341  std::map<const Worker*,EarlyDeleteHelper*> alreadySeenWorkers;
342  std::string lastBranchName;
343  size_t nextOpenIndex = 0;
344  unsigned int* beginAddress = &(earlyDeleteHelperToBranchIndicies_.front());
345  for(auto& branchAndWorker:branchToReadingWorker) {
346  if(lastBranchName != branchAndWorker.first) {
347  //have to put back the period we removed earlier in order to get the proper name
348  BranchID bid(branchAndWorker.first+".");
349  earlyDeleteBranchToCount_.emplace_back(std::make_pair(bid,0U));
350  lastBranchName = branchAndWorker.first;
351  }
352  auto found = alreadySeenWorkers.find(branchAndWorker.second);
353  if(alreadySeenWorkers.end() == found) {
354  //NOTE: we will set aside enough space in earlyDeleteHelperToBranchIndicies_ to accommodate
355  // all the branches that might be read by this worker. However, initially we will only tell the
356  // EarlyDeleteHelper about the first one. As additional branches are added via 'appendIndex' the
357  // EarlyDeleteHelper will automatically advance its internal end pointer.
358  size_t index = nextOpenIndex;
359  size_t nIndices = reserveSizeForWorker[branchAndWorker.second];
361  earlyDeleteHelpers_.emplace_back(EarlyDeleteHelper(beginAddress+index,
362  beginAddress+index+1,
364  branchAndWorker.second->setEarlyDeleteHelper(&(earlyDeleteHelpers_.back()));
365  alreadySeenWorkers.insert(std::make_pair(branchAndWorker.second,&(earlyDeleteHelpers_.back())));
366  nextOpenIndex +=nIndices;
367  } else {
368  found->second->appendIndex(earlyDeleteBranchToCount_.size()-1);
369  }
370  }
371 
372  //Now we can compactify the earlyDeleteHelperToBranchIndicies_ since we may have over estimated the
373  // space needed for each module
374  auto itLast = earlyDeleteHelpers_.begin();
375  for(auto it = earlyDeleteHelpers_.begin()+1;it != earlyDeleteHelpers_.end();++it) {
376  if(itLast->end() != it->begin()) {
377  //figure the offset for next Worker since it hasn't been moved yet so it has the original address
378  unsigned int delta = it->begin()- itLast->end();
379  it->shiftIndexPointers(delta);
380 
382  (itLast->end()-beginAddress),
384  (it->begin()-beginAddress));
385  }
386  itLast = it;
387  }
388  earlyDeleteHelperToBranchIndicies_.erase(earlyDeleteHelperToBranchIndicies_.begin()+(itLast->end()-beginAddress),
390 
391  //now tell the paths about the deleters
392  for(auto& p : trig_paths_) {
393  p.setEarlyDeleteHelpers(alreadySeenWorkers);
394  }
395  for(auto& p : end_paths_) {
396  p.setEarlyDeleteHelpers(alreadySeenWorkers);
397  }
399  }
400  }
401 
405  std::shared_ptr<ProcessConfiguration const> processConfiguration,
406  std::string const& name,
407  bool ignoreFilters,
408  PathWorkers& out,
409  vstring* labelsOnPaths) {
410  vstring modnames = proc_pset.getParameter<vstring>(name);
411  PathWorkers tmpworkers;
412 
413  unsigned int placeInPath = 0;
414  for (auto const& name : modnames) {
415 
416  if (labelsOnPaths) labelsOnPaths->push_back(name);
417 
419  if (name[0] == '!') filterAction = WorkerInPath::Veto;
420  else if (name[0] == '-') filterAction = WorkerInPath::Ignore;
421 
422  std::string moduleLabel = name;
423  if (filterAction != WorkerInPath::Normal) moduleLabel.erase(0, 1);
424 
425  bool isTracked;
426  ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
427  if (modpset == 0) {
428  std::string pathType("endpath");
429  if (!search_all(end_path_name_list_, name)) {
430  pathType = std::string("path");
431  }
433  "The unknown module label \"" << moduleLabel <<
434  "\" appears in " << pathType << " \"" << name <<
435  "\"\n please check spelling or remove that label from the path.";
436  }
437  assert(isTracked);
438 
439  Worker* worker = workerManager_.getWorker(*modpset, preg, prealloc, processConfiguration, moduleLabel);
440  if (ignoreFilters && filterAction != WorkerInPath::Ignore && worker->moduleType()==Worker::kFilter) {
441  // We have a filter on an end path, and the filter is not explicitly ignored.
442  // See if the filter is allowed.
443  std::vector<std::string> allowed_filters = proc_pset.getUntrackedParameter<vstring>("@filters_on_endpaths");
444  if (!search_all(allowed_filters, worker->description().moduleName())) {
445  // Filter is not allowed. Ignore the result, and issue a warning.
446  filterAction = WorkerInPath::Ignore;
447  LogWarning("FilterOnEndPath")
448  << "The EDFilter '" << worker->description().moduleName() << "' with module label '" << moduleLabel << "' appears on EndPath '" << name << "'.\n"
449  << "The return value of the filter will be ignored.\n"
450  << "To suppress this warning, either remove the filter from the endpath,\n"
451  << "or explicitly ignore it in the configuration by using cms.ignore().\n";
452  }
453  }
454  tmpworkers.emplace_back(worker, filterAction, placeInPath);
455  ++placeInPath;
456  }
457 
458  out.swap(tmpworkers);
459  }
460 
464  std::shared_ptr<ProcessConfiguration const> processConfiguration,
465  int bitpos, std::string const& name, TrigResPtr trptr,
466  vstring* labelsOnTriggerPaths) {
467  using std::placeholders::_1;
468  PathWorkers tmpworkers;
469  Workers holder;
470  fillWorkers(proc_pset, preg, prealloc, processConfiguration, name, false, tmpworkers, labelsOnTriggerPaths);
471 
472  for (PathWorkers::iterator wi(tmpworkers.begin()),
473  we(tmpworkers.end()); wi != we; ++wi) {
474  holder.push_back(wi->getWorker());
475  }
476 
477  // an empty path will cause an extra bit that is not used
478  if (!tmpworkers.empty()) {
479  trig_paths_.emplace_back(bitpos, name, tmpworkers, trptr, actionTable(), actReg_, &streamContext_, PathContext::PathType::kPath);
480  } else {
481  empty_trig_paths_.push_back(bitpos);
482  empty_trig_path_names_.push_back(name);
483  }
484  for_all(holder, std::bind(&StreamSchedule::addToAllWorkers, this, _1));
485  }
486 
490  std::shared_ptr<ProcessConfiguration const> processConfiguration,
491  int bitpos, std::string const& name) {
492  using std::placeholders::_1;
493  PathWorkers tmpworkers;
494  fillWorkers(proc_pset, preg, prealloc, processConfiguration, name, true, tmpworkers, 0);
495  Workers holder;
496 
497  for (PathWorkers::iterator wi(tmpworkers.begin()), we(tmpworkers.end()); wi != we; ++wi) {
498  holder.push_back(wi->getWorker());
499  }
500 
501  if (!tmpworkers.empty()) {
502  end_paths_.emplace_back(bitpos, name, tmpworkers, TrigResPtr(), actionTable(), actReg_, &streamContext_, PathContext::PathType::kEndPath);
503  }
504  for_all(holder, std::bind(&StreamSchedule::addToAllWorkers, this, _1));
505  }
506 
509  }
510 
513  }
514 
516  std::string const& iLabel) {
517  Worker* found = nullptr;
518  for (auto const& worker : allWorkers()) {
519  if (worker->description().moduleLabel() == iLabel) {
520  found = worker;
521  break;
522  }
523  }
524  if (nullptr == found) {
525  return;
526  }
527 
528  iMod->replaceModuleFor(found);
530  }
531 
532  std::vector<ModuleDescription const*>
534  std::vector<ModuleDescription const*> result;
535  result.reserve(allWorkers().size());
536 
537  for (auto const& worker : allWorkers()) {
538  ModuleDescription const* p = worker->descPtr();
539  result.push_back(p);
540  }
541  return result;
542  }
543 
544  void
545  StreamSchedule::availablePaths(std::vector<std::string>& oLabelsToFill) const {
546  oLabelsToFill.reserve(trig_paths_.size());
547  std::transform(trig_paths_.begin(),
548  trig_paths_.end(),
549  std::back_inserter(oLabelsToFill),
550  std::bind(&Path::name, std::placeholders::_1));
551  }
552 
553  void
554  StreamSchedule::triggerPaths(std::vector<std::string>& oLabelsToFill) const {
555  oLabelsToFill = trig_name_list_;
556  }
557 
558  void
559  StreamSchedule::endPaths(std::vector<std::string>& oLabelsToFill) const {
560  oLabelsToFill = end_path_name_list_;
561  }
562 
563  void
565  std::vector<std::string>& oLabelsToFill) const {
566  TrigPaths::const_iterator itFound =
567  std::find_if (trig_paths_.begin(),
568  trig_paths_.end(),
569  std::bind(std::equal_to<std::string>(),
570  iPathLabel,
571  std::bind(&Path::name, std::placeholders::_1)));
572  if (itFound!=trig_paths_.end()) {
573  oLabelsToFill.reserve(itFound->size());
574  for (size_t i = 0; i < itFound->size(); ++i) {
575  oLabelsToFill.push_back(itFound->getWorker(i)->description().moduleLabel());
576  }
577  }
578  }
579 
580  void
582  std::vector<ModuleDescription const*>& descriptions,
583  unsigned int hint) const {
584  descriptions.clear();
585  bool found = false;
586  TrigPaths::const_iterator itFound;
587 
588  if(hint < trig_paths_.size()) {
589  itFound = trig_paths_.begin() + hint;
590  if(itFound->name() == iPathLabel) found = true;
591  }
592  if(!found) {
593  // if the hint did not work, do it the slow way
594  itFound = std::find_if (trig_paths_.begin(),
595  trig_paths_.end(),
596  std::bind(std::equal_to<std::string>(),
597  iPathLabel,
598  std::bind(&Path::name, std::placeholders::_1)));
599  if (itFound != trig_paths_.end()) found = true;
600  }
601  if (found) {
602  descriptions.reserve(itFound->size());
603  for (size_t i = 0; i < itFound->size(); ++i) {
604  descriptions.push_back(itFound->getWorker(i)->descPtr());
605  }
606  }
607  }
608 
609  void
611  std::vector<ModuleDescription const*>& descriptions,
612  unsigned int hint) const {
613  descriptions.clear();
614  bool found = false;
615  TrigPaths::const_iterator itFound;
616 
617  if(hint < end_paths_.size()) {
618  itFound = end_paths_.begin() + hint;
619  if(itFound->name() == iEndPathLabel) found = true;
620  }
621  if(!found) {
622  // if the hint did not work, do it the slow way
623  itFound = std::find_if (end_paths_.begin(),
624  end_paths_.end(),
625  std::bind(std::equal_to<std::string>(),
626  iEndPathLabel,
627  std::bind(&Path::name, std::placeholders::_1)));
628  if (itFound != end_paths_.end()) found = true;
629  }
630  if (found) {
631  descriptions.reserve(itFound->size());
632  for (size_t i = 0; i < itFound->size(); ++i) {
633  descriptions.push_back(itFound->getWorker(i)->descPtr());
634  }
635  }
636  }
637 
638  void
640  endpathsAreActive_ = active;
641  }
642 
643  bool
645  return endpathsAreActive_;
646  }
647 
648  static void
650  size_t which,
651  ModuleInPathSummary& sum) {
652  sum.timesVisited += path.timesVisited(which);
653  sum.timesPassed += path.timesPassed(which);
654  sum.timesFailed += path.timesFailed(which);
655  sum.timesExcept += path.timesExcept(which);
656  sum.moduleLabel = path.getWorker(which)->description().moduleLabel();
657  }
658 
659  static void
661  sum.name = path.name();
662  sum.bitPosition = path.bitPosition();
663  sum.timesRun += path.timesRun();
664  sum.timesPassed += path.timesPassed();
665  sum.timesFailed += path.timesFailed();
666  sum.timesExcept += path.timesExcept();
667 
668  Path::size_type sz = path.size();
669  if(sum.moduleInPathSummaries.size()==0) {
670  std::vector<ModuleInPathSummary> temp(sz);
671  for (size_t i = 0; i != sz; ++i) {
672  fillModuleInPathSummary(path, i, temp[i]);
673  }
674  sum.moduleInPathSummaries.swap(temp);
675  } else {
676  assert(sz == sum.moduleInPathSummaries.size());
677  for (size_t i = 0; i != sz; ++i) {
679  }
680  }
681  }
682 
683  static void
685  sum.timesVisited += w.timesVisited();
686  sum.timesRun += w.timesRun();
687  sum.timesPassed += w.timesPassed();
688  sum.timesFailed += w.timesFailed();
689  sum.timesExcept += w.timesExcept();
690  sum.moduleLabel = w.description().moduleLabel();
691  }
692 
693  static void
695  fillWorkerSummaryAux(*pw, sum);
696  }
697 
698  void
703 
704  fill_summary(trig_paths_, rep.trigPathSummaries, &fillPathSummary);
705  fill_summary(end_paths_, rep.endPathSummaries, &fillPathSummary);
706  fill_summary(allWorkers(), rep.workerSummaries, &fillWorkerSummary);
708  }
709 
710  void
712  using std::placeholders::_1;
714  for_all(trig_paths_, std::bind(&Path::clearCounters, _1));
715  for_all(end_paths_, std::bind(&Path::clearCounters, _1));
716  for_all(allWorkers(), std::bind(&Worker::clearCounters, _1));
717  }
718 
719  void
721  results_->reset();
722  }
723 
724  void
727  }
728 
729  void
731  //must be sure we have cleared the count first
732  for(auto& count:earlyDeleteBranchToCount_) {
733  count.second = 0;
734  }
735  //now reset based on how many helpers use that branch
737  ++(earlyDeleteBranchToCount_[index].second);
738  }
739  for(auto& helper: earlyDeleteHelpers_) {
740  helper.reset();
741  }
742  }
743 
744 }
static void fillModuleInPathSummary(Path const &path, size_t which, ModuleInPathSummary &sum)
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
dbl * delta
Definition: mlp_gen.cc:36
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
T getParameter(std::string const &) const
std::vector< PathSummary > endPathSummaries
Definition: TriggerReport.h:68
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
string rep
Definition: cuy.py:1188
int timesRun() const
Definition: Path.h:67
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
int bitPosition() const
Definition: Path.h:62
def which
Definition: eostools.py:335
std::vector< Worker * > Workers
ModuleDescription const & description() const
Definition: Worker.h:100
std::vector< int > empty_trig_paths_
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
void endStream(StreamID iID, StreamContext &streamContext)
void fillEndPath(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name)
const double w
Definition: UKUtility.cc:23
virtual void replaceModuleFor(Worker *) const =0
int totalEventsFailed() const
void initializeEarlyDelete(ModuleRegistry &modReg, edm::ParameterSet const &opts, edm::ProductRegistry const &preg, bool allowEarlyDelete)
std::shared_ptr< HLTGlobalStatus > TrigResPtr
void setOnDemandProducts(ProductRegistry &pregistry, std::set< std::string > const &unscheduledLabels) const
WorkersInPath::size_type size_type
Definition: Path.h:45
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
std::vector< std::pair< BranchID, unsigned int > > earlyDeleteBranchToCount_
void addToUnscheduledWorkers(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration > processConfiguration, std::string label, std::set< std::string > &unscheduledLabels, std::vector< std::string > &shouldBeUsedLabels)
int timesPassed() const
Definition: Worker.h:128
volatile bool endpathsAreActive_
assert(m_qm.get())
int totalEvents() const
void clearCounters()
Definition: Worker.h:122
std::string const & moduleName() const
processConfiguration
Definition: Schedule.cc:374
void addToAllWorkers(Worker *w)
int timesExcept() const
Definition: Path.h:70
size_type size() const
Definition: Path.h:74
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
endpathsAreActive_(true)
Definition: Schedule.cc:380
edm::propagate_const< WorkerPtr > results_inserter_
ExceptionToActionTable const & actionTable() const
returns the action table
void beginStream(StreamID id, StreamContext &streamContext)
Definition: Worker.cc:136
std::shared_ptr< Worker > WorkerPtr
std::vector< WorkerSummary > workerSummaries
Definition: TriggerReport.h:69
actions
Definition: Schedule.cc:374
std::string const & moduleLabel() const
unsigned int number_of_unscheduled_modules_
WorkerManager workerManager_
std::shared_ptr< ActivityRegistry > actReg_
tuple result
Definition: mps_fire.py:83
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
std::string moduleLabel
Definition: TriggerReport.h:56
std::vector< WorkerInPath > PathWorkers
int timesExcept() const
Definition: Worker.h:130
int totalEventsPassed() const
void getTriggerReport(TriggerReport &rep) const
std::vector< PathSummary > trigPathSummaries
Definition: TriggerReport.h:67
EventSummary eventSummary
Definition: TriggerReport.h:66
StreamSchedule(std::shared_ptr< TriggerResultInserter > inserter, std::shared_ptr< ModuleRegistry >, ParameterSet &proc_pset, service::TriggerNamesService &tns, PreallocationConfiguration const &prealloc, ProductRegistry &pregistry, BranchIDListHelper &branchIDListHelper, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, bool allowEarlyDelete, StreamID streamID, ProcessContext const *processContext)
int timesVisited() const
Definition: Worker.h:127
std::string name
Definition: TriggerReport.h:44
void fillWorkers(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &name, bool ignoreFilters, PathWorkers &out, vstring *labelsOnPaths)
Definition: Path.h:40
StreamContext streamContext_
std::vector< std::string > vstring
static void fillPathSummary(Path const &path, PathSummary &sum)
int timesPassed() const
Definition: Path.h:68
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:18
int timesRun() const
Definition: Worker.h:126
#define end
Definition: vmac.h:37
vstring empty_trig_path_names_
element_type const * get() const
areg
Definition: Schedule.cc:374
static void fillWorkerSummaryAux(Worker const &w, WorkerSummary &sum)
virtual Types moduleType() const =0
void beginStream(StreamID iID, StreamContext &streamContext)
void clearCounters()
Clear all the counters in the trigger report.
unsigned int value() const
Definition: StreamID.h:46
boost::array< SelectedProducts, NumBranchTypes > SelectedProductsForBranchType
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
std::vector< unsigned int > earlyDeleteHelperToBranchIndicies_
void forAllModuleHolders(F iFunc)
edm::propagate_const< TrigResPtr > results_
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
int timesVisited(size_type i) const
Definition: Path.h:75
double b
Definition: hdecay.h:120
virtual std::unique_ptr< OutputModuleCommunicator > createOutputModuleCommunicator()=0
int timesFailed() const
Definition: Worker.h:129
static void fillWorkerSummary(Worker const *pw, WorkerSummary &sum)
bool endPathsEnabled() const
std::string const & name() const
Definition: Path.h:63
#define begin
Definition: vmac.h:30
void fillTrigPath(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name, TrigResPtr, vstring *labelsOnTriggerPaths)
Worker const * getWorker(size_type i) const
Definition: Path.h:79
void replaceModule(maker::ModuleHolder *iMod, std::string const &iLabel)
clone the type of module with label iLabel but configure with iPSet.
void enableEndPaths(bool active)
std::vector< ModuleInPathSummary > moduleInPathSummaries
Definition: TriggerReport.h:45
preg
Definition: Schedule.cc:374
TrigResConstPtr results() const
std::vector< std::string > vstring
Definition: Schedule.cc:358
tuple size
Write out results.
static Registry * instance()
Definition: Registry.cc:12
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
void clearCounters()
Definition: Path.cc:158
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
std::vector< EarlyDeleteHelper > earlyDeleteHelpers_
void modulesInPath(std::string const &iPathLabel, std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill in execution order the labels of all modules in path iPathLabel ...
prealloc
Definition: Schedule.cc:374
void addToAllWorkers(Worker *w)
int timesFailed() const
Definition: Path.h:69
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)