CMS 3D CMS Logo

Schedule.cc
Go to the documentation of this file.
2 
30 
31 
32 #include <algorithm>
33 #include <cassert>
34 #include <cstdlib>
35 #include <functional>
36 #include <iomanip>
37 #include <list>
38 #include <map>
39 #include <set>
40 #include <exception>
41 #include <sstream>
42 
43 namespace edm {
44  namespace {
45  using std::placeholders::_1;
46 
47  bool binary_search_string(std::vector<std::string> const& v, std::string const& s) {
48  return std::binary_search(v.begin(), v.end(), s);
49  }
50 
51  // Here we make the trigger results inserter directly. This should
52  // probably be a utility in the WorkerRegistry or elsewhere.
53 
54  std::shared_ptr<TriggerResultInserter>
55  makeInserter(ParameterSet& proc_pset,
56  PreallocationConfiguration const& iPrealloc,
57  ProductRegistry& preg,
58  ExceptionToActionTable const& actions,
59  std::shared_ptr<ActivityRegistry> areg,
60  std::shared_ptr<ProcessConfiguration> processConfiguration) {
61 
62  ParameterSet* trig_pset = proc_pset.getPSetForUpdate("@trigger_paths");
63  trig_pset->registerIt();
64 
65  WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration, actions);
66  ModuleDescription md(trig_pset->id(),
67  "TriggerResultInserter",
68  "TriggerResults",
69  processConfiguration.get(),
71 
72  areg->preModuleConstructionSignal_(md);
73  bool postCalled = false;
74  std::shared_ptr<TriggerResultInserter> returnValue;
75  try {
76  maker::ModuleHolderT<TriggerResultInserter> holder(std::shared_ptr<TriggerResultInserter>(new TriggerResultInserter(*trig_pset, iPrealloc.numberOfStreams())),static_cast<Maker const*>(nullptr));
77  holder.setModuleDescription(md);
78  holder.registerProductsAndCallbacks(&preg);
79  returnValue =holder.module();
80  postCalled = true;
81  // if exception then post will be called in the catch block
82  areg->postModuleConstructionSignal_(md);
83  }
84  catch (...) {
85  if(!postCalled) {
86  try {
87  areg->postModuleConstructionSignal_(md);
88  }
89  catch (...) {
90  // If post throws an exception ignore it because we are already handling another exception
91  }
92  }
93  throw;
94  }
95  return returnValue;
96  }
97 
98 
99  void
100  checkAndInsertAlias(std::string const& friendlyClassName,
101  std::string const& moduleLabel,
102  std::string const& productInstanceName,
103  std::string const& processName,
104  std::string const& alias,
105  std::string const& instanceAlias,
106  ProductRegistry const& preg,
107  std::multimap<BranchKey, BranchKey>& aliasMap,
108  std::map<BranchKey, BranchKey>& aliasKeys) {
109  std::string const star("*");
110 
111  BranchKey key(friendlyClassName, moduleLabel, productInstanceName, processName);
112  if(preg.productList().find(key) == preg.productList().end()) {
113  // No product was found matching the alias.
114  // We throw an exception only if a module with the specified module label was created in this process.
115  for(auto const& product : preg.productList()) {
116  if(moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
117  throw Exception(errors::Configuration, "EDAlias does not match data\n")
118  << "There are no products of type '" << friendlyClassName << "'\n"
119  << "with module label '" << moduleLabel << "' and instance name '" << productInstanceName << "'.\n";
120  }
121  }
122  }
123 
124  std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
125  BranchKey aliasKey(friendlyClassName, alias, theInstanceAlias, processName);
126  if(preg.productList().find(aliasKey) != preg.productList().end()) {
127  throw Exception(errors::Configuration, "EDAlias conflicts with data\n")
128  << "A product of type '" << friendlyClassName << "'\n"
129  << "with module label '" << alias << "' and instance name '" << theInstanceAlias << "'\n"
130  << "already exists.\n";
131  }
132  auto iter = aliasKeys.find(aliasKey);
133  if(iter != aliasKeys.end()) {
134  // The alias matches a previous one. If the same alias is used for different product, throw.
135  if(iter->second != key) {
136  throw Exception(errors::Configuration, "EDAlias conflict\n")
137  << "The module label alias '" << alias << "' and product instance alias '" << theInstanceAlias << "'\n"
138  << "are used for multiple products of type '" << friendlyClassName << "'\n"
139  << "One has module label '" << moduleLabel << "' and product instance name '" << productInstanceName << "',\n"
140  << "the other has module label '" << iter->second.moduleLabel() << "' and product instance name '" << iter->second.productInstanceName() << "'.\n";
141  }
142  } else {
143  auto prodIter = preg.productList().find(key);
144  if(prodIter != preg.productList().end()) {
145  if (!prodIter->second.produced()) {
146  throw Exception(errors::Configuration, "EDAlias\n")
147  << "The module label alias '" << alias << "' and product instance alias '" << theInstanceAlias << "'\n"
148  << "are used for a product of type '" << friendlyClassName << "'\n"
149  << "with module label '" << moduleLabel << "' and product instance name '" << productInstanceName << "',\n"
150  << "An EDAlias can only be used for products produced in the current process. This one is not.\n";
151  }
152  aliasMap.insert(std::make_pair(key, aliasKey));
153  aliasKeys.insert(std::make_pair(aliasKey, key));
154  }
155  }
156  }
157 
158  void
159  processEDAliases(ParameterSet const& proc_pset, std::string const& processName, ProductRegistry& preg) {
160  std::vector<std::string> aliases = proc_pset.getParameter<std::vector<std::string> >("@all_aliases");
161  if(aliases.empty()) {
162  return;
163  }
164  std::string const star("*");
165  std::string const empty("");
167  desc.add<std::string>("type");
168  desc.add<std::string>("fromProductInstance", star);
169  desc.add<std::string>("toProductInstance", star);
170 
171  std::multimap<BranchKey, BranchKey> aliasMap;
172 
173  std::map<BranchKey, BranchKey> aliasKeys; // Used to search for duplicates or clashes.
174 
175  // Now, loop over the alias information and store it in aliasMap.
176  for(std::string const& alias : aliases) {
177  ParameterSet const& aliasPSet = proc_pset.getParameterSet(alias);
178  std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<VParameterSet>();
179  for(std::string const& moduleLabel : vPSetNames) {
180  VParameterSet vPSet = aliasPSet.getParameter<VParameterSet>(moduleLabel);
181  for(ParameterSet& pset : vPSet) {
182  desc.validate(pset);
183  std::string friendlyClassName = pset.getParameter<std::string>("type");
184  std::string productInstanceName = pset.getParameter<std::string>("fromProductInstance");
185  std::string instanceAlias = pset.getParameter<std::string>("toProductInstance");
186  if(productInstanceName == star) {
187  bool match = false;
188  BranchKey lowerBound(friendlyClassName, moduleLabel, empty, empty);
189  for(ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
190  it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName && it->first.moduleLabel() == moduleLabel;
191  ++it) {
192  if(it->first.processName() != processName) {
193  continue;
194  }
195  match = true;
196 
197  checkAndInsertAlias(friendlyClassName, moduleLabel, it->first.productInstanceName(), processName, alias, instanceAlias, preg, aliasMap, aliasKeys);
198  }
199  if(!match) {
200  // No product was found matching the alias.
201  // We throw an exception only if a module with the specified module label was created in this process.
202  for(auto const& product : preg.productList()) {
203  if(moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
204  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
205  << "There are no products of type '" << friendlyClassName << "'\n"
206  << "with module label '" << moduleLabel << "'.\n";
207  }
208  }
209  }
210  } else {
211  checkAndInsertAlias(friendlyClassName, moduleLabel, productInstanceName, processName, alias, instanceAlias, preg, aliasMap, aliasKeys);
212  }
213  }
214  }
215  }
216 
217 
218  // Now add the new alias entries to the product registry.
219  for(auto const& aliasEntry : aliasMap) {
220  ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
221  assert(it != preg.productList().end());
222  preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
223  }
224 
225  }
226 
227  typedef std::vector<std::string> vstring;
228 
229  void reduceParameterSet(ParameterSet& proc_pset,
230  vstring const& end_path_name_list,
231  vstring& modulesInConfig,
232  std::set<std::string> const& usedModuleLabels,
233  std::map<std::string, std::vector<std::pair<std::string, int> > >& outputModulePathPositions) {
234  // Before calculating the ParameterSetID of the top level ParameterSet or
235  // saving it in the registry drop from the top level ParameterSet all
236  // OutputModules and EDAnalyzers not on trigger paths. If unscheduled
237  // production is not enabled also drop all the EDFilters and EDProducers
238  // that are not scheduled. Drop the ParameterSet used to configure the module
239  // itself. Also drop the other traces of these labels in the top level
240  // ParameterSet: Remove that labels from @all_modules and from all the
241  // end paths. If this makes any end paths empty, then remove the end path
242  // name from @end_paths, and @paths.
243 
244  // First make a list of labels to drop
245  vstring outputModuleLabels;
246  std::string edmType;
247  std::string const moduleEdmType("@module_edm_type");
248  std::string const outputModule("OutputModule");
249  std::string const edAnalyzer("EDAnalyzer");
250  std::string const edFilter("EDFilter");
251  std::string const edProducer("EDProducer");
252 
253  std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
254 
255  //need a list of all modules on paths in order to determine
256  // if an EDAnalyzer only appears on an end path
257  vstring scheduledPaths = proc_pset.getParameter<vstring>("@paths");
258  std::set<std::string> modulesOnPaths;
259  {
260  std::set<std::string> noEndPaths(scheduledPaths.begin(),scheduledPaths.end());
261  for(auto const& endPath: end_path_name_list) {
262  noEndPaths.erase(endPath);
263  }
264  {
265  vstring labels;
266  for(auto const& path: noEndPaths) {
267  labels = proc_pset.getParameter<vstring>(path);
268  modulesOnPaths.insert(labels.begin(),labels.end());
269  }
270  }
271  }
272  //Initially fill labelsToBeDropped with all module mentioned in
273  // the configuration but which are not being used by the system
274  std::vector<std::string> labelsToBeDropped;
275  labelsToBeDropped.reserve(modulesInConfigSet.size());
276  std::set_difference(modulesInConfigSet.begin(),modulesInConfigSet.end(),
277  usedModuleLabels.begin(),usedModuleLabels.end(),
278  std::back_inserter(labelsToBeDropped));
279 
280  const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
281  for (auto const& modLabel: usedModuleLabels) {
282  edmType = proc_pset.getParameterSet(modLabel).getParameter<std::string>(moduleEdmType);
283  if (edmType == outputModule) {
284  outputModuleLabels.push_back(modLabel);
285  labelsToBeDropped.push_back(modLabel);
286  }
287  if(edmType == edAnalyzer) {
288  if(modulesOnPaths.end()==modulesOnPaths.find(modLabel)) {
289  labelsToBeDropped.push_back(modLabel);
290  }
291  }
292  }
293  //labelsToBeDropped must be sorted
294  std::inplace_merge(labelsToBeDropped.begin(),
295  labelsToBeDropped.begin()+sizeBeforeOutputModules,
296  labelsToBeDropped.end());
297 
298  // drop the parameter sets used to configure the modules
299  for_all(labelsToBeDropped, std::bind(&ParameterSet::eraseOrSetUntrackedParameterSet, std::ref(proc_pset), _1));
300 
301  // drop the labels from @all_modules
302  vstring::iterator endAfterRemove = std::remove_if(modulesInConfig.begin(), modulesInConfig.end(), std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
303  modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
304  proc_pset.addParameter<vstring>(std::string("@all_modules"), modulesInConfig);
305 
306  // drop the labels from all end paths
307  vstring endPathsToBeDropped;
308  vstring labels;
309  for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
310  iEndPath != endEndPath;
311  ++iEndPath) {
312  labels = proc_pset.getParameter<vstring>(*iEndPath);
313  vstring::iterator iSave = labels.begin();
314  vstring::iterator iBegin = labels.begin();
315 
316  for (vstring::iterator iLabel = labels.begin(), iEnd = labels.end();
317  iLabel != iEnd; ++iLabel) {
318  if (binary_search_string(labelsToBeDropped, *iLabel)) {
319  if (binary_search_string(outputModuleLabels, *iLabel)) {
320  outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
321  }
322  } else {
323  if (iSave != iLabel) {
324  iSave->swap(*iLabel);
325  }
326  ++iSave;
327  }
328  }
329  labels.erase(iSave, labels.end());
330  if (labels.empty()) {
331  // remove empty end paths and save their names
332  proc_pset.eraseSimpleParameter(*iEndPath);
333  endPathsToBeDropped.push_back(*iEndPath);
334  } else {
335  proc_pset.addParameter<vstring>(*iEndPath, labels);
336  }
337  }
338  sort_all(endPathsToBeDropped);
339 
340  // remove empty end paths from @paths
341  endAfterRemove = std::remove_if(scheduledPaths.begin(), scheduledPaths.end(), std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
342  scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
343  proc_pset.addParameter<vstring>(std::string("@paths"), scheduledPaths);
344 
345  // remove empty end paths from @end_paths
346  vstring scheduledEndPaths = proc_pset.getParameter<vstring>("@end_paths");
347  endAfterRemove = std::remove_if(scheduledEndPaths.begin(), scheduledEndPaths.end(), std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
348  scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
349  proc_pset.addParameter<vstring>(std::string("@end_paths"), scheduledEndPaths);
350 
351  }
352 
353  class RngEDConsumer : public EDConsumerBase {
354  public:
355  explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
357  if(rng.isAvailable()) {
358  rng->consumes(consumesCollector());
359  for (auto const& consumesInfo : this->consumesInfo()) {
360  typesConsumed.emplace(consumesInfo.type());
361  }
362  }
363  }
364  };
365  }
366  // -----------------------------
367 
368  typedef std::vector<std::string> vstring;
369 
370  // -----------------------------
371 
374  ProductRegistry& preg,
375  BranchIDListHelper& branchIDListHelper,
376  ThinnedAssociationsHelper& thinnedAssociationsHelper,
377  ExceptionToActionTable const& actions,
378  std::shared_ptr<ActivityRegistry> areg,
379  std::shared_ptr<ProcessConfiguration> processConfiguration,
380  bool hasSubprocesses,
381  PreallocationConfiguration const& prealloc,
382  ProcessContext const* processContext) :
383  //Only create a resultsInserter if there is a trigger path
384  resultsInserter_{tns.getTrigPaths().empty()? std::shared_ptr<TriggerResultInserter>{} :makeInserter(proc_pset,prealloc,preg,actions,areg,processConfiguration)},
387  preallocConfig_(prealloc),
388  wantSummary_(tns.wantSummary()),
389  endpathsAreActive_(true)
390  {
391  assert(0<prealloc.numberOfStreams());
392  streamSchedules_.reserve(prealloc.numberOfStreams());
393  for(unsigned int i=0; i<prealloc.numberOfStreams();++i) {
394  streamSchedules_.emplace_back(std::make_shared<StreamSchedule>(
395  resultsInserter(),
396  moduleRegistry(),
397  proc_pset,tns,prealloc,preg,
398  branchIDListHelper,actions,
399  areg,processConfiguration,
400  !hasSubprocesses,
401  StreamID{i},
402  processContext));
403  }
404 
405  //TriggerResults are injected automatically by StreamSchedules and are
406  // unknown to the ModuleRegistry
407  const std::string kTriggerResults("TriggerResults");
408  std::vector<std::string> modulesToUse;
409  modulesToUse.reserve(streamSchedules_[0]->allWorkers().size());
410  for(auto const& worker : streamSchedules_[0]->allWorkers()) {
411  if(worker->description().moduleLabel() != kTriggerResults) {
412  modulesToUse.push_back(worker->description().moduleLabel());
413  }
414  }
415  //The unscheduled modules are at the end of the list, but we want them at the front
416  unsigned int n = streamSchedules_[0]->numberOfUnscheduledModules();
417  if(n>0) {
418  std::vector<std::string> temp;
419  temp.reserve(modulesToUse.size());
420  auto itBeginUnscheduled = modulesToUse.begin()+modulesToUse.size()-n;
421  std::copy(itBeginUnscheduled,modulesToUse.end(),
422  std::back_inserter(temp));
423  std::copy(modulesToUse.begin(),itBeginUnscheduled,std::back_inserter(temp));
424  temp.swap(modulesToUse);
425  }
426 
427  // propagate_const<T> has no reset() function
428  globalSchedule_ = std::make_unique<GlobalSchedule>(
429  resultsInserter(),
430  moduleRegistry(),
431  modulesToUse,
432  proc_pset, preg, prealloc,
433  actions,areg,processConfiguration,processContext);
434 
435  //TriggerResults is not in the top level ParameterSet so the call to
436  // reduceParameterSet would fail to find it. Just remove it up front.
437  std::set<std::string> usedModuleLabels;
438  for(auto const& worker: allWorkers()) {
439  if(worker->description().moduleLabel() != kTriggerResults) {
440  usedModuleLabels.insert(worker->description().moduleLabel());
441  }
442  }
443  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string> >("@all_modules"));
444  std::map<std::string, std::vector<std::pair<std::string, int> > > outputModulePathPositions;
445  reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels,
446  outputModulePathPositions);
447  processEDAliases(proc_pset, processConfiguration->processName(), preg);
448  proc_pset.registerIt();
449  processConfiguration->setParameterSetID(proc_pset.id());
450  processConfiguration->setProcessConfigurationID();
451 
452  // This is used for a little sanity-check to make sure no code
453  // modifications alter the number of workers at a later date.
454  size_t all_workers_count = allWorkers().size();
455 
456  moduleRegistry_->forAllModuleHolders([this](maker::ModuleHolder* iHolder){
457  auto comm = iHolder->createOutputModuleCommunicator();
458  if (comm) {
459  all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
460  }
461  });
462  // Now that the output workers are filled in, set any output limits or information.
463  limitOutput(proc_pset, branchIDListHelper.branchIDLists());
464 
465  // Sanity check: make sure nobody has added a worker after we've
466  // already relied on the WorkerManager being full.
467  assert (all_workers_count == allWorkers().size());
468 
469  branchIDListHelper.updateFromRegistry(preg);
470 
471  for(auto const& worker : streamSchedules_[0]->allWorkers()) {
472  worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
473  }
474  thinnedAssociationsHelper.sort();
475 
476  // The output modules consume products in kept branches.
477  // So we must set this up before freezing.
478  for (auto& c : all_output_communicators_) {
479  c->selectProducts(preg, thinnedAssociationsHelper);
480  }
481 
482  {
483  // We now get a collection of types that may be consumed.
484  std::set<TypeID> productTypesConsumed;
485  std::set<TypeID> elementTypesConsumed;
486  // Loop over all modules
487  for (auto const& worker : allWorkers()) {
488  for (auto const& consumesInfo : worker->consumesInfo()) {
489  if (consumesInfo.kindOfType() == PRODUCT_TYPE) {
490  productTypesConsumed.emplace(consumesInfo.type());
491  } else {
492  elementTypesConsumed.emplace(consumesInfo.type());
493  }
494  }
495  }
496  // The SubProcess class is not a module, yet it may consume.
497  if(hasSubprocesses) {
498  productTypesConsumed.emplace(typeid(TriggerResults));
499  }
500  // The RandomNumberGeneratorService is not a module, yet it consumes.
501  {
502  RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed);
503  }
504  preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
505  }
506 
507  for (auto& c : all_output_communicators_) {
508  c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
509  }
510 
511  if(wantSummary_) {
512  std::vector<const ModuleDescription*> modDesc;
513  const auto& workers = allWorkers();
514  modDesc.reserve(workers.size());
515 
516  std::transform(workers.begin(),workers.end(),
517  std::back_inserter(modDesc),
518  [](const Worker* iWorker) -> const ModuleDescription* {
519  return iWorker->descPtr();
520  });
521 
522  // propagate_const<T> has no reset() function
523  summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(
524  prealloc.numberOfStreams(),
525  modDesc,
526  tns,
527  processContext);
528  auto timeKeeperPtr = summaryTimeKeeper_.get();
529 
530  areg->watchPreModuleEvent(timeKeeperPtr, &SystemTimeKeeper::startModuleEvent);
531  areg->watchPostModuleEvent(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
532  areg->watchPreModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::pauseModuleEvent);
533  areg->watchPostModuleEventDelayedGet(timeKeeperPtr,&SystemTimeKeeper::restartModuleEvent);
534 
535  areg->watchPreSourceEvent(timeKeeperPtr, &SystemTimeKeeper::startEvent);
536  areg->watchPostEvent(timeKeeperPtr, &SystemTimeKeeper::stopEvent);
537 
538  areg->watchPrePathEvent(timeKeeperPtr, &SystemTimeKeeper::startPath);
539  areg->watchPostPathEvent(timeKeeperPtr, &SystemTimeKeeper::stopPath);
540 
541  areg->watchPostBeginJob(timeKeeperPtr, &SystemTimeKeeper::startProcessingLoop);
542  areg->watchPreEndJob(timeKeeperPtr, &SystemTimeKeeper::stopProcessingLoop);
543  //areg->preModuleEventSignal_.connect([timeKeeperPtr](StreamContext const& iContext, ModuleCallingContext const& iMod) {
544  //timeKeeperPtr->startModuleEvent(iContext,iMod);
545  //});
546  }
547 
548  } // Schedule::Schedule
549 
550 
551  void
552  Schedule::limitOutput(ParameterSet const& proc_pset, BranchIDLists const& branchIDLists) {
553  std::string const output("output");
554 
555  ParameterSet const& maxEventsPSet = proc_pset.getUntrackedParameterSet("maxEvents", ParameterSet());
556  int maxEventSpecs = 0;
557  int maxEventsOut = -1;
558  ParameterSet const* vMaxEventsOut = 0;
559  std::vector<std::string> intNamesE = maxEventsPSet.getParameterNamesForType<int>(false);
560  if (search_all(intNamesE, output)) {
561  maxEventsOut = maxEventsPSet.getUntrackedParameter<int>(output);
562  ++maxEventSpecs;
563  }
564  std::vector<std::string> psetNamesE;
565  maxEventsPSet.getParameterSetNames(psetNamesE, false);
566  if (search_all(psetNamesE, output)) {
567  vMaxEventsOut = &maxEventsPSet.getUntrackedParameterSet(output);
568  ++maxEventSpecs;
569  }
570 
571  if (maxEventSpecs > 1) {
573  "\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
574  }
575 
576  for (auto& c : all_output_communicators_) {
577  OutputModuleDescription desc(branchIDLists, maxEventsOut);
578  if (vMaxEventsOut != 0 && !vMaxEventsOut->empty()) {
579  std::string const& moduleLabel = c->description().moduleLabel();
580  try {
581  desc.maxEvents_ = vMaxEventsOut->getUntrackedParameter<int>(moduleLabel);
582  } catch (Exception const&) {
584  "\nNo entry in 'maxEvents' for output module label '" << moduleLabel << "'.\n";
585  }
586  }
587  c->configure(desc);
588  }
589  }
590 
591  bool Schedule::terminate() const {
592  if (all_output_communicators_.empty()) {
593  return false;
594  }
595  for (auto& c : all_output_communicators_) {
596  if (!c->limitReached()) {
597  // Found an output module that has not reached output event count.
598  return false;
599  }
600  }
601  LogInfo("SuccessfulTermination")
602  << "The job is terminating successfully because each output module\n"
603  << "has reached its configured limit.\n";
604  return true;
605  }
606 
608  globalSchedule_->endJob(collector);
609  if (collector.hasThrown()) {
610  return;
611  }
612 
613  if (wantSummary_ == false) return;
614  {
615  TriggerReport tr;
616  getTriggerReport(tr);
617 
618  // The trigger report (pass/fail etc.):
619 
620  LogVerbatim("FwkSummary") << "";
621  if(streamSchedules_[0]->context().processContext()->isSubProcess()) {
622  LogVerbatim("FwkSummary") << "TrigReport Process: "<<streamSchedules_[0]->context().processContext()->processName();
623  }
624  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Event Summary ------------";
625  if(!tr.trigPathSummaries.empty()) {
626  LogVerbatim("FwkSummary") << "TrigReport"
627  << " Events total = " << tr.eventSummary.totalEvents
628  << " passed = " << tr.eventSummary.totalEventsPassed
629  << " failed = " << tr.eventSummary.totalEventsFailed
630  << "";
631  } else {
632  LogVerbatim("FwkSummary") << "TrigReport"
633  << " Events total = " << tr.eventSummary.totalEvents
634  << " passed = " << tr.eventSummary.totalEvents
635  << " failed = 0";
636  }
637 
638  LogVerbatim("FwkSummary") << "";
639  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Path Summary ------------";
640  LogVerbatim("FwkSummary") << "TrigReport "
641  << std::right << std::setw(10) << "Trig Bit#" << " "
642  << std::right << std::setw(10) << "Executed" << " "
643  << std::right << std::setw(10) << "Passed" << " "
644  << std::right << std::setw(10) << "Failed" << " "
645  << std::right << std::setw(10) << "Error" << " "
646  << "Name" << "";
647  for (auto const& p: tr.trigPathSummaries) {
648  LogVerbatim("FwkSummary") << "TrigReport "
649  << std::right << std::setw(5) << 1
650  << std::right << std::setw(5) << p.bitPosition << " "
651  << std::right << std::setw(10) << p.timesRun << " "
652  << std::right << std::setw(10) << p.timesPassed << " "
653  << std::right << std::setw(10) << p.timesFailed << " "
654  << std::right << std::setw(10) << p.timesExcept << " "
655  << p.name << "";
656  }
657 
658  /*
659  std::vector<int>::const_iterator epi = empty_trig_paths_.begin();
660  std::vector<int>::const_iterator epe = empty_trig_paths_.end();
661  std::vector<std::string>::const_iterator epn = empty_trig_path_names_.begin();
662  for (; epi != epe; ++epi, ++epn) {
663 
664  LogVerbatim("FwkSummary") << "TrigReport "
665  << std::right << std::setw(5) << 1
666  << std::right << std::setw(5) << *epi << " "
667  << std::right << std::setw(10) << totalEvents() << " "
668  << std::right << std::setw(10) << totalEvents() << " "
669  << std::right << std::setw(10) << 0 << " "
670  << std::right << std::setw(10) << 0 << " "
671  << *epn << "";
672  }
673  */
674 
675  LogVerbatim("FwkSummary") << "";
676  LogVerbatim("FwkSummary") << "TrigReport " << "-------End-Path Summary ------------";
677  LogVerbatim("FwkSummary") << "TrigReport "
678  << std::right << std::setw(10) << "Trig Bit#" << " "
679  << std::right << std::setw(10) << "Executed" << " "
680  << std::right << std::setw(10) << "Passed" << " "
681  << std::right << std::setw(10) << "Failed" << " "
682  << std::right << std::setw(10) << "Error" << " "
683  << "Name" << "";
684  for (auto const& p: tr.endPathSummaries) {
685  LogVerbatim("FwkSummary") << "TrigReport "
686  << std::right << std::setw(5) << 0
687  << std::right << std::setw(5) << p.bitPosition << " "
688  << std::right << std::setw(10) << p.timesRun << " "
689  << std::right << std::setw(10) << p.timesPassed << " "
690  << std::right << std::setw(10) << p.timesFailed << " "
691  << std::right << std::setw(10) << p.timesExcept << " "
692  << p.name << "";
693  }
694 
695  for (auto const& p: tr.trigPathSummaries) {
696  LogVerbatim("FwkSummary") << "";
697  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Modules in Path: " << p.name << " ------------";
698  LogVerbatim("FwkSummary") << "TrigReport "
699  << std::right << std::setw(10) << "Trig Bit#" << " "
700  << std::right << std::setw(10) << "Visited" << " "
701  << std::right << std::setw(10) << "Passed" << " "
702  << std::right << std::setw(10) << "Failed" << " "
703  << std::right << std::setw(10) << "Error" << " "
704  << "Name" << "";
705 
706  unsigned int bitpos = 0;
707  for (auto const& mod: p.moduleInPathSummaries) {
708  LogVerbatim("FwkSummary") << "TrigReport "
709  << std::right << std::setw(5) << 1
710  << std::right << std::setw(5) << bitpos << " "
711  << std::right << std::setw(10) << mod.timesVisited << " "
712  << std::right << std::setw(10) << mod.timesPassed << " "
713  << std::right << std::setw(10) << mod.timesFailed << " "
714  << std::right << std::setw(10) << mod.timesExcept << " "
715  << mod.moduleLabel << "";
716  ++bitpos;
717  }
718  }
719 
720  for (auto const& p: tr.endPathSummaries) {
721  LogVerbatim("FwkSummary") << "";
722  LogVerbatim("FwkSummary") << "TrigReport " << "------ Modules in End-Path: " << p.name << " ------------";
723  LogVerbatim("FwkSummary") << "TrigReport "
724  << std::right << std::setw(10) << "Trig Bit#" << " "
725  << std::right << std::setw(10) << "Visited" << " "
726  << std::right << std::setw(10) << "Passed" << " "
727  << std::right << std::setw(10) << "Failed" << " "
728  << std::right << std::setw(10) << "Error" << " "
729  << "Name" << "";
730 
731  unsigned int bitpos=0;
732  for (auto const& mod: p.moduleInPathSummaries) {
733  LogVerbatim("FwkSummary") << "TrigReport "
734  << std::right << std::setw(5) << 0
735  << std::right << std::setw(5) << bitpos << " "
736  << std::right << std::setw(10) << mod.timesVisited << " "
737  << std::right << std::setw(10) << mod.timesPassed << " "
738  << std::right << std::setw(10) << mod.timesFailed << " "
739  << std::right << std::setw(10) << mod.timesExcept << " "
740  << mod.moduleLabel << "";
741  ++bitpos;
742  }
743  }
744 
745  LogVerbatim("FwkSummary") << "";
746  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Module Summary ------------";
747  LogVerbatim("FwkSummary") << "TrigReport "
748  << std::right << std::setw(10) << "Visited" << " "
749  << std::right << std::setw(10) << "Executed" << " "
750  << std::right << std::setw(10) << "Passed" << " "
751  << std::right << std::setw(10) << "Failed" << " "
752  << std::right << std::setw(10) << "Error" << " "
753  << "Name" << "";
754  for (auto const& worker : tr.workerSummaries) {
755  LogVerbatim("FwkSummary") << "TrigReport "
756  << std::right << std::setw(10) << worker.timesVisited << " "
757  << std::right << std::setw(10) << worker.timesRun << " "
758  << std::right << std::setw(10) << worker.timesPassed << " "
759  << std::right << std::setw(10) << worker.timesFailed << " "
760  << std::right << std::setw(10) << worker.timesExcept << " "
761  << worker.moduleLabel << "";
762  }
763  LogVerbatim("FwkSummary") << "";
764  }
765  // The timing report (CPU and Real Time):
768 
769  const int totalEvents = std::max(1, tr.eventSummary.totalEvents);
770 
771  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Event Summary ---[sec]----";
772  LogVerbatim("FwkSummary") << "TimeReport"
773  << std::setprecision(6) << std::fixed
774  << " event loop CPU/event = " << tr.eventSummary.cpuTime/totalEvents;
775  LogVerbatim("FwkSummary") << "TimeReport"
776  << std::setprecision(6) << std::fixed
777  << " event loop Real/event = " << tr.eventSummary.realTime/totalEvents;
778  LogVerbatim("FwkSummary") << "TimeReport"
779  << std::setprecision(6) << std::fixed
780  << " sum Streams Real/event = " << tr.eventSummary.sumStreamRealTime/totalEvents;
781  LogVerbatim("FwkSummary") << "TimeReport"
782  << std::setprecision(6) << std::fixed
783  << " efficiency CPU/Real/thread = " << tr.eventSummary.cpuTime/tr.eventSummary.realTime/preallocConfig_.numberOfThreads();
784 
785  constexpr int kColumn1Size = 10;
786  constexpr int kColumn2Size = 12;
787  constexpr int kColumn3Size = 12;
788  LogVerbatim("FwkSummary") << "";
789  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Path Summary ---[Real sec]----";
790  LogVerbatim("FwkSummary") << "TimeReport "
791  << std::right << std::setw(kColumn1Size) << "per event"<<" "
792  << std::right << std::setw(kColumn2Size) << "per exec"
793  << " Name";
794  for (auto const& p: tr.trigPathSummaries) {
795  const int timesRun = std::max(1, p.timesRun);
796  LogVerbatim("FwkSummary") << "TimeReport "
797  << std::setprecision(6) << std::fixed
798  << std::right << std::setw(kColumn1Size) << p.realTime/totalEvents << " "
799  << std::right << std::setw(kColumn2Size) << p.realTime/timesRun << " "
800  << p.name << "";
801  }
802  LogVerbatim("FwkSummary") << "TimeReport "
803  << std::right << std::setw(kColumn1Size) << "per event"<<" "
804  << std::right << std::setw(kColumn2Size) << "per exec"
805  << " Name" << "";
806 
807  LogVerbatim("FwkSummary") << "";
808  LogVerbatim("FwkSummary") << "TimeReport " << "-------End-Path Summary ---[Real sec]----";
809  LogVerbatim("FwkSummary") << "TimeReport "
810  << std::right << std::setw(kColumn1Size) << "per event" <<" "
811  << std::right << std::setw(kColumn2Size) << "per exec"
812  << " Name" << "";
813  for (auto const& p: tr.endPathSummaries) {
814  const int timesRun = std::max(1, p.timesRun);
815 
816  LogVerbatim("FwkSummary") << "TimeReport "
817  << std::setprecision(6) << std::fixed
818  << std::right << std::setw(kColumn1Size) << p.realTime/totalEvents << " "
819  << std::right << std::setw(kColumn2Size) << p.realTime/timesRun << " "
820  << p.name << "";
821  }
822  LogVerbatim("FwkSummary") << "TimeReport "
823  << std::right << std::setw(kColumn1Size) << "per event" <<" "
824  << std::right << std::setw(kColumn2Size) << "per exec"
825  << " Name" << "";
826 
827  for (auto const& p: tr.trigPathSummaries) {
828  LogVerbatim("FwkSummary") << "";
829  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Modules in Path: " << p.name << " ---[Real sec]----";
830  LogVerbatim("FwkSummary") << "TimeReport "
831  << std::right << std::setw(kColumn1Size) << "per event" <<" "
832  << std::right << std::setw(kColumn2Size) << "per visit"
833  << " Name" << "";
834  for (auto const& mod: p.moduleInPathSummaries) {
835  LogVerbatim("FwkSummary") << "TimeReport "
836  << std::setprecision(6) << std::fixed
837  << std::right << std::setw(kColumn1Size) << mod.realTime/totalEvents << " "
838  << std::right << std::setw(kColumn2Size) << mod.realTime/std::max(1, mod.timesVisited) << " "
839  << mod.moduleLabel << "";
840  }
841  }
842  if(not tr.trigPathSummaries.empty()) {
843  LogVerbatim("FwkSummary") << "TimeReport "
844  << std::right << std::setw(kColumn1Size) << "per event" <<" "
845  << std::right << std::setw(kColumn2Size) << "per visit"
846  << " Name" << "";
847  }
848  for (auto const& p: tr.endPathSummaries) {
849  LogVerbatim("FwkSummary") << "";
850  LogVerbatim("FwkSummary") << "TimeReport " << "------ Modules in End-Path: " << p.name << " ---[Real sec]----";
851  LogVerbatim("FwkSummary") << "TimeReport "
852  << std::right << std::setw(kColumn1Size) << "per event" <<" "
853  << std::right << std::setw(kColumn2Size) << "per visit"
854  << " Name" << "";
855  for (auto const& mod: p.moduleInPathSummaries) {
856  LogVerbatim("FwkSummary") << "TimeReport "
857  << std::setprecision(6) << std::fixed
858  << std::right << std::setw(kColumn1Size) << mod.realTime/totalEvents << " "
859  << std::right << std::setw(kColumn2Size) << mod.realTime/std::max(1, mod.timesVisited) << " "
860  << mod.moduleLabel << "";
861  }
862  }
863  if(not tr.endPathSummaries.empty()) {
864  LogVerbatim("FwkSummary") << "TimeReport "
865  << std::right << std::setw(kColumn1Size) << "per event" <<" "
866  << std::right << std::setw(kColumn2Size) << "per visit"
867  << " Name" << "";
868  }
869  LogVerbatim("FwkSummary") << "";
870  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Module Summary ---[Real sec]----";
871  LogVerbatim("FwkSummary") << "TimeReport "
872  << std::right << std::setw(kColumn1Size) << "per event" <<" "
873  << std::right << std::setw(kColumn2Size) << "per exec" <<" "
874  << std::right << std::setw(kColumn3Size) << "per visit"
875  << " Name" << "";
876  for (auto const& worker : tr.workerSummaries) {
877  LogVerbatim("FwkSummary") << "TimeReport "
878  << std::setprecision(6) << std::fixed
879  << std::right << std::setw(kColumn1Size) << worker.realTime/totalEvents << " "
880  << std::right << std::setw(kColumn2Size) << worker.realTime/std::max(1, worker.timesRun) << " "
881  << std::right << std::setw(kColumn3Size) << worker.realTime/std::max(1, worker.timesVisited) << " "
882  << worker.moduleLabel << "";
883  }
884  LogVerbatim("FwkSummary") << "TimeReport "
885  << std::right << std::setw(kColumn1Size) << "per event" <<" "
886  << std::right << std::setw(kColumn2Size) << "per exec" <<" "
887  << std::right << std::setw(kColumn3Size) << "per visit"
888  << " Name" << "";
889 
890  LogVerbatim("FwkSummary") << "";
891  LogVerbatim("FwkSummary") << "T---Report end!" << "";
892  LogVerbatim("FwkSummary") << "";
893  }
894 
896  using std::placeholders::_1;
898  }
899 
901  using std::placeholders::_1;
903  }
904 
906  using std::placeholders::_1;
908  }
909 
910  void Schedule::writeRun(RunPrincipal const& rp, ProcessContext const* processContext) {
911  using std::placeholders::_1;
912  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::writeRun, _1, std::cref(rp), processContext));
913  }
914 
915  void Schedule::writeLumi(LuminosityBlockPrincipal const& lbp, ProcessContext const* processContext) {
916  using std::placeholders::_1;
917  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::writeLumi, _1, std::cref(lbp), processContext));
918  }
919 
921  using std::placeholders::_1;
922  // Return true iff at least one output module returns true.
923  return (std::find_if (all_output_communicators_.begin(), all_output_communicators_.end(),
925  != all_output_communicators_.end());
926  }
927 
929  using std::placeholders::_1;
930  for_all(allWorkers(), std::bind(&Worker::respondToOpenInputFile, _1, std::cref(fb)));
931  }
932 
934  using std::placeholders::_1;
935  for_all(allWorkers(), std::bind(&Worker::respondToCloseInputFile, _1, std::cref(fb)));
936  }
937 
938  void Schedule::beginJob(ProductRegistry const& iRegistry) {
939  globalSchedule_->beginJob(iRegistry);
940  }
941 
942  void Schedule::beginStream(unsigned int iStreamID) {
943  assert(iStreamID<streamSchedules_.size());
944  streamSchedules_[iStreamID]->beginStream();
945  }
946 
947  void Schedule::endStream(unsigned int iStreamID) {
948  assert(iStreamID<streamSchedules_.size());
949  streamSchedules_[iStreamID]->endStream();
950  }
951 
953  unsigned int iStreamID,
954  EventPrincipal& ep,
955  EventSetup const& es) {
956  assert(iStreamID<streamSchedules_.size());
957  streamSchedules_[iStreamID]->processOneEventAsync(std::move(iTask),ep,es);
958  }
959 
961  using std::placeholders::_1;
963  }
964  void Schedule::postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {
965  using std::placeholders::_1;
966  for_all(allWorkers(), std::bind(&Worker::postForkReacquireResources, _1, iChildIndex, iNumberOfChildren));
967  }
968 
970  ParameterSet const& iPSet,
971  const ProductRegistry& iRegistry) {
972  Worker* found = nullptr;
973  for (auto const& worker : allWorkers()) {
974  if (worker->description().moduleLabel() == iLabel) {
975  found = worker;
976  break;
977  }
978  }
979  if (nullptr == found) {
980  return false;
981  }
982 
983  auto newMod = moduleRegistry_->replaceModule(iLabel,iPSet,preallocConfig_);
984 
985  globalSchedule_->replaceModule(newMod,iLabel);
986 
987  for(auto& s: streamSchedules_) {
988  s->replaceModule(newMod,iLabel);
989  }
990 
991  {
992  //Need to updateLookup in order to make getByToken work
993  auto const runLookup = iRegistry.productLookup(InRun);
994  auto const lumiLookup = iRegistry.productLookup(InLumi);
995  auto const eventLookup = iRegistry.productLookup(InEvent);
996  found->updateLookup(InRun,*runLookup);
997  found->updateLookup(InLumi,*lumiLookup);
998  found->updateLookup(InEvent,*eventLookup);
999  }
1000 
1001  return true;
1002  }
1003 
1004  std::vector<ModuleDescription const*>
1006  std::vector<ModuleDescription const*> result;
1007  result.reserve(allWorkers().size());
1008 
1009  for (auto const& worker : allWorkers()) {
1010  ModuleDescription const* p = worker->descPtr();
1011  result.push_back(p);
1012  }
1013  return result;
1014  }
1015 
1016  Schedule::AllWorkers const&
1018  return globalSchedule_->allWorkers();
1019  }
1020 
1021  void
1022  Schedule::availablePaths(std::vector<std::string>& oLabelsToFill) const {
1023  streamSchedules_[0]->availablePaths(oLabelsToFill);
1024  }
1025 
1026  void
1027  Schedule::triggerPaths(std::vector<std::string>& oLabelsToFill) const {
1028  streamSchedules_[0]->triggerPaths(oLabelsToFill);
1029  }
1030 
1031  void
1032  Schedule::endPaths(std::vector<std::string>& oLabelsToFill) const {
1033  streamSchedules_[0]->endPaths(oLabelsToFill);
1034  }
1035 
1036  void
1038  std::vector<std::string>& oLabelsToFill) const {
1039  streamSchedules_[0]->modulesInPath(iPathLabel,oLabelsToFill);
1040  }
1041 
1042  void
1044  std::vector<ModuleDescription const*>& descriptions,
1045  unsigned int hint) const {
1046  streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1047  }
1048 
1049  void
1051  std::vector<ModuleDescription const*>& descriptions,
1052  unsigned int hint) const {
1053  streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1054  }
1055 
1056  void
1057  Schedule::fillModuleAndConsumesInfo(std::vector<ModuleDescription const*>& allModuleDescriptions,
1058  std::vector<std::pair<unsigned int, unsigned int> >& moduleIDToIndex,
1059  std::vector<std::vector<ModuleDescription const*> >& modulesWhoseProductsAreConsumedBy,
1060  ProductRegistry const& preg) const {
1061  allModuleDescriptions.clear();
1062  moduleIDToIndex.clear();
1063  modulesWhoseProductsAreConsumedBy.clear();
1064 
1065  allModuleDescriptions.reserve(allWorkers().size());
1066  moduleIDToIndex.reserve(allWorkers().size());
1067  modulesWhoseProductsAreConsumedBy.resize(allWorkers().size());
1068 
1069  std::map<std::string, ModuleDescription const*> labelToDesc;
1070  unsigned int i = 0;
1071  for (auto const& worker : allWorkers()) {
1072  ModuleDescription const* p = worker->descPtr();
1073  allModuleDescriptions.push_back(p);
1074  moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->id(), i));
1075  labelToDesc[p->moduleLabel()] = p;
1076  ++i;
1077  }
1078  sort_all(moduleIDToIndex);
1079 
1080  i = 0;
1081  for (auto const& worker : allWorkers()) {
1082  std::vector<ModuleDescription const*>& modules = modulesWhoseProductsAreConsumedBy.at(i);
1083  worker->modulesWhoseProductsAreConsumed(modules, preg, labelToDesc);
1084  ++i;
1085  }
1086  }
1087 
1088  void
1090  endpathsAreActive_ = active;
1091  for(auto& s : streamSchedules_) {
1092  s->enableEndPaths(active);
1093  }
1094  }
1095 
1096  bool
1098  return endpathsAreActive_;
1099  }
1100 
1101  void
1103  rep.eventSummary.totalEvents = 0;
1106  for(auto& s: streamSchedules_) {
1107  s->getTriggerReport(rep);
1108  }
1109  }
1110 
1111  void
1113  rep.eventSummary.totalEvents = 0;
1114  rep.eventSummary.cpuTime = 0.;
1115  rep.eventSummary.realTime = 0.;
1116  summaryTimeKeeper_->fillTriggerTimingReport(rep);
1117  }
1118 
1119  int
1121  int returnValue = 0;
1122  for(auto& s: streamSchedules_) {
1123  returnValue += s->totalEvents();
1124  }
1125  return returnValue;
1126  }
1127 
1128  int
1130  int returnValue = 0;
1131  for(auto& s: streamSchedules_) {
1132  returnValue += s->totalEventsPassed();
1133  }
1134  return returnValue;
1135  }
1136 
1137  int
1139  int returnValue = 0;
1140  for(auto& s: streamSchedules_) {
1141  returnValue += s->totalEventsFailed();
1142  }
1143  return returnValue;
1144  }
1145 
1146 
1147  void
1149  for(auto& s: streamSchedules_) {
1150  s->clearCounters();
1151  }
1152  }
1153 }
size
Write out results.
bool empty() const
Definition: ParameterSet.h:218
std::vector< PathSummary > endPathSummaries
Definition: TriggerReport.h:68
T getUntrackedParameter(std::string const &, T const &) const
std::vector< PathTimingSummary > endPathSummaries
int i
Definition: DBlmapReader.cc:9
void stopEvent(StreamContext const &)
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
void fillModuleAndConsumesInfo(std::vector< ModuleDescription const * > &allModuleDescriptions, std::vector< std::pair< unsigned int, unsigned int > > &moduleIDToIndex, std::vector< std::vector< ModuleDescription const * > > &modulesWhoseProductsAreConsumedBy, ProductRegistry const &preg) const
Definition: Schedule.cc:1057
virtual void openFile(FileBlock const &fb)=0
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:1017
roAction_t actions[nactions]
Definition: GenABIO.cc:187
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Definition: Schedule.cc:1022
virtual void writeRun(RunPrincipal const &rp, ProcessContext const *)=0
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
bool endPathsEnabled() const
Definition: Schedule.cc:1097
void respondToCloseInputFile(FileBlock const &fb)
Definition: Schedule.cc:933
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ModuleRegistry const > moduleRegistry() const
Definition: Schedule.h:271
std::vector< Worker * > AllWorkers
Definition: Schedule.h:117
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
virtual bool shouldWeCloseFile() const =0
void writeRun(RunPrincipal const &rp, ProcessContext const *)
Definition: Schedule.cc:910
void endStream(unsigned int)
Definition: Schedule.cc:947
void writeLumi(LuminosityBlockPrincipal const &lbp, ProcessContext const *)
Definition: Schedule.cc:915
void enableEndPaths(bool active)
Definition: Schedule.cc:1089
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
virtual void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &)=0
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1050
std::vector< WorkerSummary > workerSummaries
Definition: TriggerReport.h:69
edm::propagate_const< std::unique_ptr< SystemTimeKeeper > > summaryTimeKeeper_
Definition: Schedule.h:283
std::string const & moduleLabel() const
static unsigned int getUniqueID()
Returns a unique id each time called. Intended to be passed to ModuleDescription&#39;s constructor&#39;s modI...
#define constexpr
int totalEventsFailed() const
Definition: Schedule.cc:1138
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
Definition: Schedule.h:278
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry)
Definition: Schedule.cc:969
void eraseOrSetUntrackedParameterSet(std::string const &name)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
int totalEventsPassed() const
Definition: Schedule.cc:1129
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
Definition: Schedule.cc:1027
std::vector< PathSummary > trigPathSummaries
Definition: TriggerReport.h:67
EventSummary eventSummary
Definition: TriggerReport.h:66
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists)
Definition: Schedule.cc:552
int totalEvents() const
Definition: Schedule.cc:1120
virtual void openNewFileIfNeeded()=0
EventTimingSummary eventSummary
void clearCounters()
Clear all the counters in the trigger report.
Definition: Schedule.cc:1148
std::vector< PathTimingSummary > trigPathSummaries
bool terminate() const
Return whether each output module has reached its maximum count.
Definition: Schedule.cc:591
void respondToOpenInputFile(FileBlock const &fb)
Definition: Schedule.cc:928
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
Definition: Schedule.h:275
rep
Definition: cuy.py:1188
virtual void writeLumi(LuminosityBlockPrincipal const &lbp, ProcessContext const *)=0
void stopPath(StreamContext const &, PathContext const &, HLTPathStatus const &)
void stopModuleEvent(StreamContext const &, ModuleCallingContext const &)
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: Worker.h:110
void getTriggerReport(TriggerReport &rep) const
Definition: Schedule.cc:1102
PreallocationConfiguration preallocConfig_
Definition: Schedule.h:281
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
Definition: Schedule.h:276
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
volatile bool endpathsAreActive_
Definition: Schedule.h:287
void respondToOpenInputFile(FileBlock const &fb)
Definition: Worker.h:106
std::shared_ptr< TriggerResultInserter const > resultsInserter() const
Definition: Schedule.h:269
void startPath(StreamContext const &, PathContext const &)
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
virtual std::unique_ptr< OutputModuleCommunicator > createOutputModuleCommunicator()=0
AllOutputModuleCommunicators all_output_communicators_
Definition: Schedule.h:280
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 ...
Definition: Schedule.cc:1037
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
void beginStream(unsigned int)
Definition: Schedule.cc:942
void respondToCloseInputFile(FileBlock const &fb)
Definition: Worker.h:107
void preForkReleaseResources()
Definition: Worker.h:109
bool wantSummary_
Definition: Schedule.h:285
HLT enums.
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: Schedule.cc:964
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Definition: Schedule.cc:1005
Strings const & getTrigPaths() const
void processOneEventAsync(WaitingTaskHolder iTask, unsigned int iStreamID, EventPrincipal &principal, EventSetup const &eventSetup)
Definition: Schedule.cc:952
void beginJob(ProductRegistry const &)
Definition: Schedule.cc:938
void openNewOutputFilesIfNeeded()
Definition: Schedule.cc:900
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
void preForkReleaseResources()
Definition: Schedule.cc:960
void openOutputFiles(FileBlock &fb)
Definition: Schedule.cc:905
Schedule(ParameterSet &proc_pset, service::TriggerNamesService &tns, ProductRegistry &pregistry, BranchIDListHelper &branchIDListHelper, ThinnedAssociationsHelper &thinnedAssociationsHelper, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, bool hasSubprocesses, PreallocationConfiguration const &config, ProcessContext const *processContext)
Definition: Schedule.cc:372
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void endJob(ExceptionCollector &collector)
Definition: Schedule.cc:607
void getTriggerTimingReport(TriggerTimingReport &rep) const
Definition: Schedule.cc:1112
bool shouldWeCloseOutput() const
Definition: Schedule.cc:920
std::vector< std::string > vstring
Definition: Schedule.cc:368
def move(src, dest)
Definition: eostools.py:510
void closeOutputFiles()
Definition: Schedule.cc:895
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
Definition: Schedule.cc:1032
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1043
unsigned int id() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)