CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Schedule.cc
Go to the documentation of this file.
2 
38 
39 #include <algorithm>
40 #include <cassert>
41 #include <cstdlib>
42 #include <functional>
43 #include <iomanip>
44 #include <list>
45 #include <map>
46 #include <set>
47 #include <exception>
48 #include <sstream>
49 
51 
52 namespace edm {
53 
54  class Maker;
55 
56  namespace {
57  using std::placeholders::_1;
58 
59  bool binary_search_string(std::vector<std::string> const& v, std::string const& s) {
60  return std::binary_search(v.begin(), v.end(), s);
61  }
62 
63  // Here we make the trigger results inserter directly. This should
64  // probably be a utility in the WorkerRegistry or elsewhere.
65 
66  std::shared_ptr<TriggerResultInserter> makeInserter(ParameterSet& proc_pset,
67  PreallocationConfiguration const& iPrealloc,
68  ProductRegistry& preg,
69  ExceptionToActionTable const& actions,
70  std::shared_ptr<ActivityRegistry> areg,
71  std::shared_ptr<ProcessConfiguration> processConfiguration) {
72  ParameterSet* trig_pset = proc_pset.getPSetForUpdate("@trigger_paths");
73  trig_pset->registerIt();
74 
75  WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration, actions);
76  ModuleDescription md(trig_pset->id(),
77  "TriggerResultInserter",
78  "TriggerResults",
79  processConfiguration.get(),
81 
82  areg->preModuleConstructionSignal_(md);
83  bool postCalled = false;
84  std::shared_ptr<TriggerResultInserter> returnValue;
85  // Caught exception is rethrown
86  CMS_SA_ALLOW try {
87  maker::ModuleHolderT<TriggerResultInserter> holder(
88  make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
89  static_cast<Maker const*>(nullptr));
90  holder.setModuleDescription(md);
91  holder.registerProductsAndCallbacks(&preg);
92  returnValue = holder.module();
93  postCalled = true;
94  // if exception then post will be called in the catch block
95  areg->postModuleConstructionSignal_(md);
96  } catch (...) {
97  if (!postCalled) {
98  CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); } catch (...) {
99  // If post throws an exception ignore it because we are already handling another exception
100  }
101  }
102  throw;
103  }
104  return returnValue;
105  }
106 
107  template <typename T>
108  void makePathStatusInserters(std::vector<edm::propagate_const<std::shared_ptr<T>>>& pathStatusInserters,
109  std::vector<std::string> const& pathNames,
110  PreallocationConfiguration const& iPrealloc,
111  ProductRegistry& preg,
112  std::shared_ptr<ActivityRegistry> areg,
113  std::shared_ptr<ProcessConfiguration> processConfiguration,
114  std::string const& moduleTypeName) {
116  pset.addParameter<std::string>("@module_type", moduleTypeName);
117  pset.addParameter<std::string>("@module_edm_type", "EDProducer");
118  pset.registerIt();
119 
120  pathStatusInserters.reserve(pathNames.size());
121 
122  for (auto const& pathName : pathNames) {
123  ModuleDescription md(
124  pset.id(), moduleTypeName, pathName, processConfiguration.get(), ModuleDescription::getUniqueID());
125 
126  areg->preModuleConstructionSignal_(md);
127  bool postCalled = false;
128  // Caught exception is rethrown
129  CMS_SA_ALLOW try {
130  maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
131  static_cast<Maker const*>(nullptr));
132  holder.setModuleDescription(md);
133  holder.registerProductsAndCallbacks(&preg);
134  pathStatusInserters.emplace_back(holder.module());
135  postCalled = true;
136  // if exception then post will be called in the catch block
137  areg->postModuleConstructionSignal_(md);
138  } catch (...) {
139  if (!postCalled) {
140  CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); } catch (...) {
141  // If post throws an exception ignore it because we are already handling another exception
142  }
143  }
144  throw;
145  }
146  }
147  }
148 
149  void checkAndInsertAlias(std::string const& friendlyClassName,
150  std::string const& moduleLabel,
151  std::string const& productInstanceName,
152  std::string const& processName,
153  std::string const& alias,
154  std::string const& instanceAlias,
155  ProductRegistry const& preg,
156  std::multimap<BranchKey, BranchKey>& aliasMap,
157  std::map<BranchKey, BranchKey>& aliasKeys) {
158  std::string const star("*");
159 
160  BranchKey key(friendlyClassName, moduleLabel, productInstanceName, processName);
161  if (preg.productList().find(key) == preg.productList().end()) {
162  // No product was found matching the alias.
163  // We throw an exception only if a module with the specified module label was created in this process.
164  for (auto const& product : preg.productList()) {
165  if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
166  throw Exception(errors::Configuration, "EDAlias does not match data\n")
167  << "There are no products of type '" << friendlyClassName << "'\n"
168  << "with module label '" << moduleLabel << "' and instance name '" << productInstanceName << "'.\n";
169  }
170  }
171  }
172 
173  if (auto iter = aliasMap.find(key); iter != aliasMap.end()) {
174  // If the same EDAlias defines multiple products pointing to the same product, throw
175  if (iter->second.moduleLabel() == alias) {
176  throw Exception(errors::Configuration, "EDAlias conflict\n")
177  << "The module label alias '" << alias << "' is used for multiple products of type '" << friendlyClassName
178  << "' with module label '" << moduleLabel << "' and instance name '" << productInstanceName
179  << "'. One alias has the instance name '" << iter->first.productInstanceName()
180  << "' and the other has the instance name '" << instanceAlias << "'.";
181  }
182  }
183 
184  std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
185  BranchKey aliasKey(friendlyClassName, alias, theInstanceAlias, processName);
186  if (preg.productList().find(aliasKey) != preg.productList().end()) {
187  throw Exception(errors::Configuration, "EDAlias conflicts with data\n")
188  << "A product of type '" << friendlyClassName << "'\n"
189  << "with module label '" << alias << "' and instance name '" << theInstanceAlias << "'\n"
190  << "already exists.\n";
191  }
192  auto iter = aliasKeys.find(aliasKey);
193  if (iter != aliasKeys.end()) {
194  // The alias matches a previous one. If the same alias is used for different product, throw.
195  if (iter->second != key) {
196  throw Exception(errors::Configuration, "EDAlias conflict\n")
197  << "The module label alias '" << alias << "' and product instance alias '" << theInstanceAlias << "'\n"
198  << "are used for multiple products of type '" << friendlyClassName << "'\n"
199  << "One has module label '" << moduleLabel << "' and product instance name '" << productInstanceName
200  << "',\n"
201  << "the other has module label '" << iter->second.moduleLabel() << "' and product instance name '"
202  << iter->second.productInstanceName() << "'.\n";
203  }
204  } else {
205  auto prodIter = preg.productList().find(key);
206  if (prodIter != preg.productList().end()) {
207  if (!prodIter->second.produced()) {
208  throw Exception(errors::Configuration, "EDAlias\n")
209  << "The module label alias '" << alias << "' and product instance alias '" << theInstanceAlias << "'\n"
210  << "are used for a product of type '" << friendlyClassName << "'\n"
211  << "with module label '" << moduleLabel << "' and product instance name '" << productInstanceName
212  << "',\n"
213  << "An EDAlias can only be used for products produced in the current process. This one is not.\n";
214  }
215  aliasMap.insert(std::make_pair(key, aliasKey));
216  aliasKeys.insert(std::make_pair(aliasKey, key));
217  }
218  }
219  }
220 
221  void processEDAliases(ParameterSet const& proc_pset, std::string const& processName, ProductRegistry& preg) {
222  std::vector<std::string> aliases = proc_pset.getParameter<std::vector<std::string>>("@all_aliases");
223  if (aliases.empty()) {
224  return;
225  }
226  std::string const star("*");
227  std::string const empty("");
229  desc.add<std::string>("type");
230  desc.add<std::string>("fromProductInstance", star);
231  desc.add<std::string>("toProductInstance", star);
232 
233  std::multimap<BranchKey, BranchKey> aliasMap;
234 
235  std::map<BranchKey, BranchKey> aliasKeys; // Used to search for duplicates or clashes.
236 
237  // Auxiliary search structure to support wildcard for friendlyClassName
238  std::multimap<std::string, BranchKey> moduleLabelToBranches;
239  for (auto const& prod : preg.productList()) {
240  if (processName == prod.second.processName()) {
241  moduleLabelToBranches.emplace(prod.first.moduleLabel(), prod.first);
242  }
243  }
244 
245  // Now, loop over the alias information and store it in aliasMap.
246  for (std::string const& alias : aliases) {
247  ParameterSet const& aliasPSet = proc_pset.getParameterSet(alias);
248  std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<VParameterSet>();
249  for (std::string const& moduleLabel : vPSetNames) {
250  VParameterSet vPSet = aliasPSet.getParameter<VParameterSet>(moduleLabel);
251  for (ParameterSet& pset : vPSet) {
252  desc.validate(pset);
253  std::string friendlyClassName = pset.getParameter<std::string>("type");
254  std::string productInstanceName = pset.getParameter<std::string>("fromProductInstance");
255  std::string instanceAlias = pset.getParameter<std::string>("toProductInstance");
256 
257  if (friendlyClassName == star) {
258  bool processHasLabel = false;
259  bool match = false;
260  for (auto it = moduleLabelToBranches.lower_bound(moduleLabel);
261  it != moduleLabelToBranches.end() && it->first == moduleLabel;
262  ++it) {
263  processHasLabel = true;
264  if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
265  continue;
266  }
267  match = true;
268 
269  checkAndInsertAlias(it->second.friendlyClassName(),
270  moduleLabel,
271  it->second.productInstanceName(),
272  processName,
273  alias,
274  instanceAlias,
275  preg,
276  aliasMap,
277  aliasKeys);
278  }
279  if (not match and processHasLabel) {
280  // No product was found matching the alias.
281  // We throw an exception only if a module with the specified module label was created in this process.
282  // Note that if that condition is ever relatex, it might be best to throw an exception with different
283  // message (omitting productInstanceName) in case 'productInstanceName == start'
284  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
285  << "There are no products with module label '" << moduleLabel << "' and product instance name '"
286  << productInstanceName << "'.\n";
287  }
288  } else if (productInstanceName == star) {
289  bool match = false;
290  BranchKey lowerBound(friendlyClassName, moduleLabel, empty, empty);
291  for (ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
292  it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName &&
293  it->first.moduleLabel() == moduleLabel;
294  ++it) {
295  if (it->first.processName() != processName) {
296  continue;
297  }
298  match = true;
299 
300  checkAndInsertAlias(friendlyClassName,
301  moduleLabel,
302  it->first.productInstanceName(),
303  processName,
304  alias,
305  instanceAlias,
306  preg,
307  aliasMap,
308  aliasKeys);
309  }
310  if (!match) {
311  // No product was found matching the alias.
312  // We throw an exception only if a module with the specified module label was created in this process.
313  for (auto const& product : preg.productList()) {
314  if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
315  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
316  << "There are no products of type '" << friendlyClassName << "'\n"
317  << "with module label '" << moduleLabel << "'.\n";
318  }
319  }
320  }
321  } else {
322  checkAndInsertAlias(friendlyClassName,
323  moduleLabel,
324  productInstanceName,
325  processName,
326  alias,
327  instanceAlias,
328  preg,
329  aliasMap,
330  aliasKeys);
331  }
332  }
333  }
334  }
335 
336  // Now add the new alias entries to the product registry.
337  for (auto const& aliasEntry : aliasMap) {
338  ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
339  assert(it != preg.productList().end());
340  preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
341  }
342  }
343 
344  typedef std::vector<std::string> vstring;
345 
346  void processSwitchProducers(ParameterSet const& proc_pset, std::string const& processName, ProductRegistry& preg) {
347  // Update Switch BranchDescriptions for the chosen case
348  struct BranchesCases {
349  BranchesCases(std::vector<std::string> cases) : caseLabels{std::move(cases)} {}
350  std::vector<BranchKey> chosenBranches;
351  std::vector<std::string> caseLabels;
352  };
353  std::map<std::string, BranchesCases> switchMap;
354  for (auto& prod : preg.productListUpdator()) {
355  if (prod.second.isSwitchAlias()) {
356  auto it = switchMap.find(prod.second.moduleLabel());
357  if (it == switchMap.end()) {
358  auto const& switchPSet = proc_pset.getParameter<edm::ParameterSet>(prod.second.moduleLabel());
359  auto inserted = switchMap.emplace(prod.second.moduleLabel(),
360  switchPSet.getParameter<std::vector<std::string>>("@all_cases"));
361  assert(inserted.second);
362  it = inserted.first;
363  }
364 
365  bool found = false;
366  for (auto const& productIter : preg.productList()) {
367  BranchKey const& branchKey = productIter.first;
368  // The alias-for product must be in the same process as
369  // the SwitchProducer (earlier processes or SubProcesses
370  // may contain products with same type, module label, and
371  // instance name)
372  if (branchKey.processName() != processName) {
373  continue;
374  }
375 
376  BranchDescription const& desc = productIter.second;
377  if (desc.branchType() == prod.second.branchType() and
378  desc.unwrappedTypeID().typeInfo() == prod.second.unwrappedTypeID().typeInfo() and
379  branchKey.moduleLabel() == prod.second.switchAliasModuleLabel() and
380  branchKey.productInstanceName() == prod.second.productInstanceName()) {
381  prod.second.setSwitchAliasForBranch(desc);
382  it->second.chosenBranches.push_back(prod.first); // with moduleLabel of the Switch
383  found = true;
384  }
385  }
386  if (not found) {
388  ex << "Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n"
389  << " friendly class name = " << prod.second.friendlyClassName() << "\n"
390  << " module label = " << prod.second.moduleLabel() << "\n"
391  << " product instance name = " << prod.second.productInstanceName() << "\n"
392  << " process name = " << processName
393  << "\n\nbut did not find any. Please contact a framework developer.";
394  ex.addContext("Calling Schedule.cc:processSwitchProducers()");
395  throw ex;
396  }
397  }
398  }
399  if (switchMap.empty())
400  return;
401 
402  for (auto& elem : switchMap) {
403  std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
404  }
405 
406  auto addProductsToException = [&preg, &processName](auto const& caseLabels, edm::Exception& ex) {
407  std::map<std::string, std::vector<BranchKey>> caseBranches;
408  for (auto const& item : preg.productList()) {
409  if (item.first.processName() != processName)
410  continue;
411 
412  if (auto found = std::find(caseLabels.begin(), caseLabels.end(), item.first.moduleLabel());
413  found != caseLabels.end()) {
414  caseBranches[*found].push_back(item.first);
415  }
416  }
417 
418  for (auto const& caseLabel : caseLabels) {
419  ex << "Products for case " << caseLabel << " (friendly class name, product instance name):\n";
420  auto& branches = caseBranches[caseLabel];
421  std::sort(branches.begin(), branches.end());
422  for (auto const& branch : branches) {
423  ex << " " << branch.friendlyClassName() << " " << branch.productInstanceName() << "\n";
424  }
425  }
426  };
427 
428  // Check that non-chosen cases declare exactly the same branches
429  // Also set the alias-for branches to transient
430  std::vector<bool> foundBranches;
431  for (auto const& switchItem : switchMap) {
432  auto const& switchLabel = switchItem.first;
433  auto const& chosenBranches = switchItem.second.chosenBranches;
434  auto const& caseLabels = switchItem.second.caseLabels;
435  foundBranches.resize(chosenBranches.size());
436  for (auto const& caseLabel : caseLabels) {
437  std::fill(foundBranches.begin(), foundBranches.end(), false);
438  for (auto& nonConstItem : preg.productListUpdator()) {
439  auto const& item = nonConstItem;
440  if (item.first.moduleLabel() == caseLabel and item.first.processName() == processName) {
441  // Set the alias-for branch as transient so it gets fully ignored in output.
442  // I tried first to implicitly drop all branches with
443  // '@' in ProductSelector, but that gave problems on
444  // input (those branches would be implicitly dropped on
445  // input as well, leading to the SwitchProducer branches
446  // do be dropped as dependent ones, as the alias
447  // detection logic in RootFile says that the
448  // SwitchProducer branches are not alias branches)
449  nonConstItem.second.setTransient(true);
450 
451  auto range = std::equal_range(chosenBranches.begin(),
452  chosenBranches.end(),
453  BranchKey(item.first.friendlyClassName(),
454  switchLabel,
455  item.first.productInstanceName(),
456  item.first.processName()));
457  if (range.first == range.second) {
459  ex << "SwitchProducer " << switchLabel << " has a case " << caseLabel << " with a product "
460  << item.first << " that is not produced by the chosen case "
461  << proc_pset.getParameter<edm::ParameterSet>(switchLabel)
462  .getUntrackedParameter<std::string>("@chosen_case")
463  << ". If the intention is to produce only a subset of the products listed below, each case with "
464  "more products needs to be replaced with an EDAlias to only the necessary products, and the "
465  "EDProducer itself needs to be moved to a Task.\n\n";
466  addProductsToException(caseLabels, ex);
467  throw ex;
468  }
469  assert(std::distance(range.first, range.second) == 1);
470  foundBranches[std::distance(chosenBranches.begin(), range.first)] = true;
471 
472  // Check that there are no BranchAliases for any of the cases
473  auto const& bd = item.second;
474  if (not bd.branchAliases().empty()) {
476  << "SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch "
477  "aliases for SwitchProducer with label "
478  << switchLabel << " for case " << caseLabel << ":";
479  for (auto const& branchAlias : bd.branchAliases()) {
480  ex << " " << branchAlias;
481  }
482  throw ex;
483  }
484  }
485  }
486 
487  for (size_t i = 0; i < chosenBranches.size(); i++) {
488  if (not foundBranches[i]) {
489  auto chosenLabel = proc_pset.getParameter<edm::ParameterSet>(switchLabel)
490  .getUntrackedParameter<std::string>("@chosen_case");
492  ex << "SwitchProducer " << switchLabel << " has a case " << caseLabel
493  << " that does not produce a product " << chosenBranches[i] << " that is produced by the chosen case "
494  << chosenLabel
495  << ". If the intention is to produce only a subset of the products listed below, each case with more "
496  "products needs to be replaced with an EDAlias to only the necessary products, and the "
497  "EDProducer itself needs to be moved to a Task.\n\n";
498  addProductsToException(caseLabels, ex);
499  throw ex;
500  }
501  }
502  }
503  }
504  }
505 
506  void reduceParameterSet(ParameterSet& proc_pset,
507  vstring const& end_path_name_list,
508  vstring& modulesInConfig,
509  std::set<std::string> const& usedModuleLabels,
510  std::map<std::string, std::vector<std::pair<std::string, int>>>& outputModulePathPositions) {
511  // Before calculating the ParameterSetID of the top level ParameterSet or
512  // saving it in the registry drop from the top level ParameterSet all
513  // OutputModules and EDAnalyzers not on trigger paths. If unscheduled
514  // production is not enabled also drop all the EDFilters and EDProducers
515  // that are not scheduled. Drop the ParameterSet used to configure the module
516  // itself. Also drop the other traces of these labels in the top level
517  // ParameterSet: Remove that labels from @all_modules and from all the
518  // end paths. If this makes any end paths empty, then remove the end path
519  // name from @end_paths, and @paths.
520 
521  // First make a list of labels to drop
522  vstring outputModuleLabels;
523  std::string edmType;
524  std::string const moduleEdmType("@module_edm_type");
525  std::string const outputModule("OutputModule");
526  std::string const edAnalyzer("EDAnalyzer");
527  std::string const edFilter("EDFilter");
528  std::string const edProducer("EDProducer");
529 
530  std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
531 
532  //need a list of all modules on paths in order to determine
533  // if an EDAnalyzer only appears on an end path
534  vstring scheduledPaths = proc_pset.getParameter<vstring>("@paths");
535  std::set<std::string> modulesOnPaths;
536  {
537  std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
538  for (auto const& endPath : end_path_name_list) {
539  noEndPaths.erase(endPath);
540  }
541  {
542  vstring labels;
543  for (auto const& path : noEndPaths) {
544  labels = proc_pset.getParameter<vstring>(path);
545  modulesOnPaths.insert(labels.begin(), labels.end());
546  }
547  }
548  }
549  //Initially fill labelsToBeDropped with all module mentioned in
550  // the configuration but which are not being used by the system
551  std::vector<std::string> labelsToBeDropped;
552  labelsToBeDropped.reserve(modulesInConfigSet.size());
553  std::set_difference(modulesInConfigSet.begin(),
554  modulesInConfigSet.end(),
555  usedModuleLabels.begin(),
556  usedModuleLabels.end(),
557  std::back_inserter(labelsToBeDropped));
558 
559  const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
560  for (auto const& modLabel : usedModuleLabels) {
561  // Do nothing for modules that do not have a ParameterSet. Modules of type
562  // PathStatusInserter and EndPathStatusInserter will not have a ParameterSet.
563  if (proc_pset.existsAs<ParameterSet>(modLabel)) {
564  edmType = proc_pset.getParameterSet(modLabel).getParameter<std::string>(moduleEdmType);
565  if (edmType == outputModule) {
566  outputModuleLabels.push_back(modLabel);
567  labelsToBeDropped.push_back(modLabel);
568  }
569  if (edmType == edAnalyzer) {
570  if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
571  labelsToBeDropped.push_back(modLabel);
572  }
573  }
574  }
575  }
576  //labelsToBeDropped must be sorted
577  std::inplace_merge(
578  labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
579 
580  // drop the parameter sets used to configure the modules
581  for_all(labelsToBeDropped, std::bind(&ParameterSet::eraseOrSetUntrackedParameterSet, std::ref(proc_pset), _1));
582 
583  // drop the labels from @all_modules
584  vstring::iterator endAfterRemove =
585  std::remove_if(modulesInConfig.begin(),
586  modulesInConfig.end(),
587  std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
588  modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
589  proc_pset.addParameter<vstring>(std::string("@all_modules"), modulesInConfig);
590 
591  // drop the labels from all end paths
592  vstring endPathsToBeDropped;
593  vstring labels;
594  for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
595  iEndPath != endEndPath;
596  ++iEndPath) {
597  labels = proc_pset.getParameter<vstring>(*iEndPath);
598  vstring::iterator iSave = labels.begin();
599  vstring::iterator iBegin = labels.begin();
600 
601  for (vstring::iterator iLabel = labels.begin(), iEnd = labels.end(); iLabel != iEnd; ++iLabel) {
602  if (binary_search_string(labelsToBeDropped, *iLabel)) {
603  if (binary_search_string(outputModuleLabels, *iLabel)) {
604  outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
605  }
606  } else {
607  if (iSave != iLabel) {
608  iSave->swap(*iLabel);
609  }
610  ++iSave;
611  }
612  }
613  labels.erase(iSave, labels.end());
614  if (labels.empty()) {
615  // remove empty end paths and save their names
616  proc_pset.eraseSimpleParameter(*iEndPath);
617  endPathsToBeDropped.push_back(*iEndPath);
618  } else {
619  proc_pset.addParameter<vstring>(*iEndPath, labels);
620  }
621  }
622  sort_all(endPathsToBeDropped);
623 
624  // remove empty end paths from @paths
625  endAfterRemove = std::remove_if(scheduledPaths.begin(),
626  scheduledPaths.end(),
627  std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
628  scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
629  proc_pset.addParameter<vstring>(std::string("@paths"), scheduledPaths);
630 
631  // remove empty end paths from @end_paths
632  vstring scheduledEndPaths = proc_pset.getParameter<vstring>("@end_paths");
633  endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
634  scheduledEndPaths.end(),
635  std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
636  scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
637  proc_pset.addParameter<vstring>(std::string("@end_paths"), scheduledEndPaths);
638  }
639 
640  class RngEDConsumer : public EDConsumerBase {
641  public:
642  explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
644  if (rng.isAvailable()) {
645  rng->consumes(consumesCollector());
646  for (auto const& consumesInfo : this->consumesInfo()) {
647  typesConsumed.emplace(consumesInfo.type());
648  }
649  }
650  }
651  };
652 
653  template <typename F>
654  auto doCleanup(F&& iF) {
655  auto wrapped = [f = std::move(iF)](std::exception_ptr const* iPtr, edm::WaitingTaskHolder iTask) {
656  CMS_SA_ALLOW try { f(); } catch (...) {
657  }
658  if (iPtr) {
659  iTask.doneWaiting(*iPtr);
660  }
661  };
662  return wrapped;
663  }
664  } // namespace
665  // -----------------------------
666 
667  typedef std::vector<std::string> vstring;
668 
669  // -----------------------------
670 
673  ProductRegistry& preg,
674  BranchIDListHelper& branchIDListHelper,
675  ProcessBlockHelperBase& processBlockHelper,
676  ThinnedAssociationsHelper& thinnedAssociationsHelper,
677  SubProcessParentageHelper const* subProcessParentageHelper,
678  ExceptionToActionTable const& actions,
679  std::shared_ptr<ActivityRegistry> areg,
680  std::shared_ptr<ProcessConfiguration> processConfiguration,
681  bool hasSubprocesses,
683  ProcessContext const* processContext)
684  : //Only create a resultsInserter if there is a trigger path
685  resultsInserter_{tns.getTrigPaths().empty()
686  ? std::shared_ptr<TriggerResultInserter>{}
687  : makeInserter(proc_pset, prealloc, preg, actions, areg, processConfiguration)},
688  moduleRegistry_(new ModuleRegistry()),
691  pathNames_(&tns.getTrigPaths()),
692  endPathNames_(&tns.getEndPaths()),
693  wantSummary_(tns.wantSummary()) {
694  makePathStatusInserters(pathStatusInserters_,
695  *pathNames_,
696  prealloc,
697  preg,
698  areg,
699  processConfiguration,
700  std::string("PathStatusInserter"));
701 
702  makePathStatusInserters(endPathStatusInserters_,
703  *endPathNames_,
704  prealloc,
705  preg,
706  areg,
707  processConfiguration,
708  std::string("EndPathStatusInserter"));
709 
710  assert(0 < prealloc.numberOfStreams());
711  streamSchedules_.reserve(prealloc.numberOfStreams());
712  for (unsigned int i = 0; i < prealloc.numberOfStreams(); ++i) {
713  streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
714  pathStatusInserters_,
715  endPathStatusInserters_,
716  moduleRegistry(),
717  proc_pset,
718  tns,
719  prealloc,
720  preg,
721  branchIDListHelper,
722  actions,
723  areg,
724  processConfiguration,
725  !hasSubprocesses,
726  StreamID{i},
727  processContext));
728  }
729 
730  //TriggerResults are injected automatically by StreamSchedules and are
731  // unknown to the ModuleRegistry
732  const std::string kTriggerResults("TriggerResults");
733  std::vector<std::string> modulesToUse;
734  modulesToUse.reserve(streamSchedules_[0]->allWorkers().size());
735  for (auto const& worker : streamSchedules_[0]->allWorkers()) {
736  if (worker->description()->moduleLabel() != kTriggerResults) {
737  modulesToUse.push_back(worker->description()->moduleLabel());
738  }
739  }
740  //The unscheduled modules are at the end of the list, but we want them at the front
741  unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
742  if (nUnscheduledModules > 0) {
743  std::vector<std::string> temp;
744  temp.reserve(modulesToUse.size());
745  auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
746  std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(temp));
747  std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(temp));
748  temp.swap(modulesToUse);
749  }
750 
751  // propagate_const<T> has no reset() function
752  globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
753  pathStatusInserters_,
754  endPathStatusInserters_,
755  moduleRegistry(),
756  modulesToUse,
757  proc_pset,
758  preg,
759  prealloc,
760  actions,
761  areg,
763  processContext);
764 
765  //TriggerResults is not in the top level ParameterSet so the call to
766  // reduceParameterSet would fail to find it. Just remove it up front.
767  std::set<std::string> usedModuleLabels;
768  for (auto const& worker : allWorkers()) {
769  if (worker->description()->moduleLabel() != kTriggerResults) {
770  usedModuleLabels.insert(worker->description()->moduleLabel());
771  }
772  }
773  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>("@all_modules"));
774  std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
775  reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
776  processEDAliases(proc_pset, processConfiguration->processName(), preg);
777 
778  // At this point all BranchDescriptions are created. Mark now the
779  // ones of unscheduled workers to be on-demand.
780  if (nUnscheduledModules > 0) {
781  std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
782  preg.setUnscheduledProducts(unscheduledModules);
783  }
784 
785  processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
786  proc_pset.registerIt();
787  processConfiguration->setParameterSetID(proc_pset.id());
788  processConfiguration->setProcessConfigurationID();
789 
790  // This is used for a little sanity-check to make sure no code
791  // modifications alter the number of workers at a later date.
792  size_t all_workers_count = allWorkers().size();
793 
794  moduleRegistry_->forAllModuleHolders([this](maker::ModuleHolder* iHolder) {
795  auto comm = iHolder->createOutputModuleCommunicator();
796  if (comm) {
797  all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
798  }
799  });
800  // Now that the output workers are filled in, set any output limits or information.
801  limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
802 
803  // Sanity check: make sure nobody has added a worker after we've
804  // already relied on the WorkerManager being full.
805  assert(all_workers_count == allWorkers().size());
806 
807  branchIDListHelper.updateFromRegistry(preg);
808 
809  for (auto const& worker : streamSchedules_[0]->allWorkers()) {
810  worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
811  }
812 
813  processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
814 
815  // The output modules consume products in kept branches.
816  // So we must set this up before freezing.
817  for (auto& c : all_output_communicators_) {
818  c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
819  }
820 
821  for (auto& product : preg.productListUpdator()) {
822  setIsMergeable(product.second);
823  }
824 
825  {
826  // We now get a collection of types that may be consumed.
827  std::set<TypeID> productTypesConsumed;
828  std::set<TypeID> elementTypesConsumed;
829  // Loop over all modules
830  for (auto const& worker : allWorkers()) {
831  for (auto const& consumesInfo : worker->consumesInfo()) {
832  if (consumesInfo.kindOfType() == PRODUCT_TYPE) {
833  productTypesConsumed.emplace(consumesInfo.type());
834  } else {
835  elementTypesConsumed.emplace(consumesInfo.type());
836  }
837  }
838  }
839  // The SubProcess class is not a module, yet it may consume.
840  if (hasSubprocesses) {
841  productTypesConsumed.emplace(typeid(TriggerResults));
842  }
843  // The RandomNumberGeneratorService is not a module, yet it consumes.
844  { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
845  preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
846  }
847 
848  for (auto& c : all_output_communicators_) {
849  c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
850  }
851 
852  if (wantSummary_) {
853  std::vector<const ModuleDescription*> modDesc;
854  const auto& workers = allWorkers();
855  modDesc.reserve(workers.size());
856 
857  std::transform(workers.begin(),
858  workers.end(),
859  std::back_inserter(modDesc),
860  [](const Worker* iWorker) -> const ModuleDescription* { return iWorker->description(); });
861 
862  // propagate_const<T> has no reset() function
863  summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc, tns, processContext);
864  auto timeKeeperPtr = summaryTimeKeeper_.get();
865 
866  areg->watchPreModuleDestruction(timeKeeperPtr, &SystemTimeKeeper::removeModuleIfExists);
867 
868  areg->watchPreModuleEvent(timeKeeperPtr, &SystemTimeKeeper::startModuleEvent);
869  areg->watchPostModuleEvent(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
870  areg->watchPreModuleEventAcquire(timeKeeperPtr, &SystemTimeKeeper::restartModuleEvent);
871  areg->watchPostModuleEventAcquire(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
872  areg->watchPreModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::pauseModuleEvent);
873  areg->watchPostModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::restartModuleEvent);
874 
875  areg->watchPreSourceEvent(timeKeeperPtr, &SystemTimeKeeper::startEvent);
876  areg->watchPostEvent(timeKeeperPtr, &SystemTimeKeeper::stopEvent);
877 
878  areg->watchPrePathEvent(timeKeeperPtr, &SystemTimeKeeper::startPath);
879  areg->watchPostPathEvent(timeKeeperPtr, &SystemTimeKeeper::stopPath);
880 
881  areg->watchPostBeginJob(timeKeeperPtr, &SystemTimeKeeper::startProcessingLoop);
882  areg->watchPreEndJob(timeKeeperPtr, &SystemTimeKeeper::stopProcessingLoop);
883  //areg->preModuleEventSignal_.connect([timeKeeperPtr](StreamContext const& iContext, ModuleCallingContext const& iMod) {
884  //timeKeeperPtr->startModuleEvent(iContext,iMod);
885  //});
886  }
887 
888  } // Schedule::Schedule
889 
890  void Schedule::limitOutput(ParameterSet const& proc_pset,
891  BranchIDLists const& branchIDLists,
892  SubProcessParentageHelper const* subProcessParentageHelper) {
893  std::string const output("output");
894 
895  ParameterSet const& maxEventsPSet = proc_pset.getUntrackedParameterSet("maxEvents");
896  int maxEventSpecs = 0;
897  int maxEventsOut = -1;
898  ParameterSet const* vMaxEventsOut = nullptr;
899  std::vector<std::string> intNamesE = maxEventsPSet.getParameterNamesForType<int>(false);
900  if (search_all(intNamesE, output)) {
901  maxEventsOut = maxEventsPSet.getUntrackedParameter<int>(output);
902  ++maxEventSpecs;
903  }
904  std::vector<std::string> psetNamesE;
905  maxEventsPSet.getParameterSetNames(psetNamesE, false);
906  if (search_all(psetNamesE, output)) {
907  vMaxEventsOut = &maxEventsPSet.getUntrackedParameterSet(output);
908  ++maxEventSpecs;
909  }
910 
911  if (maxEventSpecs > 1) {
913  << "\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
914  }
915 
916  for (auto& c : all_output_communicators_) {
917  OutputModuleDescription desc(branchIDLists, maxEventsOut, subProcessParentageHelper);
918  if (vMaxEventsOut != nullptr && !vMaxEventsOut->empty()) {
919  std::string const& moduleLabel = c->description().moduleLabel();
920  try {
921  desc.maxEvents_ = vMaxEventsOut->getUntrackedParameter<int>(moduleLabel);
922  } catch (Exception const&) {
924  << "\nNo entry in 'maxEvents' for output module label '" << moduleLabel << "'.\n";
925  }
926  }
927  c->configure(desc);
928  }
929  }
930 
931  bool Schedule::terminate() const {
932  if (all_output_communicators_.empty()) {
933  return false;
934  }
935  for (auto& c : all_output_communicators_) {
936  if (!c->limitReached()) {
937  // Found an output module that has not reached output event count.
938  return false;
939  }
940  }
941  LogInfo("SuccessfulTermination") << "The job is terminating successfully because each output module\n"
942  << "has reached its configured limit.\n";
943  return true;
944  }
945 
947  globalSchedule_->endJob(collector);
948  if (collector.hasThrown()) {
949  return;
950  }
951 
952  if (wantSummary_ == false)
953  return;
954  {
955  TriggerReport tr;
956  getTriggerReport(tr);
957 
958  // The trigger report (pass/fail etc.):
959 
960  LogFwkVerbatim("FwkSummary") << "";
961  if (streamSchedules_[0]->context().processContext()->isSubProcess()) {
962  LogFwkVerbatim("FwkSummary") << "TrigReport Process: "
963  << streamSchedules_[0]->context().processContext()->processName();
964  }
965  LogFwkVerbatim("FwkSummary") << "TrigReport "
966  << "---------- Event Summary ------------";
967  if (!tr.trigPathSummaries.empty()) {
968  LogFwkVerbatim("FwkSummary") << "TrigReport"
969  << " Events total = " << tr.eventSummary.totalEvents
970  << " passed = " << tr.eventSummary.totalEventsPassed
971  << " failed = " << tr.eventSummary.totalEventsFailed << "";
972  } else {
973  LogFwkVerbatim("FwkSummary") << "TrigReport"
974  << " Events total = " << tr.eventSummary.totalEvents
975  << " passed = " << tr.eventSummary.totalEvents << " failed = 0";
976  }
977 
978  LogFwkVerbatim("FwkSummary") << "";
979  LogFwkVerbatim("FwkSummary") << "TrigReport "
980  << "---------- Path Summary ------------";
981  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
982  << " " << std::right << std::setw(10) << "Executed"
983  << " " << std::right << std::setw(10) << "Passed"
984  << " " << std::right << std::setw(10) << "Failed"
985  << " " << std::right << std::setw(10) << "Error"
986  << " "
987  << "Name"
988  << "";
989  for (auto const& p : tr.trigPathSummaries) {
990  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
991  << p.bitPosition << " " << std::right << std::setw(10) << p.timesRun << " "
992  << std::right << std::setw(10) << p.timesPassed << " " << std::right
993  << std::setw(10) << p.timesFailed << " " << std::right << std::setw(10)
994  << p.timesExcept << " " << p.name << "";
995  }
996 
997  /*
998  std::vector<int>::const_iterator epi = empty_trig_paths_.begin();
999  std::vector<int>::const_iterator epe = empty_trig_paths_.end();
1000  std::vector<std::string>::const_iterator epn = empty_trig_path_names_.begin();
1001  for (; epi != epe; ++epi, ++epn) {
1002 
1003  LogFwkVerbatim("FwkSummary") << "TrigReport "
1004  << std::right << std::setw(5) << 1
1005  << std::right << std::setw(5) << *epi << " "
1006  << std::right << std::setw(10) << totalEvents() << " "
1007  << std::right << std::setw(10) << totalEvents() << " "
1008  << std::right << std::setw(10) << 0 << " "
1009  << std::right << std::setw(10) << 0 << " "
1010  << *epn << "";
1011  }
1012  */
1013 
1014  LogFwkVerbatim("FwkSummary") << "";
1015  LogFwkVerbatim("FwkSummary") << "TrigReport "
1016  << "-------End-Path Summary ------------";
1017  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1018  << " " << std::right << std::setw(10) << "Executed"
1019  << " " << std::right << std::setw(10) << "Passed"
1020  << " " << std::right << std::setw(10) << "Failed"
1021  << " " << std::right << std::setw(10) << "Error"
1022  << " "
1023  << "Name"
1024  << "";
1025  for (auto const& p : tr.endPathSummaries) {
1026  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1027  << p.bitPosition << " " << std::right << std::setw(10) << p.timesRun << " "
1028  << std::right << std::setw(10) << p.timesPassed << " " << std::right
1029  << std::setw(10) << p.timesFailed << " " << std::right << std::setw(10)
1030  << p.timesExcept << " " << p.name << "";
1031  }
1032 
1033  for (auto const& p : tr.trigPathSummaries) {
1034  LogFwkVerbatim("FwkSummary") << "";
1035  LogFwkVerbatim("FwkSummary") << "TrigReport "
1036  << "---------- Modules in Path: " << p.name << " ------------";
1037  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1038  << " " << std::right << std::setw(10) << "Visited"
1039  << " " << std::right << std::setw(10) << "Passed"
1040  << " " << std::right << std::setw(10) << "Failed"
1041  << " " << std::right << std::setw(10) << "Error"
1042  << " "
1043  << "Name"
1044  << "";
1045 
1046  unsigned int bitpos = 0;
1047  for (auto const& mod : p.moduleInPathSummaries) {
1048  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1049  << bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
1050  << std::right << std::setw(10) << mod.timesPassed << " " << std::right
1051  << std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
1052  << mod.timesExcept << " " << mod.moduleLabel << "";
1053  ++bitpos;
1054  }
1055  }
1056 
1057  for (auto const& p : tr.endPathSummaries) {
1058  LogFwkVerbatim("FwkSummary") << "";
1059  LogFwkVerbatim("FwkSummary") << "TrigReport "
1060  << "------ Modules in End-Path: " << p.name << " ------------";
1061  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1062  << " " << std::right << std::setw(10) << "Visited"
1063  << " " << std::right << std::setw(10) << "Passed"
1064  << " " << std::right << std::setw(10) << "Failed"
1065  << " " << std::right << std::setw(10) << "Error"
1066  << " "
1067  << "Name"
1068  << "";
1069 
1070  unsigned int bitpos = 0;
1071  for (auto const& mod : p.moduleInPathSummaries) {
1072  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1073  << bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
1074  << std::right << std::setw(10) << mod.timesPassed << " " << std::right
1075  << std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
1076  << mod.timesExcept << " " << mod.moduleLabel << "";
1077  ++bitpos;
1078  }
1079  }
1080 
1081  LogFwkVerbatim("FwkSummary") << "";
1082  LogFwkVerbatim("FwkSummary") << "TrigReport "
1083  << "---------- Module Summary ------------";
1084  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Visited"
1085  << " " << std::right << std::setw(10) << "Executed"
1086  << " " << std::right << std::setw(10) << "Passed"
1087  << " " << std::right << std::setw(10) << "Failed"
1088  << " " << std::right << std::setw(10) << "Error"
1089  << " "
1090  << "Name"
1091  << "";
1092  for (auto const& worker : tr.workerSummaries) {
1093  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << worker.timesVisited << " "
1094  << std::right << std::setw(10) << worker.timesRun << " " << std::right
1095  << std::setw(10) << worker.timesPassed << " " << std::right << std::setw(10)
1096  << worker.timesFailed << " " << std::right << std::setw(10) << worker.timesExcept
1097  << " " << worker.moduleLabel << "";
1098  }
1099  LogFwkVerbatim("FwkSummary") << "";
1100  }
1101  // The timing report (CPU and Real Time):
1104 
1105  const int totalEvents = std::max(1, tr.eventSummary.totalEvents);
1106 
1107  LogFwkVerbatim("FwkSummary") << "TimeReport "
1108  << "---------- Event Summary ---[sec]----";
1109  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1110  << " event loop CPU/event = " << tr.eventSummary.cpuTime / totalEvents;
1111  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1112  << " event loop Real/event = " << tr.eventSummary.realTime / totalEvents;
1113  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1114  << " sum Streams Real/event = " << tr.eventSummary.sumStreamRealTime / totalEvents;
1115  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1116  << " efficiency CPU/Real/thread = "
1119 
1120  constexpr int kColumn1Size = 10;
1121  constexpr int kColumn2Size = 12;
1122  constexpr int kColumn3Size = 12;
1123  LogFwkVerbatim("FwkSummary") << "";
1124  LogFwkVerbatim("FwkSummary") << "TimeReport "
1125  << "---------- Path Summary ---[Real sec]----";
1126  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1127  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1128  << " Name";
1129  for (auto const& p : tr.trigPathSummaries) {
1130  const int timesRun = std::max(1, p.timesRun);
1131  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1132  << std::setw(kColumn1Size) << p.realTime / totalEvents << " " << std::right
1133  << std::setw(kColumn2Size) << p.realTime / timesRun << " " << p.name << "";
1134  }
1135  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1136  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1137  << " Name"
1138  << "";
1139 
1140  LogFwkVerbatim("FwkSummary") << "";
1141  LogFwkVerbatim("FwkSummary") << "TimeReport "
1142  << "-------End-Path Summary ---[Real sec]----";
1143  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1144  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1145  << " Name"
1146  << "";
1147  for (auto const& p : tr.endPathSummaries) {
1148  const int timesRun = std::max(1, p.timesRun);
1149 
1150  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1151  << std::setw(kColumn1Size) << p.realTime / totalEvents << " " << std::right
1152  << std::setw(kColumn2Size) << p.realTime / timesRun << " " << p.name << "";
1153  }
1154  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1155  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1156  << " Name"
1157  << "";
1158 
1159  for (auto const& p : tr.trigPathSummaries) {
1160  LogFwkVerbatim("FwkSummary") << "";
1161  LogFwkVerbatim("FwkSummary") << "TimeReport "
1162  << "---------- Modules in Path: " << p.name << " ---[Real sec]----";
1163  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1164  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1165  << " Name"
1166  << "";
1167  for (auto const& mod : p.moduleInPathSummaries) {
1168  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1169  << std::setw(kColumn1Size) << mod.realTime / totalEvents << " " << std::right
1170  << std::setw(kColumn2Size) << mod.realTime / std::max(1, mod.timesVisited) << " "
1171  << mod.moduleLabel << "";
1172  }
1173  }
1174  if (not tr.trigPathSummaries.empty()) {
1175  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1176  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1177  << " Name"
1178  << "";
1179  }
1180  for (auto const& p : tr.endPathSummaries) {
1181  LogFwkVerbatim("FwkSummary") << "";
1182  LogFwkVerbatim("FwkSummary") << "TimeReport "
1183  << "------ Modules in End-Path: " << p.name << " ---[Real sec]----";
1184  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1185  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1186  << " Name"
1187  << "";
1188  for (auto const& mod : p.moduleInPathSummaries) {
1189  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1190  << std::setw(kColumn1Size) << mod.realTime / totalEvents << " " << std::right
1191  << std::setw(kColumn2Size) << mod.realTime / std::max(1, mod.timesVisited) << " "
1192  << mod.moduleLabel << "";
1193  }
1194  }
1195  if (not tr.endPathSummaries.empty()) {
1196  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1197  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1198  << " Name"
1199  << "";
1200  }
1201  LogFwkVerbatim("FwkSummary") << "";
1202  LogFwkVerbatim("FwkSummary") << "TimeReport "
1203  << "---------- Module Summary ---[Real sec]----";
1204  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1205  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1206  << " " << std::right << std::setw(kColumn3Size) << "per visit"
1207  << " Name"
1208  << "";
1209  for (auto const& worker : tr.workerSummaries) {
1210  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1211  << std::setw(kColumn1Size) << worker.realTime / totalEvents << " " << std::right
1212  << std::setw(kColumn2Size) << worker.realTime / std::max(1, worker.timesRun) << " "
1213  << std::right << std::setw(kColumn3Size)
1214  << worker.realTime / std::max(1, worker.timesVisited) << " " << worker.moduleLabel
1215  << "";
1216  }
1217  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1218  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1219  << " " << std::right << std::setw(kColumn3Size) << "per visit"
1220  << " Name"
1221  << "";
1222 
1223  LogFwkVerbatim("FwkSummary") << "";
1224  LogFwkVerbatim("FwkSummary") << "T---Report end!"
1225  << "";
1226  LogFwkVerbatim("FwkSummary") << "";
1227  }
1228 
1230  using std::placeholders::_1;
1232  for (auto& worker : allWorkers()) {
1233  worker->respondToCloseOutputFile();
1234  }
1235  }
1236 
1238  using std::placeholders::_1;
1239  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::openFile, _1, std::cref(fb)));
1240  }
1241 
1243  RunPrincipal const& rp,
1244  ProcessContext const* processContext,
1245  ActivityRegistry* activityRegistry,
1246  MergeableRunProductMetadata const* mergeableRunProductMetadata) {
1249  LuminosityBlockID(rp.run(), 0),
1250  rp.index(),
1252  rp.endTime(),
1253  processContext);
1254 
1255  using namespace edm::waiting_task;
1256  chain::first([&](auto nextTask) {
1257  //services can depend on other services
1259 
1260  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1261  CMS_SA_ALLOW try { activityRegistry->preGlobalWriteRunSignal_(globalContext); } catch (...) {
1262  }
1263  for (auto& c : all_output_communicators_) {
1264  c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1265  }
1266  }) | chain::then(doCleanup([activityRegistry, globalContext, token]() {
1267  //services can depend on other services
1269 
1270  activityRegistry->postGlobalWriteRunSignal_(globalContext);
1271  })) |
1272  chain::runLast(task);
1273  }
1274 
1276  ProcessBlockPrincipal const& pbp,
1277  ProcessContext const* processContext,
1278  ActivityRegistry* activityRegistry) {
1285  processContext);
1286 
1287  using namespace edm::waiting_task;
1288  chain::first([&](auto nextTask) {
1289  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1291  CMS_SA_ALLOW try { activityRegistry->preWriteProcessBlockSignal_(globalContext); } catch (...) {
1292  }
1293  for (auto& c : all_output_communicators_) {
1294  c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1295  }
1296  }) | chain::then(doCleanup([activityRegistry, globalContext, token]() {
1297  //services can depend on other services
1299 
1300  activityRegistry->postWriteProcessBlockSignal_(globalContext);
1301  })) |
1302  chain::runLast(std::move(task));
1303  }
1304 
1306  LuminosityBlockPrincipal const& lbp,
1307  ProcessContext const* processContext,
1308  ActivityRegistry* activityRegistry) {
1311  lbp.id(),
1312  lbp.runPrincipal().index(),
1313  lbp.index(),
1314  lbp.beginTime(),
1315  processContext);
1316 
1317  using namespace edm::waiting_task;
1318  chain::first([&](auto nextTask) {
1320  CMS_SA_ALLOW try { activityRegistry->preGlobalWriteLumiSignal_(globalContext); } catch (...) {
1321  }
1322  for (auto& c : all_output_communicators_) {
1323  c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1324  }
1325  }) | chain::then(doCleanup([activityRegistry, globalContext, token]() {
1326  //services can depend on other services
1328 
1329  activityRegistry->postGlobalWriteLumiSignal_(globalContext);
1330  })) |
1331  chain::runLast(task);
1332  }
1333 
1335  using std::placeholders::_1;
1336  // Return true iff at least one output module returns true.
1337  return (std::find_if(all_output_communicators_.begin(),
1341  }
1342 
1344  using std::placeholders::_1;
1345  for_all(allWorkers(), std::bind(&Worker::respondToOpenInputFile, _1, std::cref(fb)));
1346  }
1347 
1349  using std::placeholders::_1;
1350  for_all(allWorkers(), std::bind(&Worker::respondToCloseInputFile, _1, std::cref(fb)));
1351  }
1352 
1353  void Schedule::beginJob(ProductRegistry const& iRegistry,
1354  eventsetup::ESRecordsToProxyIndices const& iESIndices,
1355  ProcessBlockHelperBase const& processBlockHelperBase) {
1356  globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1357  }
1358 
1359  void Schedule::beginStream(unsigned int iStreamID) {
1360  assert(iStreamID < streamSchedules_.size());
1361  streamSchedules_[iStreamID]->beginStream();
1362  }
1363 
1364  void Schedule::endStream(unsigned int iStreamID) {
1365  assert(iStreamID < streamSchedules_.size());
1366  streamSchedules_[iStreamID]->endStream();
1367  }
1368 
1370  unsigned int iStreamID,
1372  ServiceToken const& token) {
1373  assert(iStreamID < streamSchedules_.size());
1374  streamSchedules_[iStreamID]->processOneEventAsync(std::move(iTask), info, token, pathStatusInserters_);
1375  }
1376 
1378  ParameterSet const& iPSet,
1379  const ProductRegistry& iRegistry,
1380  eventsetup::ESRecordsToProxyIndices const& iIndices) {
1381  Worker* found = nullptr;
1382  for (auto const& worker : allWorkers()) {
1383  if (worker->description()->moduleLabel() == iLabel) {
1384  found = worker;
1385  break;
1386  }
1387  }
1388  if (nullptr == found) {
1389  return false;
1390  }
1391 
1392  auto newMod = moduleRegistry_->replaceModule(iLabel, iPSet, preallocConfig_);
1393 
1394  globalSchedule_->replaceModule(newMod, iLabel);
1395 
1396  for (auto& s : streamSchedules_) {
1397  s->replaceModule(newMod, iLabel);
1398  }
1399 
1400  {
1401  //Need to updateLookup in order to make getByToken work
1402  auto const processBlockLookup = iRegistry.productLookup(InProcess);
1403  auto const runLookup = iRegistry.productLookup(InRun);
1404  auto const lumiLookup = iRegistry.productLookup(InLumi);
1405  auto const eventLookup = iRegistry.productLookup(InEvent);
1406  found->updateLookup(InProcess, *runLookup);
1407  found->updateLookup(InRun, *runLookup);
1408  found->updateLookup(InLumi, *lumiLookup);
1409  found->updateLookup(InEvent, *eventLookup);
1410  found->updateLookup(iIndices);
1411 
1412  auto const& processName = newMod->moduleDescription().processName();
1413  auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName);
1414  auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
1415  auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
1416  auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
1417  found->resolvePutIndicies(InProcess, processBlockModuleToIndicies);
1418  found->resolvePutIndicies(InRun, runModuleToIndicies);
1419  found->resolvePutIndicies(InLumi, lumiModuleToIndicies);
1420  found->resolvePutIndicies(InEvent, eventModuleToIndicies);
1421  }
1422 
1423  return true;
1424  }
1425 
1427  globalSchedule_->deleteModule(iLabel);
1428  for (auto& stream : streamSchedules_) {
1429  stream->deleteModule(iLabel);
1430  }
1431  moduleRegistry_->deleteModule(iLabel, areg->preModuleDestructionSignal_, areg->postModuleDestructionSignal_);
1432  }
1433 
1434  std::vector<ModuleDescription const*> Schedule::getAllModuleDescriptions() const {
1435  std::vector<ModuleDescription const*> result;
1436  result.reserve(allWorkers().size());
1437 
1438  for (auto const& worker : allWorkers()) {
1439  ModuleDescription const* p = worker->description();
1440  result.push_back(p);
1441  }
1442  return result;
1443  }
1444 
1445  Schedule::AllWorkers const& Schedule::allWorkers() const { return globalSchedule_->allWorkers(); }
1446 
1448  for (auto const& worker : allWorkers()) {
1449  worker->convertCurrentProcessAlias(processName);
1450  }
1451  }
1452 
1453  void Schedule::availablePaths(std::vector<std::string>& oLabelsToFill) const {
1454  streamSchedules_[0]->availablePaths(oLabelsToFill);
1455  }
1456 
1457  void Schedule::triggerPaths(std::vector<std::string>& oLabelsToFill) const { oLabelsToFill = *pathNames_; }
1458 
1459  void Schedule::endPaths(std::vector<std::string>& oLabelsToFill) const { oLabelsToFill = *endPathNames_; }
1460 
1461  void Schedule::modulesInPath(std::string const& iPathLabel, std::vector<std::string>& oLabelsToFill) const {
1462  streamSchedules_[0]->modulesInPath(iPathLabel, oLabelsToFill);
1463  }
1464 
1466  std::vector<ModuleDescription const*>& descriptions,
1467  unsigned int hint) const {
1468  streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1469  }
1470 
1472  std::vector<ModuleDescription const*>& descriptions,
1473  unsigned int hint) const {
1474  streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1475  }
1476 
1478  std::vector<ModuleDescription const*>& allModuleDescriptions,
1479  std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1480  std::array<std::vector<std::vector<ModuleDescription const*>>, NumBranchTypes>& modulesWhoseProductsAreConsumedBy,
1481  std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1482  ProductRegistry const& preg) const {
1483  allModuleDescriptions.clear();
1484  moduleIDToIndex.clear();
1485  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1486  modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1487  }
1488  modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1489 
1490  allModuleDescriptions.reserve(allWorkers().size());
1491  moduleIDToIndex.reserve(allWorkers().size());
1492  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1493  modulesWhoseProductsAreConsumedBy[iBranchType].resize(allWorkers().size());
1494  }
1495  modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(allWorkers().size());
1496 
1497  std::map<std::string, ModuleDescription const*> labelToDesc;
1498  unsigned int i = 0;
1499  for (auto const& worker : allWorkers()) {
1500  ModuleDescription const* p = worker->description();
1501  allModuleDescriptions.push_back(p);
1502  moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->id(), i));
1503  labelToDesc[p->moduleLabel()] = p;
1504  ++i;
1505  }
1506  sort_all(moduleIDToIndex);
1507 
1508  i = 0;
1509  for (auto const& worker : allWorkers()) {
1510  std::array<std::vector<ModuleDescription const*>*, NumBranchTypes> modules;
1511  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1512  modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(i);
1513  }
1514 
1515  std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1516  modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(i);
1517  try {
1518  worker->modulesWhoseProductsAreConsumed(modules, modulesInPreviousProcesses, preg, labelToDesc);
1519  } catch (cms::Exception& ex) {
1520  ex.addContext("Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1521  worker->description()->moduleLabel());
1522  throw;
1523  }
1524  ++i;
1525  }
1526  }
1527 
1529  rep.eventSummary.totalEvents = 0;
1532  for (auto& s : streamSchedules_) {
1533  s->getTriggerReport(rep);
1534  }
1536  }
1537 
1539  rep.eventSummary.totalEvents = 0;
1540  rep.eventSummary.cpuTime = 0.;
1541  rep.eventSummary.realTime = 0.;
1542  summaryTimeKeeper_->fillTriggerTimingReport(rep);
1543  }
1544 
1546  int returnValue = 0;
1547  for (auto& s : streamSchedules_) {
1548  returnValue += s->totalEvents();
1549  }
1550  return returnValue;
1551  }
1552 
1554  int returnValue = 0;
1555  for (auto& s : streamSchedules_) {
1556  returnValue += s->totalEventsPassed();
1557  }
1558  return returnValue;
1559  }
1560 
1562  int returnValue = 0;
1563  for (auto& s : streamSchedules_) {
1564  returnValue += s->totalEventsFailed();
1565  }
1566  return returnValue;
1567  }
1568 
1570  for (auto& s : streamSchedules_) {
1571  s->clearCounters();
1572  }
1573  }
1574 } // namespace edm
RunPrincipal const & runPrincipal() const
bool empty() const
Definition: ParameterSet.h:201
std::vector< PathSummary > endPathSummaries
Definition: TriggerReport.h:59
T getUntrackedParameter(std::string const &, T const &) const
std::vector< PathTimingSummary > endPathSummaries
dictionary aliases
Definition: autoCond.py:82
string rep
Definition: cuy.py:1189
pathNames_ & tns()), endPathNames_(&tns.getEndPaths()), wantSummary_(tns.wantSummary()
Definition: Schedule.cc:691
PostModuleDestruction postModuleDestructionSignal_
const auto & workers
tuple array
Definition: mps_check.py:216
static const TGPicture * info(bool iBackgroundIsBlack)
const edm::EventSetup & c
#define CMS_SA_ALLOW
void stopEvent(StreamContext const &)
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
virtual void openFile(FileBlock const &fb)=0
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:1445
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Definition: Schedule.cc:1453
void writeProcessBlockAsync(WaitingTaskHolder iTask, ProcessBlockPrincipal const &, ProcessContext const *, ActivityRegistry *)
Definition: Schedule.cc:1275
Timestamp const & beginTime() const
static Timestamp invalidTimestamp()
Definition: Timestamp.h:82
preallocConfig_(prealloc)
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
all_output_communicators_()
void respondToCloseInputFile(FileBlock const &fb)
Definition: Schedule.cc:1348
vector< string > vstring
Definition: ExoticaDQM.cc:8
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::vector< Worker * > AllWorkers
Definition: Schedule.h:125
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
void removeModuleIfExists(ModuleDescription const &module)
std::vector< std::string > const * pathNames_
Definition: Schedule.h:311
void convertCurrentProcessAlias(std::string const &processName)
Convert &quot;@currentProcess&quot; in InputTag process names to the actual current process name...
Definition: Schedule.cc:1447
void fillModuleAndConsumesInfo(std::vector< ModuleDescription const * > &allModuleDescriptions, std::vector< std::pair< unsigned int, unsigned int >> &moduleIDToIndex, std::array< std::vector< std::vector< ModuleDescription const * >>, NumBranchTypes > &modulesWhoseProductsAreConsumedBy, std::vector< std::vector< ModuleProcessName >> &modulesInPreviousProcessesWhoseProductsAreConsumedBy, ProductRegistry const &preg) const
Definition: Schedule.cc:1477
void endStream(unsigned int)
Definition: Schedule.cc:1364
processConfiguration
Definition: Schedule.cc:687
LuminosityBlockIndex index() const
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
virtual void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &)=0
PostGlobalEndLumi postGlobalWriteLumiSignal_
RunNumber_t run() const
Definition: RunPrincipal.h:61
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1471
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< WorkerSummary > workerSummaries
Definition: TriggerReport.h:60
edm::propagate_const< std::unique_ptr< SystemTimeKeeper > > summaryTimeKeeper_
Definition: Schedule.h:309
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
actions
Definition: Schedule.cc:687
PreModuleDestruction preModuleDestructionSignal_
ServiceToken presentToken() const
constexpr auto then(O &&iO)
Definition: chain_first.h:277
std::string const & moduleLabel() const
void processOneEventAsync(WaitingTaskHolder iTask, unsigned int iStreamID, EventTransitionInfo &, ServiceToken const &token)
Definition: Schedule.cc:1369
static unsigned int getUniqueID()
Returns a unique id each time called. Intended to be passed to ModuleDescription&#39;s constructor&#39;s modI...
int totalEventsFailed() const
Definition: Schedule.cc:1561
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
Definition: Schedule.h:304
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
void eraseOrSetUntrackedParameterSet(std::string const &name)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
void deleteModule(std::string const &iLabel, ActivityRegistry *areg)
Deletes module with label iLabel.
Definition: Schedule.cc:1426
int totalEventsPassed() const
Definition: Schedule.cc:1553
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
Definition: Schedule.cc:1457
std::vector< PathSummary > trigPathSummaries
Definition: TriggerReport.h:58
EventSummary eventSummary
Definition: TriggerReport.h:57
void beginJob(ProductRegistry const &, eventsetup::ESRecordsToProxyIndices const &, ProcessBlockHelperBase const &)
Definition: Schedule.cc:1353
auto runLast(edm::WaitingTaskHolder iTask)
Definition: chain_first.h:297
std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter > > > pathStatusInserters_
Definition: Schedule.h:299
int totalEvents() const
Definition: Schedule.cc:1545
virtual void resolvePutIndicies(BranchType iBranchType, std::unordered_multimap< std::string, std::tuple< TypeID const *, const char *, edm::ProductResolverIndex >> const &iIndicies)=0
EventTimingSummary eventSummary
void clearCounters()
Clear all the counters in the trigger report.
Definition: Schedule.cc:1569
def move
Definition: eostools.py:511
PostGlobalWriteRun postGlobalWriteRunSignal_
tuple key
prepare the HTCondor submission files and eventually submit them
static ServiceRegistry & instance()
Timestamp const & endTime() const
Definition: RunPrincipal.h:69
std::vector< PathTimingSummary > trigPathSummaries
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists, SubProcessParentageHelper const *subProcessParentageHelper)
Definition: Schedule.cc:890
bool terminate() const
Return whether each output module has reached its maximum count.
Definition: Schedule.cc:931
void respondToOpenInputFile(FileBlock const &fb)
Definition: Schedule.cc:1343
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
Definition: Schedule.h:301
void writeRunAsync(WaitingTaskHolder iTask, RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *)
Definition: Schedule.cc:1242
void stopPath(StreamContext const &, PathContext const &, HLTPathStatus const &)
static LuminosityBlockIndex invalidLuminosityBlockIndex()
PreGlobalWriteRun preGlobalWriteRunSignal_
areg
Definition: Schedule.cc:687
void stopModuleEvent(StreamContext const &, ModuleCallingContext const &)
void getTriggerReport(TriggerReport &rep) const
Definition: Schedule.cc:1528
virtual bool shouldWeCloseFile() const =0
Log< level::Info, false > LogInfo
PreallocationConfiguration preallocConfig_
Definition: Schedule.h:307
Log< level::FwkInfo, true > LogFwkVerbatim
PreWriteProcessBlock preWriteProcessBlockSignal_
moduleRegistry_(new ModuleRegistry())
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
Definition: Schedule.h:302
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
void respondToOpenInputFile(FileBlock const &fb)
Definition: Worker.h:173
void startPath(StreamContext const &, PathContext const &)
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:36
PostWriteProcessBlock postWriteProcessBlockSignal_
void addContext(std::string const &context)
Definition: Exception.cc:165
virtual std::unique_ptr< OutputModuleCommunicator > createOutputModuleCommunicator()=0
AllOutputModuleCommunicators all_output_communicators_
Definition: Schedule.h:306
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:1461
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
RunIndex index() const
Definition: RunPrincipal.h:57
PreGlobalEndLumi preGlobalWriteLumiSignal_
void beginStream(unsigned int)
Definition: Schedule.cc:1359
void respondToCloseInputFile(FileBlock const &fb)
Definition: Worker.h:174
bool wantSummary_
Definition: Schedule.h:313
std::vector< std::string > const * endPathNames_
Definition: Schedule.h:312
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Definition: Schedule.cc:1434
Strings const & getTrigPaths() const
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
void openOutputFiles(FileBlock &fb)
Definition: Schedule.cc:1237
preg
Definition: Schedule.cc:687
void writeLumiAsync(WaitingTaskHolder iTask, LuminosityBlockPrincipal const &lbp, ProcessContext const *, ActivityRegistry *)
Definition: Schedule.cc:1305
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void endJob(ExceptionCollector &collector)
Definition: Schedule.cc:946
void getTriggerTimingReport(TriggerTimingReport &rep) const
Definition: Schedule.cc:1538
Schedule(ParameterSet &proc_pset, service::TriggerNamesService const &tns, ProductRegistry &pregistry, BranchIDListHelper &branchIDListHelper, ProcessBlockHelperBase &, 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:671
bool shouldWeCloseOutput() const
Definition: Schedule.cc:1334
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry, eventsetup::ESRecordsToProxyIndices const &)
Definition: Schedule.cc:1377
std::vector< std::string > vstring
Definition: Schedule.cc:667
void setIsMergeable(BranchDescription &)
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)
tuple size
Write out results.
void closeOutputFiles()
Definition: Schedule.cc:1229
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
Definition: Schedule.cc:1459
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1465
prealloc
Definition: Schedule.cc:687
unsigned int id() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
unsigned transform(const HcalDetId &id, unsigned transformCode)