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  StreamID{i},
726  processContext));
727  }
728 
729  //TriggerResults are injected automatically by StreamSchedules and are
730  // unknown to the ModuleRegistry
731  const std::string kTriggerResults("TriggerResults");
732  std::vector<std::string> modulesToUse;
733  modulesToUse.reserve(streamSchedules_[0]->allWorkers().size());
734  for (auto const& worker : streamSchedules_[0]->allWorkers()) {
735  if (worker->description()->moduleLabel() != kTriggerResults) {
736  modulesToUse.push_back(worker->description()->moduleLabel());
737  }
738  }
739  //The unscheduled modules are at the end of the list, but we want them at the front
740  unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
741  if (nUnscheduledModules > 0) {
742  std::vector<std::string> temp;
743  temp.reserve(modulesToUse.size());
744  auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
745  std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(temp));
746  std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(temp));
747  temp.swap(modulesToUse);
748  }
749 
750  // propagate_const<T> has no reset() function
751  globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
752  pathStatusInserters_,
753  endPathStatusInserters_,
754  moduleRegistry(),
755  modulesToUse,
756  proc_pset,
757  preg,
758  prealloc,
759  actions,
760  areg,
762  processContext);
763 
764  //TriggerResults is not in the top level ParameterSet so the call to
765  // reduceParameterSet would fail to find it. Just remove it up front.
766  std::set<std::string> usedModuleLabels;
767  for (auto const& worker : allWorkers()) {
768  if (worker->description()->moduleLabel() != kTriggerResults) {
769  usedModuleLabels.insert(worker->description()->moduleLabel());
770  }
771  }
772  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>("@all_modules"));
773  std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
774  reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
775  processEDAliases(proc_pset, processConfiguration->processName(), preg);
776 
777  // At this point all BranchDescriptions are created. Mark now the
778  // ones of unscheduled workers to be on-demand.
779  if (nUnscheduledModules > 0) {
780  std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
781  preg.setUnscheduledProducts(unscheduledModules);
782  }
783 
784  processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
785  proc_pset.registerIt();
786  processConfiguration->setParameterSetID(proc_pset.id());
787  processConfiguration->setProcessConfigurationID();
788 
789  // This is used for a little sanity-check to make sure no code
790  // modifications alter the number of workers at a later date.
791  size_t all_workers_count = allWorkers().size();
792 
793  moduleRegistry_->forAllModuleHolders([this](maker::ModuleHolder* iHolder) {
794  auto comm = iHolder->createOutputModuleCommunicator();
795  if (comm) {
796  all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
797  }
798  });
799  // Now that the output workers are filled in, set any output limits or information.
800  limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
801 
802  // Sanity check: make sure nobody has added a worker after we've
803  // already relied on the WorkerManager being full.
804  assert(all_workers_count == allWorkers().size());
805 
806  branchIDListHelper.updateFromRegistry(preg);
807 
808  for (auto const& worker : streamSchedules_[0]->allWorkers()) {
809  worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
810  }
811 
812  processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
813 
814  // The output modules consume products in kept branches.
815  // So we must set this up before freezing.
816  for (auto& c : all_output_communicators_) {
817  c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
818  }
819 
820  for (auto& product : preg.productListUpdator()) {
821  setIsMergeable(product.second);
822  }
823 
824  {
825  // We now get a collection of types that may be consumed.
826  std::set<TypeID> productTypesConsumed;
827  std::set<TypeID> elementTypesConsumed;
828  // Loop over all modules
829  for (auto const& worker : allWorkers()) {
830  for (auto const& consumesInfo : worker->consumesInfo()) {
831  if (consumesInfo.kindOfType() == PRODUCT_TYPE) {
832  productTypesConsumed.emplace(consumesInfo.type());
833  } else {
834  elementTypesConsumed.emplace(consumesInfo.type());
835  }
836  }
837  }
838  // The SubProcess class is not a module, yet it may consume.
839  if (hasSubprocesses) {
840  productTypesConsumed.emplace(typeid(TriggerResults));
841  }
842  // The RandomNumberGeneratorService is not a module, yet it consumes.
843  { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
844  preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
845  }
846 
847  for (auto& c : all_output_communicators_) {
848  c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
849  }
850 
851  if (wantSummary_) {
852  std::vector<const ModuleDescription*> modDesc;
853  const auto& workers = allWorkers();
854  modDesc.reserve(workers.size());
855 
856  std::transform(workers.begin(),
857  workers.end(),
858  std::back_inserter(modDesc),
859  [](const Worker* iWorker) -> const ModuleDescription* { return iWorker->description(); });
860 
861  // propagate_const<T> has no reset() function
862  summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc, tns, processContext);
863  auto timeKeeperPtr = summaryTimeKeeper_.get();
864 
865  areg->watchPreModuleDestruction(timeKeeperPtr, &SystemTimeKeeper::removeModuleIfExists);
866 
867  areg->watchPreModuleEvent(timeKeeperPtr, &SystemTimeKeeper::startModuleEvent);
868  areg->watchPostModuleEvent(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
869  areg->watchPreModuleEventAcquire(timeKeeperPtr, &SystemTimeKeeper::restartModuleEvent);
870  areg->watchPostModuleEventAcquire(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
871  areg->watchPreModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::pauseModuleEvent);
872  areg->watchPostModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::restartModuleEvent);
873 
874  areg->watchPreSourceEvent(timeKeeperPtr, &SystemTimeKeeper::startEvent);
875  areg->watchPostEvent(timeKeeperPtr, &SystemTimeKeeper::stopEvent);
876 
877  areg->watchPrePathEvent(timeKeeperPtr, &SystemTimeKeeper::startPath);
878  areg->watchPostPathEvent(timeKeeperPtr, &SystemTimeKeeper::stopPath);
879 
880  areg->watchPostBeginJob(timeKeeperPtr, &SystemTimeKeeper::startProcessingLoop);
881  areg->watchPreEndJob(timeKeeperPtr, &SystemTimeKeeper::stopProcessingLoop);
882  //areg->preModuleEventSignal_.connect([timeKeeperPtr](StreamContext const& iContext, ModuleCallingContext const& iMod) {
883  //timeKeeperPtr->startModuleEvent(iContext,iMod);
884  //});
885  }
886 
887  } // Schedule::Schedule
888 
889  void Schedule::limitOutput(ParameterSet const& proc_pset,
890  BranchIDLists const& branchIDLists,
891  SubProcessParentageHelper const* subProcessParentageHelper) {
892  std::string const output("output");
893 
894  ParameterSet const& maxEventsPSet = proc_pset.getUntrackedParameterSet("maxEvents");
895  int maxEventSpecs = 0;
896  int maxEventsOut = -1;
897  ParameterSet const* vMaxEventsOut = nullptr;
898  std::vector<std::string> intNamesE = maxEventsPSet.getParameterNamesForType<int>(false);
899  if (search_all(intNamesE, output)) {
900  maxEventsOut = maxEventsPSet.getUntrackedParameter<int>(output);
901  ++maxEventSpecs;
902  }
903  std::vector<std::string> psetNamesE;
904  maxEventsPSet.getParameterSetNames(psetNamesE, false);
905  if (search_all(psetNamesE, output)) {
906  vMaxEventsOut = &maxEventsPSet.getUntrackedParameterSet(output);
907  ++maxEventSpecs;
908  }
909 
910  if (maxEventSpecs > 1) {
912  << "\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
913  }
914 
915  for (auto& c : all_output_communicators_) {
916  OutputModuleDescription desc(branchIDLists, maxEventsOut, subProcessParentageHelper);
917  if (vMaxEventsOut != nullptr && !vMaxEventsOut->empty()) {
918  std::string const& moduleLabel = c->description().moduleLabel();
919  try {
920  desc.maxEvents_ = vMaxEventsOut->getUntrackedParameter<int>(moduleLabel);
921  } catch (Exception const&) {
923  << "\nNo entry in 'maxEvents' for output module label '" << moduleLabel << "'.\n";
924  }
925  }
926  c->configure(desc);
927  }
928  }
929 
930  bool Schedule::terminate() const {
931  if (all_output_communicators_.empty()) {
932  return false;
933  }
934  for (auto& c : all_output_communicators_) {
935  if (!c->limitReached()) {
936  // Found an output module that has not reached output event count.
937  return false;
938  }
939  }
940  LogInfo("SuccessfulTermination") << "The job is terminating successfully because each output module\n"
941  << "has reached its configured limit.\n";
942  return true;
943  }
944 
946  globalSchedule_->endJob(collector);
947  if (collector.hasThrown()) {
948  return;
949  }
950 
951  if (wantSummary_ == false)
952  return;
953  {
954  TriggerReport tr;
955  getTriggerReport(tr);
956 
957  // The trigger report (pass/fail etc.):
958 
959  LogFwkVerbatim("FwkSummary") << "";
960  if (streamSchedules_[0]->context().processContext()->isSubProcess()) {
961  LogFwkVerbatim("FwkSummary") << "TrigReport Process: "
962  << streamSchedules_[0]->context().processContext()->processName();
963  }
964  LogFwkVerbatim("FwkSummary") << "TrigReport "
965  << "---------- Event Summary ------------";
966  if (!tr.trigPathSummaries.empty()) {
967  LogFwkVerbatim("FwkSummary") << "TrigReport"
968  << " Events total = " << tr.eventSummary.totalEvents
969  << " passed = " << tr.eventSummary.totalEventsPassed
970  << " failed = " << tr.eventSummary.totalEventsFailed << "";
971  } else {
972  LogFwkVerbatim("FwkSummary") << "TrigReport"
973  << " Events total = " << tr.eventSummary.totalEvents
974  << " passed = " << tr.eventSummary.totalEvents << " failed = 0";
975  }
976 
977  LogFwkVerbatim("FwkSummary") << "";
978  LogFwkVerbatim("FwkSummary") << "TrigReport "
979  << "---------- Path Summary ------------";
980  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
981  << " " << std::right << std::setw(10) << "Executed"
982  << " " << std::right << std::setw(10) << "Passed"
983  << " " << std::right << std::setw(10) << "Failed"
984  << " " << std::right << std::setw(10) << "Error"
985  << " "
986  << "Name"
987  << "";
988  for (auto const& p : tr.trigPathSummaries) {
989  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
990  << p.bitPosition << " " << std::right << std::setw(10) << p.timesRun << " "
991  << std::right << std::setw(10) << p.timesPassed << " " << std::right
992  << std::setw(10) << p.timesFailed << " " << std::right << std::setw(10)
993  << p.timesExcept << " " << p.name << "";
994  }
995 
996  /*
997  std::vector<int>::const_iterator epi = empty_trig_paths_.begin();
998  std::vector<int>::const_iterator epe = empty_trig_paths_.end();
999  std::vector<std::string>::const_iterator epn = empty_trig_path_names_.begin();
1000  for (; epi != epe; ++epi, ++epn) {
1001 
1002  LogFwkVerbatim("FwkSummary") << "TrigReport "
1003  << std::right << std::setw(5) << 1
1004  << std::right << std::setw(5) << *epi << " "
1005  << std::right << std::setw(10) << totalEvents() << " "
1006  << std::right << std::setw(10) << totalEvents() << " "
1007  << std::right << std::setw(10) << 0 << " "
1008  << std::right << std::setw(10) << 0 << " "
1009  << *epn << "";
1010  }
1011  */
1012 
1013  LogFwkVerbatim("FwkSummary") << "";
1014  LogFwkVerbatim("FwkSummary") << "TrigReport "
1015  << "-------End-Path Summary ------------";
1016  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1017  << " " << std::right << std::setw(10) << "Executed"
1018  << " " << std::right << std::setw(10) << "Passed"
1019  << " " << std::right << std::setw(10) << "Failed"
1020  << " " << std::right << std::setw(10) << "Error"
1021  << " "
1022  << "Name"
1023  << "";
1024  for (auto const& p : tr.endPathSummaries) {
1025  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1026  << p.bitPosition << " " << std::right << std::setw(10) << p.timesRun << " "
1027  << std::right << std::setw(10) << p.timesPassed << " " << std::right
1028  << std::setw(10) << p.timesFailed << " " << std::right << std::setw(10)
1029  << p.timesExcept << " " << p.name << "";
1030  }
1031 
1032  for (auto const& p : tr.trigPathSummaries) {
1033  LogFwkVerbatim("FwkSummary") << "";
1034  LogFwkVerbatim("FwkSummary") << "TrigReport "
1035  << "---------- Modules in Path: " << p.name << " ------------";
1036  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1037  << " " << std::right << std::setw(10) << "Visited"
1038  << " " << std::right << std::setw(10) << "Passed"
1039  << " " << std::right << std::setw(10) << "Failed"
1040  << " " << std::right << std::setw(10) << "Error"
1041  << " "
1042  << "Name"
1043  << "";
1044 
1045  unsigned int bitpos = 0;
1046  for (auto const& mod : p.moduleInPathSummaries) {
1047  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1048  << bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
1049  << std::right << std::setw(10) << mod.timesPassed << " " << std::right
1050  << std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
1051  << mod.timesExcept << " " << mod.moduleLabel << "";
1052  ++bitpos;
1053  }
1054  }
1055 
1056  for (auto const& p : tr.endPathSummaries) {
1057  LogFwkVerbatim("FwkSummary") << "";
1058  LogFwkVerbatim("FwkSummary") << "TrigReport "
1059  << "------ Modules in End-Path: " << p.name << " ------------";
1060  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1061  << " " << std::right << std::setw(10) << "Visited"
1062  << " " << std::right << std::setw(10) << "Passed"
1063  << " " << std::right << std::setw(10) << "Failed"
1064  << " " << std::right << std::setw(10) << "Error"
1065  << " "
1066  << "Name"
1067  << "";
1068 
1069  unsigned int bitpos = 0;
1070  for (auto const& mod : p.moduleInPathSummaries) {
1071  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1072  << bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
1073  << std::right << std::setw(10) << mod.timesPassed << " " << std::right
1074  << std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
1075  << mod.timesExcept << " " << mod.moduleLabel << "";
1076  ++bitpos;
1077  }
1078  }
1079 
1080  LogFwkVerbatim("FwkSummary") << "";
1081  LogFwkVerbatim("FwkSummary") << "TrigReport "
1082  << "---------- Module Summary ------------";
1083  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Visited"
1084  << " " << std::right << std::setw(10) << "Executed"
1085  << " " << std::right << std::setw(10) << "Passed"
1086  << " " << std::right << std::setw(10) << "Failed"
1087  << " " << std::right << std::setw(10) << "Error"
1088  << " "
1089  << "Name"
1090  << "";
1091  for (auto const& worker : tr.workerSummaries) {
1092  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << worker.timesVisited << " "
1093  << std::right << std::setw(10) << worker.timesRun << " " << std::right
1094  << std::setw(10) << worker.timesPassed << " " << std::right << std::setw(10)
1095  << worker.timesFailed << " " << std::right << std::setw(10) << worker.timesExcept
1096  << " " << worker.moduleLabel << "";
1097  }
1098  LogFwkVerbatim("FwkSummary") << "";
1099  }
1100  // The timing report (CPU and Real Time):
1103 
1104  const int totalEvents = std::max(1, tr.eventSummary.totalEvents);
1105 
1106  LogFwkVerbatim("FwkSummary") << "TimeReport "
1107  << "---------- Event Summary ---[sec]----";
1108  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1109  << " event loop CPU/event = " << tr.eventSummary.cpuTime / totalEvents;
1110  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1111  << " event loop Real/event = " << tr.eventSummary.realTime / totalEvents;
1112  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1113  << " sum Streams Real/event = " << tr.eventSummary.sumStreamRealTime / totalEvents;
1114  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1115  << " efficiency CPU/Real/thread = "
1118 
1119  constexpr int kColumn1Size = 10;
1120  constexpr int kColumn2Size = 12;
1121  constexpr int kColumn3Size = 12;
1122  LogFwkVerbatim("FwkSummary") << "";
1123  LogFwkVerbatim("FwkSummary") << "TimeReport "
1124  << "---------- Path Summary ---[Real sec]----";
1125  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1126  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1127  << " Name";
1128  for (auto const& p : tr.trigPathSummaries) {
1129  const int timesRun = std::max(1, p.timesRun);
1130  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1131  << std::setw(kColumn1Size) << p.realTime / totalEvents << " " << std::right
1132  << std::setw(kColumn2Size) << p.realTime / timesRun << " " << p.name << "";
1133  }
1134  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1135  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1136  << " Name"
1137  << "";
1138 
1139  LogFwkVerbatim("FwkSummary") << "";
1140  LogFwkVerbatim("FwkSummary") << "TimeReport "
1141  << "-------End-Path Summary ---[Real sec]----";
1142  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1143  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1144  << " Name"
1145  << "";
1146  for (auto const& p : tr.endPathSummaries) {
1147  const int timesRun = std::max(1, p.timesRun);
1148 
1149  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1150  << std::setw(kColumn1Size) << p.realTime / totalEvents << " " << std::right
1151  << std::setw(kColumn2Size) << p.realTime / timesRun << " " << p.name << "";
1152  }
1153  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1154  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1155  << " Name"
1156  << "";
1157 
1158  for (auto const& p : tr.trigPathSummaries) {
1159  LogFwkVerbatim("FwkSummary") << "";
1160  LogFwkVerbatim("FwkSummary") << "TimeReport "
1161  << "---------- Modules in Path: " << p.name << " ---[Real sec]----";
1162  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1163  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1164  << " Name"
1165  << "";
1166  for (auto const& mod : p.moduleInPathSummaries) {
1167  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1168  << std::setw(kColumn1Size) << mod.realTime / totalEvents << " " << std::right
1169  << std::setw(kColumn2Size) << mod.realTime / std::max(1, mod.timesVisited) << " "
1170  << mod.moduleLabel << "";
1171  }
1172  }
1173  if (not tr.trigPathSummaries.empty()) {
1174  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1175  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1176  << " Name"
1177  << "";
1178  }
1179  for (auto const& p : tr.endPathSummaries) {
1180  LogFwkVerbatim("FwkSummary") << "";
1181  LogFwkVerbatim("FwkSummary") << "TimeReport "
1182  << "------ Modules in End-Path: " << p.name << " ---[Real sec]----";
1183  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1184  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1185  << " Name"
1186  << "";
1187  for (auto const& mod : p.moduleInPathSummaries) {
1188  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1189  << std::setw(kColumn1Size) << mod.realTime / totalEvents << " " << std::right
1190  << std::setw(kColumn2Size) << mod.realTime / std::max(1, mod.timesVisited) << " "
1191  << mod.moduleLabel << "";
1192  }
1193  }
1194  if (not tr.endPathSummaries.empty()) {
1195  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1196  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1197  << " Name"
1198  << "";
1199  }
1200  LogFwkVerbatim("FwkSummary") << "";
1201  LogFwkVerbatim("FwkSummary") << "TimeReport "
1202  << "---------- Module Summary ---[Real sec]----";
1203  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1204  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1205  << " " << std::right << std::setw(kColumn3Size) << "per visit"
1206  << " Name"
1207  << "";
1208  for (auto const& worker : tr.workerSummaries) {
1209  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1210  << std::setw(kColumn1Size) << worker.realTime / totalEvents << " " << std::right
1211  << std::setw(kColumn2Size) << worker.realTime / std::max(1, worker.timesRun) << " "
1212  << std::right << std::setw(kColumn3Size)
1213  << worker.realTime / std::max(1, worker.timesVisited) << " " << worker.moduleLabel
1214  << "";
1215  }
1216  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1217  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1218  << " " << std::right << std::setw(kColumn3Size) << "per visit"
1219  << " Name"
1220  << "";
1221 
1222  LogFwkVerbatim("FwkSummary") << "";
1223  LogFwkVerbatim("FwkSummary") << "T---Report end!"
1224  << "";
1225  LogFwkVerbatim("FwkSummary") << "";
1226  }
1227 
1229  using std::placeholders::_1;
1231  for (auto& worker : allWorkers()) {
1232  worker->respondToCloseOutputFile();
1233  }
1234  }
1235 
1237  using std::placeholders::_1;
1238  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::openFile, _1, std::cref(fb)));
1239  }
1240 
1242  RunPrincipal const& rp,
1243  ProcessContext const* processContext,
1244  ActivityRegistry* activityRegistry,
1245  MergeableRunProductMetadata const* mergeableRunProductMetadata) {
1248  LuminosityBlockID(rp.run(), 0),
1249  rp.index(),
1251  rp.endTime(),
1252  processContext);
1253 
1254  using namespace edm::waiting_task;
1255  chain::first([&](auto nextTask) {
1256  //services can depend on other services
1258 
1259  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1260  CMS_SA_ALLOW try { activityRegistry->preGlobalWriteRunSignal_(globalContext); } catch (...) {
1261  }
1262  for (auto& c : all_output_communicators_) {
1263  c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1264  }
1265  }) | chain::then(doCleanup([activityRegistry, globalContext, token]() {
1266  //services can depend on other services
1268 
1269  activityRegistry->postGlobalWriteRunSignal_(globalContext);
1270  })) |
1271  chain::runLast(task);
1272  }
1273 
1275  ProcessBlockPrincipal const& pbp,
1276  ProcessContext const* processContext,
1277  ActivityRegistry* activityRegistry) {
1284  processContext);
1285 
1286  using namespace edm::waiting_task;
1287  chain::first([&](auto nextTask) {
1288  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1290  CMS_SA_ALLOW try { activityRegistry->preWriteProcessBlockSignal_(globalContext); } catch (...) {
1291  }
1292  for (auto& c : all_output_communicators_) {
1293  c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1294  }
1295  }) | chain::then(doCleanup([activityRegistry, globalContext, token]() {
1296  //services can depend on other services
1298 
1299  activityRegistry->postWriteProcessBlockSignal_(globalContext);
1300  })) |
1301  chain::runLast(std::move(task));
1302  }
1303 
1305  LuminosityBlockPrincipal const& lbp,
1306  ProcessContext const* processContext,
1307  ActivityRegistry* activityRegistry) {
1310  lbp.id(),
1311  lbp.runPrincipal().index(),
1312  lbp.index(),
1313  lbp.beginTime(),
1314  processContext);
1315 
1316  using namespace edm::waiting_task;
1317  chain::first([&](auto nextTask) {
1319  CMS_SA_ALLOW try { activityRegistry->preGlobalWriteLumiSignal_(globalContext); } catch (...) {
1320  }
1321  for (auto& c : all_output_communicators_) {
1322  c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1323  }
1324  }) | chain::then(doCleanup([activityRegistry, globalContext, token]() {
1325  //services can depend on other services
1327 
1328  activityRegistry->postGlobalWriteLumiSignal_(globalContext);
1329  })) |
1330  chain::runLast(task);
1331  }
1332 
1334  using std::placeholders::_1;
1335  // Return true iff at least one output module returns true.
1336  return (std::find_if(all_output_communicators_.begin(),
1340  }
1341 
1343  using std::placeholders::_1;
1344  for_all(allWorkers(), std::bind(&Worker::respondToOpenInputFile, _1, std::cref(fb)));
1345  }
1346 
1348  using std::placeholders::_1;
1349  for_all(allWorkers(), std::bind(&Worker::respondToCloseInputFile, _1, std::cref(fb)));
1350  }
1351 
1352  void Schedule::beginJob(ProductRegistry const& iRegistry,
1353  eventsetup::ESRecordsToProxyIndices const& iESIndices,
1354  ProcessBlockHelperBase const& processBlockHelperBase) {
1355  globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1356  }
1357 
1358  void Schedule::beginStream(unsigned int iStreamID) {
1359  assert(iStreamID < streamSchedules_.size());
1360  streamSchedules_[iStreamID]->beginStream();
1361  }
1362 
1363  void Schedule::endStream(unsigned int iStreamID) {
1364  assert(iStreamID < streamSchedules_.size());
1365  streamSchedules_[iStreamID]->endStream();
1366  }
1367 
1369  unsigned int iStreamID,
1371  ServiceToken const& token) {
1372  assert(iStreamID < streamSchedules_.size());
1373  streamSchedules_[iStreamID]->processOneEventAsync(std::move(iTask), info, token, pathStatusInserters_);
1374  }
1375 
1377  ParameterSet const& iPSet,
1378  const ProductRegistry& iRegistry,
1379  eventsetup::ESRecordsToProxyIndices const& iIndices) {
1380  Worker* found = nullptr;
1381  for (auto const& worker : allWorkers()) {
1382  if (worker->description()->moduleLabel() == iLabel) {
1383  found = worker;
1384  break;
1385  }
1386  }
1387  if (nullptr == found) {
1388  return false;
1389  }
1390 
1391  auto newMod = moduleRegistry_->replaceModule(iLabel, iPSet, preallocConfig_);
1392 
1393  globalSchedule_->replaceModule(newMod, iLabel);
1394 
1395  for (auto& s : streamSchedules_) {
1396  s->replaceModule(newMod, iLabel);
1397  }
1398 
1399  {
1400  //Need to updateLookup in order to make getByToken work
1401  auto const processBlockLookup = iRegistry.productLookup(InProcess);
1402  auto const runLookup = iRegistry.productLookup(InRun);
1403  auto const lumiLookup = iRegistry.productLookup(InLumi);
1404  auto const eventLookup = iRegistry.productLookup(InEvent);
1405  found->updateLookup(InProcess, *runLookup);
1406  found->updateLookup(InRun, *runLookup);
1407  found->updateLookup(InLumi, *lumiLookup);
1408  found->updateLookup(InEvent, *eventLookup);
1409  found->updateLookup(iIndices);
1410 
1411  auto const& processName = newMod->moduleDescription().processName();
1412  auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName);
1413  auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
1414  auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
1415  auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
1416  found->resolvePutIndicies(InProcess, processBlockModuleToIndicies);
1417  found->resolvePutIndicies(InRun, runModuleToIndicies);
1418  found->resolvePutIndicies(InLumi, lumiModuleToIndicies);
1419  found->resolvePutIndicies(InEvent, eventModuleToIndicies);
1420  }
1421 
1422  return true;
1423  }
1424 
1426  globalSchedule_->deleteModule(iLabel);
1427  for (auto& stream : streamSchedules_) {
1428  stream->deleteModule(iLabel);
1429  }
1430  moduleRegistry_->deleteModule(iLabel, areg->preModuleDestructionSignal_, areg->postModuleDestructionSignal_);
1431  }
1432 
1433  void Schedule::initializeEarlyDelete(std::vector<std::string> const& branchesToDeleteEarly,
1434  edm::ProductRegistry const& preg) {
1435  for (auto& stream : streamSchedules_) {
1436  stream->initializeEarlyDelete(*moduleRegistry(), branchesToDeleteEarly, preg);
1437  }
1438  }
1439 
1440  std::vector<ModuleDescription const*> Schedule::getAllModuleDescriptions() const {
1441  std::vector<ModuleDescription const*> result;
1442  result.reserve(allWorkers().size());
1443 
1444  for (auto const& worker : allWorkers()) {
1445  ModuleDescription const* p = worker->description();
1446  result.push_back(p);
1447  }
1448  return result;
1449  }
1450 
1451  Schedule::AllWorkers const& Schedule::allWorkers() const { return globalSchedule_->allWorkers(); }
1452 
1454  for (auto const& worker : allWorkers()) {
1455  worker->convertCurrentProcessAlias(processName);
1456  }
1457  }
1458 
1459  void Schedule::availablePaths(std::vector<std::string>& oLabelsToFill) const {
1460  streamSchedules_[0]->availablePaths(oLabelsToFill);
1461  }
1462 
1463  void Schedule::triggerPaths(std::vector<std::string>& oLabelsToFill) const { oLabelsToFill = *pathNames_; }
1464 
1465  void Schedule::endPaths(std::vector<std::string>& oLabelsToFill) const { oLabelsToFill = *endPathNames_; }
1466 
1467  void Schedule::modulesInPath(std::string const& iPathLabel, std::vector<std::string>& oLabelsToFill) const {
1468  streamSchedules_[0]->modulesInPath(iPathLabel, oLabelsToFill);
1469  }
1470 
1472  std::vector<ModuleDescription const*>& descriptions,
1473  unsigned int hint) const {
1474  streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1475  }
1476 
1478  std::vector<ModuleDescription const*>& descriptions,
1479  unsigned int hint) const {
1480  streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1481  }
1482 
1484  std::vector<ModuleDescription const*>& allModuleDescriptions,
1485  std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1486  std::array<std::vector<std::vector<ModuleDescription const*>>, NumBranchTypes>& modulesWhoseProductsAreConsumedBy,
1487  std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1488  ProductRegistry const& preg) const {
1489  allModuleDescriptions.clear();
1490  moduleIDToIndex.clear();
1491  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1492  modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1493  }
1494  modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1495 
1496  allModuleDescriptions.reserve(allWorkers().size());
1497  moduleIDToIndex.reserve(allWorkers().size());
1498  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1499  modulesWhoseProductsAreConsumedBy[iBranchType].resize(allWorkers().size());
1500  }
1501  modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(allWorkers().size());
1502 
1503  std::map<std::string, ModuleDescription const*> labelToDesc;
1504  unsigned int i = 0;
1505  for (auto const& worker : allWorkers()) {
1506  ModuleDescription const* p = worker->description();
1507  allModuleDescriptions.push_back(p);
1508  moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->id(), i));
1509  labelToDesc[p->moduleLabel()] = p;
1510  ++i;
1511  }
1512  sort_all(moduleIDToIndex);
1513 
1514  i = 0;
1515  for (auto const& worker : allWorkers()) {
1516  std::array<std::vector<ModuleDescription const*>*, NumBranchTypes> modules;
1517  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1518  modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(i);
1519  }
1520 
1521  std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1522  modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(i);
1523  try {
1524  worker->modulesWhoseProductsAreConsumed(modules, modulesInPreviousProcesses, preg, labelToDesc);
1525  } catch (cms::Exception& ex) {
1526  ex.addContext("Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1527  worker->description()->moduleLabel());
1528  throw;
1529  }
1530  ++i;
1531  }
1532  }
1533 
1535  rep.eventSummary.totalEvents = 0;
1538  for (auto& s : streamSchedules_) {
1539  s->getTriggerReport(rep);
1540  }
1542  }
1543 
1545  rep.eventSummary.totalEvents = 0;
1546  rep.eventSummary.cpuTime = 0.;
1547  rep.eventSummary.realTime = 0.;
1548  summaryTimeKeeper_->fillTriggerTimingReport(rep);
1549  }
1550 
1552  int returnValue = 0;
1553  for (auto& s : streamSchedules_) {
1554  returnValue += s->totalEvents();
1555  }
1556  return returnValue;
1557  }
1558 
1560  int returnValue = 0;
1561  for (auto& s : streamSchedules_) {
1562  returnValue += s->totalEventsPassed();
1563  }
1564  return returnValue;
1565  }
1566 
1568  int returnValue = 0;
1569  for (auto& s : streamSchedules_) {
1570  returnValue += s->totalEventsFailed();
1571  }
1572  return returnValue;
1573  }
1574 
1576  for (auto& s : streamSchedules_) {
1577  s->clearCounters();
1578  }
1579  }
1580 } // 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:86
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:1451
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Definition: Schedule.cc:1459
void writeProcessBlockAsync(WaitingTaskHolder iTask, ProcessBlockPrincipal const &, ProcessContext const *, ActivityRegistry *)
Definition: Schedule.cc:1274
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:1347
vector< string > vstring
Definition: ExoticaDQM.cc:8
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ModuleRegistry const > moduleRegistry() const
Definition: Schedule.h:297
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:313
void convertCurrentProcessAlias(std::string const &processName)
Convert &quot;@currentProcess&quot; in InputTag process names to the actual current process name...
Definition: Schedule.cc:1453
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:1483
void endStream(unsigned int)
Definition: Schedule.cc:1363
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:1477
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:311
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:1368
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:1567
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
Definition: Schedule.h:306
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:1425
int totalEventsPassed() const
Definition: Schedule.cc:1559
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
Definition: Schedule.cc:1463
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:1352
auto runLast(edm::WaitingTaskHolder iTask)
Definition: chain_first.h:297
std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter > > > pathStatusInserters_
Definition: Schedule.h:301
int totalEvents() const
Definition: Schedule.cc:1551
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:1575
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:889
bool terminate() const
Return whether each output module has reached its maximum count.
Definition: Schedule.cc:930
void respondToOpenInputFile(FileBlock const &fb)
Definition: Schedule.cc:1342
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
Definition: Schedule.h:303
void writeRunAsync(WaitingTaskHolder iTask, RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *)
Definition: Schedule.cc:1241
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:1534
virtual bool shouldWeCloseFile() const =0
Log< level::Info, false > LogInfo
PreallocationConfiguration preallocConfig_
Definition: Schedule.h:309
Log< level::FwkInfo, true > LogFwkVerbatim
PreWriteProcessBlock preWriteProcessBlockSignal_
moduleRegistry_(new ModuleRegistry())
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
Definition: Schedule.h:304
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:308
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:1467
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:1358
void respondToCloseInputFile(FileBlock const &fb)
Definition: Worker.h:174
bool wantSummary_
Definition: Schedule.h:315
std::vector< std::string > const * endPathNames_
Definition: Schedule.h:314
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Definition: Schedule.cc:1440
Strings const & getTrigPaths() const
void initializeEarlyDelete(std::vector< std::string > const &branchesToDeleteEarly, edm::ProductRegistry const &preg)
Definition: Schedule.cc:1433
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:1236
preg
Definition: Schedule.cc:687
void writeLumiAsync(WaitingTaskHolder iTask, LuminosityBlockPrincipal const &lbp, ProcessContext const *, ActivityRegistry *)
Definition: Schedule.cc:1304
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void endJob(ExceptionCollector &collector)
Definition: Schedule.cc:945
void getTriggerTimingReport(TriggerTimingReport &rep) const
Definition: Schedule.cc:1544
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:1333
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry, eventsetup::ESRecordsToProxyIndices const &)
Definition: Schedule.cc:1376
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:1228
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
Definition: Schedule.cc:1465
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1471
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)