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  SubProcessParentageHelper const* subProcessParentageHelper,
378  ExceptionToActionTable const& actions,
379  std::shared_ptr<ActivityRegistry> areg,
380  std::shared_ptr<ProcessConfiguration> processConfiguration,
381  bool hasSubprocesses,
382  PreallocationConfiguration const& prealloc,
383  ProcessContext const* processContext) :
384  //Only create a resultsInserter if there is a trigger path
385  resultsInserter_{tns.getTrigPaths().empty()? std::shared_ptr<TriggerResultInserter>{} :makeInserter(proc_pset,prealloc,preg,actions,areg,processConfiguration)},
388  preallocConfig_(prealloc),
389  wantSummary_(tns.wantSummary()),
390  endpathsAreActive_(true)
391  {
392  assert(0<prealloc.numberOfStreams());
393  streamSchedules_.reserve(prealloc.numberOfStreams());
394  for(unsigned int i=0; i<prealloc.numberOfStreams();++i) {
395  streamSchedules_.emplace_back(std::make_shared<StreamSchedule>(
396  resultsInserter(),
397  moduleRegistry(),
398  proc_pset,tns,prealloc,preg,
399  branchIDListHelper,actions,
400  areg,processConfiguration,
401  !hasSubprocesses,
402  StreamID{i},
403  processContext));
404  }
405 
406  //TriggerResults are injected automatically by StreamSchedules and are
407  // unknown to the ModuleRegistry
408  const std::string kTriggerResults("TriggerResults");
409  std::vector<std::string> modulesToUse;
410  modulesToUse.reserve(streamSchedules_[0]->allWorkers().size());
411  for(auto const& worker : streamSchedules_[0]->allWorkers()) {
412  if(worker->description().moduleLabel() != kTriggerResults) {
413  modulesToUse.push_back(worker->description().moduleLabel());
414  }
415  }
416  //The unscheduled modules are at the end of the list, but we want them at the front
417  unsigned int n = streamSchedules_[0]->numberOfUnscheduledModules();
418  if(n>0) {
419  std::vector<std::string> temp;
420  temp.reserve(modulesToUse.size());
421  auto itBeginUnscheduled = modulesToUse.begin()+modulesToUse.size()-n;
422  std::copy(itBeginUnscheduled,modulesToUse.end(),
423  std::back_inserter(temp));
424  std::copy(modulesToUse.begin(),itBeginUnscheduled,std::back_inserter(temp));
425  temp.swap(modulesToUse);
426  }
427 
428  // propagate_const<T> has no reset() function
429  globalSchedule_ = std::make_unique<GlobalSchedule>(
430  resultsInserter(),
431  moduleRegistry(),
432  modulesToUse,
433  proc_pset, preg, prealloc,
434  actions,areg,processConfiguration,processContext);
435 
436  //TriggerResults is not in the top level ParameterSet so the call to
437  // reduceParameterSet would fail to find it. Just remove it up front.
438  std::set<std::string> usedModuleLabels;
439  for(auto const& worker: allWorkers()) {
440  if(worker->description().moduleLabel() != kTriggerResults) {
441  usedModuleLabels.insert(worker->description().moduleLabel());
442  }
443  }
444  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string> >("@all_modules"));
445  std::map<std::string, std::vector<std::pair<std::string, int> > > outputModulePathPositions;
446  reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels,
447  outputModulePathPositions);
448  processEDAliases(proc_pset, processConfiguration->processName(), preg);
449  proc_pset.registerIt();
450  processConfiguration->setParameterSetID(proc_pset.id());
451  processConfiguration->setProcessConfigurationID();
452 
453  // This is used for a little sanity-check to make sure no code
454  // modifications alter the number of workers at a later date.
455  size_t all_workers_count = allWorkers().size();
456 
457  moduleRegistry_->forAllModuleHolders([this](maker::ModuleHolder* iHolder){
458  auto comm = iHolder->createOutputModuleCommunicator();
459  if (comm) {
460  all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
461  }
462  });
463  // Now that the output workers are filled in, set any output limits or information.
464  limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
465 
466  // Sanity check: make sure nobody has added a worker after we've
467  // already relied on the WorkerManager being full.
468  assert (all_workers_count == allWorkers().size());
469 
470  branchIDListHelper.updateFromRegistry(preg);
471 
472  for(auto const& worker : streamSchedules_[0]->allWorkers()) {
473  worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
474  }
475  thinnedAssociationsHelper.sort();
476 
477  // The output modules consume products in kept branches.
478  // So we must set this up before freezing.
479  for (auto& c : all_output_communicators_) {
480  c->selectProducts(preg, thinnedAssociationsHelper);
481  }
482 
483  {
484  // We now get a collection of types that may be consumed.
485  std::set<TypeID> productTypesConsumed;
486  std::set<TypeID> elementTypesConsumed;
487  // Loop over all modules
488  for (auto const& worker : allWorkers()) {
489  for (auto const& consumesInfo : worker->consumesInfo()) {
490  if (consumesInfo.kindOfType() == PRODUCT_TYPE) {
491  productTypesConsumed.emplace(consumesInfo.type());
492  } else {
493  elementTypesConsumed.emplace(consumesInfo.type());
494  }
495  }
496  }
497  // The SubProcess class is not a module, yet it may consume.
498  if(hasSubprocesses) {
499  productTypesConsumed.emplace(typeid(TriggerResults));
500  }
501  // The RandomNumberGeneratorService is not a module, yet it consumes.
502  {
503  RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed);
504  }
505  preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
506  }
507 
508  for (auto& c : all_output_communicators_) {
509  c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
510  }
511 
512  if(wantSummary_) {
513  std::vector<const ModuleDescription*> modDesc;
514  const auto& workers = allWorkers();
515  modDesc.reserve(workers.size());
516 
517  std::transform(workers.begin(),workers.end(),
518  std::back_inserter(modDesc),
519  [](const Worker* iWorker) -> const ModuleDescription* {
520  return iWorker->descPtr();
521  });
522 
523  // propagate_const<T> has no reset() function
524  summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(
525  prealloc.numberOfStreams(),
526  modDesc,
527  tns,
528  processContext);
529  auto timeKeeperPtr = summaryTimeKeeper_.get();
530 
531  areg->watchPreModuleEvent(timeKeeperPtr, &SystemTimeKeeper::startModuleEvent);
532  areg->watchPostModuleEvent(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
533  areg->watchPreModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::pauseModuleEvent);
534  areg->watchPostModuleEventDelayedGet(timeKeeperPtr,&SystemTimeKeeper::restartModuleEvent);
535 
536  areg->watchPreSourceEvent(timeKeeperPtr, &SystemTimeKeeper::startEvent);
537  areg->watchPostEvent(timeKeeperPtr, &SystemTimeKeeper::stopEvent);
538 
539  areg->watchPrePathEvent(timeKeeperPtr, &SystemTimeKeeper::startPath);
540  areg->watchPostPathEvent(timeKeeperPtr, &SystemTimeKeeper::stopPath);
541 
542  areg->watchPostBeginJob(timeKeeperPtr, &SystemTimeKeeper::startProcessingLoop);
543  areg->watchPreEndJob(timeKeeperPtr, &SystemTimeKeeper::stopProcessingLoop);
544  //areg->preModuleEventSignal_.connect([timeKeeperPtr](StreamContext const& iContext, ModuleCallingContext const& iMod) {
545  //timeKeeperPtr->startModuleEvent(iContext,iMod);
546  //});
547  }
548 
549  } // Schedule::Schedule
550 
551 
552  void
554  BranchIDLists const& branchIDLists,
555  SubProcessParentageHelper const* subProcessParentageHelper) {
556  std::string const output("output");
557 
558  ParameterSet const& maxEventsPSet = proc_pset.getUntrackedParameterSet("maxEvents", ParameterSet());
559  int maxEventSpecs = 0;
560  int maxEventsOut = -1;
561  ParameterSet const* vMaxEventsOut = 0;
562  std::vector<std::string> intNamesE = maxEventsPSet.getParameterNamesForType<int>(false);
563  if (search_all(intNamesE, output)) {
564  maxEventsOut = maxEventsPSet.getUntrackedParameter<int>(output);
565  ++maxEventSpecs;
566  }
567  std::vector<std::string> psetNamesE;
568  maxEventsPSet.getParameterSetNames(psetNamesE, false);
569  if (search_all(psetNamesE, output)) {
570  vMaxEventsOut = &maxEventsPSet.getUntrackedParameterSet(output);
571  ++maxEventSpecs;
572  }
573 
574  if (maxEventSpecs > 1) {
576  "\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
577  }
578 
579  for (auto& c : all_output_communicators_) {
580  OutputModuleDescription desc(branchIDLists, maxEventsOut, subProcessParentageHelper);
581  if (vMaxEventsOut != 0 && !vMaxEventsOut->empty()) {
582  std::string const& moduleLabel = c->description().moduleLabel();
583  try {
584  desc.maxEvents_ = vMaxEventsOut->getUntrackedParameter<int>(moduleLabel);
585  } catch (Exception const&) {
587  "\nNo entry in 'maxEvents' for output module label '" << moduleLabel << "'.\n";
588  }
589  }
590  c->configure(desc);
591  }
592  }
593 
594  bool Schedule::terminate() const {
595  if (all_output_communicators_.empty()) {
596  return false;
597  }
598  for (auto& c : all_output_communicators_) {
599  if (!c->limitReached()) {
600  // Found an output module that has not reached output event count.
601  return false;
602  }
603  }
604  LogInfo("SuccessfulTermination")
605  << "The job is terminating successfully because each output module\n"
606  << "has reached its configured limit.\n";
607  return true;
608  }
609 
611  globalSchedule_->endJob(collector);
612  if (collector.hasThrown()) {
613  return;
614  }
615 
616  if (wantSummary_ == false) return;
617  {
618  TriggerReport tr;
619  getTriggerReport(tr);
620 
621  // The trigger report (pass/fail etc.):
622 
623  LogVerbatim("FwkSummary") << "";
624  if(streamSchedules_[0]->context().processContext()->isSubProcess()) {
625  LogVerbatim("FwkSummary") << "TrigReport Process: "<<streamSchedules_[0]->context().processContext()->processName();
626  }
627  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Event Summary ------------";
628  if(!tr.trigPathSummaries.empty()) {
629  LogVerbatim("FwkSummary") << "TrigReport"
630  << " Events total = " << tr.eventSummary.totalEvents
631  << " passed = " << tr.eventSummary.totalEventsPassed
632  << " failed = " << tr.eventSummary.totalEventsFailed
633  << "";
634  } else {
635  LogVerbatim("FwkSummary") << "TrigReport"
636  << " Events total = " << tr.eventSummary.totalEvents
637  << " passed = " << tr.eventSummary.totalEvents
638  << " failed = 0";
639  }
640 
641  LogVerbatim("FwkSummary") << "";
642  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Path Summary ------------";
643  LogVerbatim("FwkSummary") << "TrigReport "
644  << std::right << std::setw(10) << "Trig Bit#" << " "
645  << std::right << std::setw(10) << "Executed" << " "
646  << std::right << std::setw(10) << "Passed" << " "
647  << std::right << std::setw(10) << "Failed" << " "
648  << std::right << std::setw(10) << "Error" << " "
649  << "Name" << "";
650  for (auto const& p: tr.trigPathSummaries) {
651  LogVerbatim("FwkSummary") << "TrigReport "
652  << std::right << std::setw(5) << 1
653  << std::right << std::setw(5) << p.bitPosition << " "
654  << std::right << std::setw(10) << p.timesRun << " "
655  << std::right << std::setw(10) << p.timesPassed << " "
656  << std::right << std::setw(10) << p.timesFailed << " "
657  << std::right << std::setw(10) << p.timesExcept << " "
658  << p.name << "";
659  }
660 
661  /*
662  std::vector<int>::const_iterator epi = empty_trig_paths_.begin();
663  std::vector<int>::const_iterator epe = empty_trig_paths_.end();
664  std::vector<std::string>::const_iterator epn = empty_trig_path_names_.begin();
665  for (; epi != epe; ++epi, ++epn) {
666 
667  LogVerbatim("FwkSummary") << "TrigReport "
668  << std::right << std::setw(5) << 1
669  << std::right << std::setw(5) << *epi << " "
670  << std::right << std::setw(10) << totalEvents() << " "
671  << std::right << std::setw(10) << totalEvents() << " "
672  << std::right << std::setw(10) << 0 << " "
673  << std::right << std::setw(10) << 0 << " "
674  << *epn << "";
675  }
676  */
677 
678  LogVerbatim("FwkSummary") << "";
679  LogVerbatim("FwkSummary") << "TrigReport " << "-------End-Path Summary ------------";
680  LogVerbatim("FwkSummary") << "TrigReport "
681  << std::right << std::setw(10) << "Trig Bit#" << " "
682  << std::right << std::setw(10) << "Executed" << " "
683  << std::right << std::setw(10) << "Passed" << " "
684  << std::right << std::setw(10) << "Failed" << " "
685  << std::right << std::setw(10) << "Error" << " "
686  << "Name" << "";
687  for (auto const& p: tr.endPathSummaries) {
688  LogVerbatim("FwkSummary") << "TrigReport "
689  << std::right << std::setw(5) << 0
690  << std::right << std::setw(5) << p.bitPosition << " "
691  << std::right << std::setw(10) << p.timesRun << " "
692  << std::right << std::setw(10) << p.timesPassed << " "
693  << std::right << std::setw(10) << p.timesFailed << " "
694  << std::right << std::setw(10) << p.timesExcept << " "
695  << p.name << "";
696  }
697 
698  for (auto const& p: tr.trigPathSummaries) {
699  LogVerbatim("FwkSummary") << "";
700  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Modules in Path: " << p.name << " ------------";
701  LogVerbatim("FwkSummary") << "TrigReport "
702  << std::right << std::setw(10) << "Trig Bit#" << " "
703  << std::right << std::setw(10) << "Visited" << " "
704  << std::right << std::setw(10) << "Passed" << " "
705  << std::right << std::setw(10) << "Failed" << " "
706  << std::right << std::setw(10) << "Error" << " "
707  << "Name" << "";
708 
709  unsigned int bitpos = 0;
710  for (auto const& mod: p.moduleInPathSummaries) {
711  LogVerbatim("FwkSummary") << "TrigReport "
712  << std::right << std::setw(5) << 1
713  << std::right << std::setw(5) << bitpos << " "
714  << std::right << std::setw(10) << mod.timesVisited << " "
715  << std::right << std::setw(10) << mod.timesPassed << " "
716  << std::right << std::setw(10) << mod.timesFailed << " "
717  << std::right << std::setw(10) << mod.timesExcept << " "
718  << mod.moduleLabel << "";
719  ++bitpos;
720  }
721  }
722 
723  for (auto const& p: tr.endPathSummaries) {
724  LogVerbatim("FwkSummary") << "";
725  LogVerbatim("FwkSummary") << "TrigReport " << "------ Modules in End-Path: " << p.name << " ------------";
726  LogVerbatim("FwkSummary") << "TrigReport "
727  << std::right << std::setw(10) << "Trig Bit#" << " "
728  << std::right << std::setw(10) << "Visited" << " "
729  << std::right << std::setw(10) << "Passed" << " "
730  << std::right << std::setw(10) << "Failed" << " "
731  << std::right << std::setw(10) << "Error" << " "
732  << "Name" << "";
733 
734  unsigned int bitpos=0;
735  for (auto const& mod: p.moduleInPathSummaries) {
736  LogVerbatim("FwkSummary") << "TrigReport "
737  << std::right << std::setw(5) << 0
738  << std::right << std::setw(5) << bitpos << " "
739  << std::right << std::setw(10) << mod.timesVisited << " "
740  << std::right << std::setw(10) << mod.timesPassed << " "
741  << std::right << std::setw(10) << mod.timesFailed << " "
742  << std::right << std::setw(10) << mod.timesExcept << " "
743  << mod.moduleLabel << "";
744  ++bitpos;
745  }
746  }
747 
748  LogVerbatim("FwkSummary") << "";
749  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Module Summary ------------";
750  LogVerbatim("FwkSummary") << "TrigReport "
751  << std::right << std::setw(10) << "Visited" << " "
752  << std::right << std::setw(10) << "Executed" << " "
753  << std::right << std::setw(10) << "Passed" << " "
754  << std::right << std::setw(10) << "Failed" << " "
755  << std::right << std::setw(10) << "Error" << " "
756  << "Name" << "";
757  for (auto const& worker : tr.workerSummaries) {
758  LogVerbatim("FwkSummary") << "TrigReport "
759  << std::right << std::setw(10) << worker.timesVisited << " "
760  << std::right << std::setw(10) << worker.timesRun << " "
761  << std::right << std::setw(10) << worker.timesPassed << " "
762  << std::right << std::setw(10) << worker.timesFailed << " "
763  << std::right << std::setw(10) << worker.timesExcept << " "
764  << worker.moduleLabel << "";
765  }
766  LogVerbatim("FwkSummary") << "";
767  }
768  // The timing report (CPU and Real Time):
771 
772  const int totalEvents = std::max(1, tr.eventSummary.totalEvents);
773 
774  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Event Summary ---[sec]----";
775  LogVerbatim("FwkSummary") << "TimeReport"
776  << std::setprecision(6) << std::fixed
777  << " event loop CPU/event = " << tr.eventSummary.cpuTime/totalEvents;
778  LogVerbatim("FwkSummary") << "TimeReport"
779  << std::setprecision(6) << std::fixed
780  << " event loop Real/event = " << tr.eventSummary.realTime/totalEvents;
781  LogVerbatim("FwkSummary") << "TimeReport"
782  << std::setprecision(6) << std::fixed
783  << " sum Streams Real/event = " << tr.eventSummary.sumStreamRealTime/totalEvents;
784  LogVerbatim("FwkSummary") << "TimeReport"
785  << std::setprecision(6) << std::fixed
786  << " efficiency CPU/Real/thread = " << tr.eventSummary.cpuTime/tr.eventSummary.realTime/preallocConfig_.numberOfThreads();
787 
788  constexpr int kColumn1Size = 10;
789  constexpr int kColumn2Size = 12;
790  constexpr int kColumn3Size = 12;
791  LogVerbatim("FwkSummary") << "";
792  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Path Summary ---[Real sec]----";
793  LogVerbatim("FwkSummary") << "TimeReport "
794  << std::right << std::setw(kColumn1Size) << "per event"<<" "
795  << std::right << std::setw(kColumn2Size) << "per exec"
796  << " Name";
797  for (auto const& p: tr.trigPathSummaries) {
798  const int timesRun = std::max(1, p.timesRun);
799  LogVerbatim("FwkSummary") << "TimeReport "
800  << std::setprecision(6) << std::fixed
801  << std::right << std::setw(kColumn1Size) << p.realTime/totalEvents << " "
802  << std::right << std::setw(kColumn2Size) << p.realTime/timesRun << " "
803  << p.name << "";
804  }
805  LogVerbatim("FwkSummary") << "TimeReport "
806  << std::right << std::setw(kColumn1Size) << "per event"<<" "
807  << std::right << std::setw(kColumn2Size) << "per exec"
808  << " Name" << "";
809 
810  LogVerbatim("FwkSummary") << "";
811  LogVerbatim("FwkSummary") << "TimeReport " << "-------End-Path Summary ---[Real sec]----";
812  LogVerbatim("FwkSummary") << "TimeReport "
813  << std::right << std::setw(kColumn1Size) << "per event" <<" "
814  << std::right << std::setw(kColumn2Size) << "per exec"
815  << " Name" << "";
816  for (auto const& p: tr.endPathSummaries) {
817  const int timesRun = std::max(1, p.timesRun);
818 
819  LogVerbatim("FwkSummary") << "TimeReport "
820  << std::setprecision(6) << std::fixed
821  << std::right << std::setw(kColumn1Size) << p.realTime/totalEvents << " "
822  << std::right << std::setw(kColumn2Size) << p.realTime/timesRun << " "
823  << p.name << "";
824  }
825  LogVerbatim("FwkSummary") << "TimeReport "
826  << std::right << std::setw(kColumn1Size) << "per event" <<" "
827  << std::right << std::setw(kColumn2Size) << "per exec"
828  << " Name" << "";
829 
830  for (auto const& p: tr.trigPathSummaries) {
831  LogVerbatim("FwkSummary") << "";
832  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Modules in Path: " << p.name << " ---[Real sec]----";
833  LogVerbatim("FwkSummary") << "TimeReport "
834  << std::right << std::setw(kColumn1Size) << "per event" <<" "
835  << std::right << std::setw(kColumn2Size) << "per visit"
836  << " Name" << "";
837  for (auto const& mod: p.moduleInPathSummaries) {
838  LogVerbatim("FwkSummary") << "TimeReport "
839  << std::setprecision(6) << std::fixed
840  << std::right << std::setw(kColumn1Size) << mod.realTime/totalEvents << " "
841  << std::right << std::setw(kColumn2Size) << mod.realTime/std::max(1, mod.timesVisited) << " "
842  << mod.moduleLabel << "";
843  }
844  }
845  if(not tr.trigPathSummaries.empty()) {
846  LogVerbatim("FwkSummary") << "TimeReport "
847  << std::right << std::setw(kColumn1Size) << "per event" <<" "
848  << std::right << std::setw(kColumn2Size) << "per visit"
849  << " Name" << "";
850  }
851  for (auto const& p: tr.endPathSummaries) {
852  LogVerbatim("FwkSummary") << "";
853  LogVerbatim("FwkSummary") << "TimeReport " << "------ Modules in End-Path: " << p.name << " ---[Real sec]----";
854  LogVerbatim("FwkSummary") << "TimeReport "
855  << std::right << std::setw(kColumn1Size) << "per event" <<" "
856  << std::right << std::setw(kColumn2Size) << "per visit"
857  << " Name" << "";
858  for (auto const& mod: p.moduleInPathSummaries) {
859  LogVerbatim("FwkSummary") << "TimeReport "
860  << std::setprecision(6) << std::fixed
861  << std::right << std::setw(kColumn1Size) << mod.realTime/totalEvents << " "
862  << std::right << std::setw(kColumn2Size) << mod.realTime/std::max(1, mod.timesVisited) << " "
863  << mod.moduleLabel << "";
864  }
865  }
866  if(not tr.endPathSummaries.empty()) {
867  LogVerbatim("FwkSummary") << "TimeReport "
868  << std::right << std::setw(kColumn1Size) << "per event" <<" "
869  << std::right << std::setw(kColumn2Size) << "per visit"
870  << " Name" << "";
871  }
872  LogVerbatim("FwkSummary") << "";
873  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Module Summary ---[Real sec]----";
874  LogVerbatim("FwkSummary") << "TimeReport "
875  << std::right << std::setw(kColumn1Size) << "per event" <<" "
876  << std::right << std::setw(kColumn2Size) << "per exec" <<" "
877  << std::right << std::setw(kColumn3Size) << "per visit"
878  << " Name" << "";
879  for (auto const& worker : tr.workerSummaries) {
880  LogVerbatim("FwkSummary") << "TimeReport "
881  << std::setprecision(6) << std::fixed
882  << std::right << std::setw(kColumn1Size) << worker.realTime/totalEvents << " "
883  << std::right << std::setw(kColumn2Size) << worker.realTime/std::max(1, worker.timesRun) << " "
884  << std::right << std::setw(kColumn3Size) << worker.realTime/std::max(1, worker.timesVisited) << " "
885  << worker.moduleLabel << "";
886  }
887  LogVerbatim("FwkSummary") << "TimeReport "
888  << std::right << std::setw(kColumn1Size) << "per event" <<" "
889  << std::right << std::setw(kColumn2Size) << "per exec" <<" "
890  << std::right << std::setw(kColumn3Size) << "per visit"
891  << " Name" << "";
892 
893  LogVerbatim("FwkSummary") << "";
894  LogVerbatim("FwkSummary") << "T---Report end!" << "";
895  LogVerbatim("FwkSummary") << "";
896  }
897 
899  using std::placeholders::_1;
901  }
902 
904  using std::placeholders::_1;
906  }
907 
909  using std::placeholders::_1;
911  }
912 
913  void Schedule::writeRun(RunPrincipal const& rp, ProcessContext const* processContext) {
914  using std::placeholders::_1;
915  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::writeRun, _1, std::cref(rp), processContext));
916  }
917 
918  void Schedule::writeLumi(LuminosityBlockPrincipal const& lbp, ProcessContext const* processContext) {
919  using std::placeholders::_1;
920  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::writeLumi, _1, std::cref(lbp), processContext));
921  }
922 
924  using std::placeholders::_1;
925  // Return true iff at least one output module returns true.
926  return (std::find_if (all_output_communicators_.begin(), all_output_communicators_.end(),
928  != all_output_communicators_.end());
929  }
930 
932  using std::placeholders::_1;
933  for_all(allWorkers(), std::bind(&Worker::respondToOpenInputFile, _1, std::cref(fb)));
934  }
935 
937  using std::placeholders::_1;
938  for_all(allWorkers(), std::bind(&Worker::respondToCloseInputFile, _1, std::cref(fb)));
939  }
940 
941  void Schedule::beginJob(ProductRegistry const& iRegistry) {
942  globalSchedule_->beginJob(iRegistry);
943  }
944 
945  void Schedule::beginStream(unsigned int iStreamID) {
946  assert(iStreamID<streamSchedules_.size());
947  streamSchedules_[iStreamID]->beginStream();
948  }
949 
950  void Schedule::endStream(unsigned int iStreamID) {
951  assert(iStreamID<streamSchedules_.size());
952  streamSchedules_[iStreamID]->endStream();
953  }
954 
956  unsigned int iStreamID,
957  EventPrincipal& ep,
958  EventSetup const& es) {
959  assert(iStreamID<streamSchedules_.size());
960  streamSchedules_[iStreamID]->processOneEventAsync(std::move(iTask),ep,es);
961  }
962 
964  using std::placeholders::_1;
966  }
967  void Schedule::postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {
968  using std::placeholders::_1;
969  for_all(allWorkers(), std::bind(&Worker::postForkReacquireResources, _1, iChildIndex, iNumberOfChildren));
970  }
971 
973  ParameterSet const& iPSet,
974  const ProductRegistry& iRegistry) {
975  Worker* found = nullptr;
976  for (auto const& worker : allWorkers()) {
977  if (worker->description().moduleLabel() == iLabel) {
978  found = worker;
979  break;
980  }
981  }
982  if (nullptr == found) {
983  return false;
984  }
985 
986  auto newMod = moduleRegistry_->replaceModule(iLabel,iPSet,preallocConfig_);
987 
988  globalSchedule_->replaceModule(newMod,iLabel);
989 
990  for(auto& s: streamSchedules_) {
991  s->replaceModule(newMod,iLabel);
992  }
993 
994  {
995  //Need to updateLookup in order to make getByToken work
996  auto const runLookup = iRegistry.productLookup(InRun);
997  auto const lumiLookup = iRegistry.productLookup(InLumi);
998  auto const eventLookup = iRegistry.productLookup(InEvent);
999  found->updateLookup(InRun,*runLookup);
1000  found->updateLookup(InLumi,*lumiLookup);
1001  found->updateLookup(InEvent,*eventLookup);
1002  }
1003 
1004  return true;
1005  }
1006 
1007  std::vector<ModuleDescription const*>
1009  std::vector<ModuleDescription const*> result;
1010  result.reserve(allWorkers().size());
1011 
1012  for (auto const& worker : allWorkers()) {
1013  ModuleDescription const* p = worker->descPtr();
1014  result.push_back(p);
1015  }
1016  return result;
1017  }
1018 
1019  Schedule::AllWorkers const&
1021  return globalSchedule_->allWorkers();
1022  }
1023 
1025  for (auto const& worker : allWorkers()) {
1026  worker->convertCurrentProcessAlias(processName);
1027  }
1028  }
1029 
1030  void
1031  Schedule::availablePaths(std::vector<std::string>& oLabelsToFill) const {
1032  streamSchedules_[0]->availablePaths(oLabelsToFill);
1033  }
1034 
1035  void
1036  Schedule::triggerPaths(std::vector<std::string>& oLabelsToFill) const {
1037  streamSchedules_[0]->triggerPaths(oLabelsToFill);
1038  }
1039 
1040  void
1041  Schedule::endPaths(std::vector<std::string>& oLabelsToFill) const {
1042  streamSchedules_[0]->endPaths(oLabelsToFill);
1043  }
1044 
1045  void
1047  std::vector<std::string>& oLabelsToFill) const {
1048  streamSchedules_[0]->modulesInPath(iPathLabel,oLabelsToFill);
1049  }
1050 
1051  void
1053  std::vector<ModuleDescription const*>& descriptions,
1054  unsigned int hint) const {
1055  streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1056  }
1057 
1058  void
1060  std::vector<ModuleDescription const*>& descriptions,
1061  unsigned int hint) const {
1062  streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1063  }
1064 
1065  void
1066  Schedule::fillModuleAndConsumesInfo(std::vector<ModuleDescription const*>& allModuleDescriptions,
1067  std::vector<std::pair<unsigned int, unsigned int> >& moduleIDToIndex,
1068  std::vector<std::vector<ModuleDescription const*> >& modulesWhoseProductsAreConsumedBy,
1069  ProductRegistry const& preg) const {
1070  allModuleDescriptions.clear();
1071  moduleIDToIndex.clear();
1072  modulesWhoseProductsAreConsumedBy.clear();
1073 
1074  allModuleDescriptions.reserve(allWorkers().size());
1075  moduleIDToIndex.reserve(allWorkers().size());
1076  modulesWhoseProductsAreConsumedBy.resize(allWorkers().size());
1077 
1078  std::map<std::string, ModuleDescription const*> labelToDesc;
1079  unsigned int i = 0;
1080  for (auto const& worker : allWorkers()) {
1081  ModuleDescription const* p = worker->descPtr();
1082  allModuleDescriptions.push_back(p);
1083  moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->id(), i));
1084  labelToDesc[p->moduleLabel()] = p;
1085  ++i;
1086  }
1087  sort_all(moduleIDToIndex);
1088 
1089  i = 0;
1090  for (auto const& worker : allWorkers()) {
1091  std::vector<ModuleDescription const*>& modules = modulesWhoseProductsAreConsumedBy.at(i);
1092  worker->modulesWhoseProductsAreConsumed(modules, preg, labelToDesc);
1093  ++i;
1094  }
1095  }
1096 
1097  void
1099  endpathsAreActive_ = active;
1100  for(auto& s : streamSchedules_) {
1101  s->enableEndPaths(active);
1102  }
1103  }
1104 
1105  bool
1107  return endpathsAreActive_;
1108  }
1109 
1110  void
1112  rep.eventSummary.totalEvents = 0;
1115  for(auto& s: streamSchedules_) {
1116  s->getTriggerReport(rep);
1117  }
1119  }
1120 
1121  void
1123  rep.eventSummary.totalEvents = 0;
1124  rep.eventSummary.cpuTime = 0.;
1125  rep.eventSummary.realTime = 0.;
1126  summaryTimeKeeper_->fillTriggerTimingReport(rep);
1127  }
1128 
1129  int
1131  int returnValue = 0;
1132  for(auto& s: streamSchedules_) {
1133  returnValue += s->totalEvents();
1134  }
1135  return returnValue;
1136  }
1137 
1138  int
1140  int returnValue = 0;
1141  for(auto& s: streamSchedules_) {
1142  returnValue += s->totalEventsPassed();
1143  }
1144  return returnValue;
1145  }
1146 
1147  int
1149  int returnValue = 0;
1150  for(auto& s: streamSchedules_) {
1151  returnValue += s->totalEventsFailed();
1152  }
1153  return returnValue;
1154  }
1155 
1156 
1157  void
1159  for(auto& s: streamSchedules_) {
1160  s->clearCounters();
1161  }
1162  }
1163 }
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
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:1066
virtual void openFile(FileBlock const &fb)=0
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:1020
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:1031
virtual void writeRun(RunPrincipal const &rp, ProcessContext const *)=0
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
bool endPathsEnabled() const
Definition: Schedule.cc:1106
void respondToCloseInputFile(FileBlock const &fb)
Definition: Schedule.cc:936
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ModuleRegistry const > moduleRegistry() const
Definition: Schedule.h:291
std::vector< Worker * > AllWorkers
Definition: Schedule.h:118
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
void convertCurrentProcessAlias(std::string const &processName)
Convert "@currentProcess" in InputTag process names to the actual current process name...
Definition: Schedule.cc:1024
virtual bool shouldWeCloseFile() const =0
void writeRun(RunPrincipal const &rp, ProcessContext const *)
Definition: Schedule.cc:913
void endStream(unsigned int)
Definition: Schedule.cc:950
void writeLumi(LuminosityBlockPrincipal const &lbp, ProcessContext const *)
Definition: Schedule.cc:918
void enableEndPaths(bool active)
Definition: Schedule.cc:1098
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:1059
std::vector< WorkerSummary > workerSummaries
Definition: TriggerReport.h:69
edm::propagate_const< std::unique_ptr< SystemTimeKeeper > > summaryTimeKeeper_
Definition: Schedule.h:303
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:1148
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
Definition: Schedule.h:298
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry)
Definition: Schedule.cc:972
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:1139
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
Definition: Schedule.cc:1036
std::vector< PathSummary > trigPathSummaries
Definition: TriggerReport.h:67
EventSummary eventSummary
Definition: TriggerReport.h:66
int totalEvents() const
Definition: Schedule.cc:1130
virtual void openNewFileIfNeeded()=0
EventTimingSummary eventSummary
void clearCounters()
Clear all the counters in the trigger report.
Definition: Schedule.cc:1158
std::vector< PathTimingSummary > trigPathSummaries
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists, SubProcessParentageHelper const *subProcessParentageHelper)
Definition: Schedule.cc:553
bool terminate() const
Return whether each output module has reached its maximum count.
Definition: Schedule.cc:594
void respondToOpenInputFile(FileBlock const &fb)
Definition: Schedule.cc:931
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
Definition: Schedule.h:295
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:119
void getTriggerReport(TriggerReport &rep) const
Definition: Schedule.cc:1111
PreallocationConfiguration preallocConfig_
Definition: Schedule.h:301
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
Definition: Schedule.h:296
Schedule(ParameterSet &proc_pset, service::TriggerNamesService &tns, ProductRegistry &pregistry, BranchIDListHelper &branchIDListHelper, ThinnedAssociationsHelper &thinnedAssociationsHelper, SubProcessParentageHelper const *subProcessParentageHelper, 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
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
volatile bool endpathsAreActive_
Definition: Schedule.h:307
void respondToOpenInputFile(FileBlock const &fb)
Definition: Worker.h:115
std::shared_ptr< TriggerResultInserter const > resultsInserter() const
Definition: Schedule.h:289
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:300
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:1046
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
void beginStream(unsigned int)
Definition: Schedule.cc:945
void respondToCloseInputFile(FileBlock const &fb)
Definition: Worker.h:116
void preForkReleaseResources()
Definition: Worker.h:118
bool wantSummary_
Definition: Schedule.h:305
HLT enums.
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: Schedule.cc:967
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Definition: Schedule.cc:1008
Strings const & getTrigPaths() const
void processOneEventAsync(WaitingTaskHolder iTask, unsigned int iStreamID, EventPrincipal &principal, EventSetup const &eventSetup)
Definition: Schedule.cc:955
void beginJob(ProductRegistry const &)
Definition: Schedule.cc:941
void openNewOutputFilesIfNeeded()
Definition: Schedule.cc:903
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
void preForkReleaseResources()
Definition: Schedule.cc:963
void openOutputFiles(FileBlock &fb)
Definition: Schedule.cc:908
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void endJob(ExceptionCollector &collector)
Definition: Schedule.cc:610
void getTriggerTimingReport(TriggerTimingReport &rep) const
Definition: Schedule.cc:1122
bool shouldWeCloseOutput() const
Definition: Schedule.cc:923
std::vector< std::string > vstring
Definition: Schedule.cc:368
def move(src, dest)
Definition: eostools.py:510
void closeOutputFiles()
Definition: Schedule.cc:898
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
Definition: Schedule.cc:1041
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1052
unsigned int id() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)