56 using std::placeholders::_1;
58 bool binary_search_string(std::vector<std::string>
const&
v,
std::string const&
s) {
59 return std::binary_search(
v.begin(),
v.end(),
s);
65 std::shared_ptr<TriggerResultInserter> makeInserter(
ParameterSet& proc_pset,
66 PreallocationConfiguration
const& iPrealloc,
67 ProductRegistry& preg,
68 ExceptionToActionTable
const&
actions,
69 std::shared_ptr<ActivityRegistry> areg,
70 std::shared_ptr<ProcessConfiguration> processConfiguration) {
71 ParameterSet* trig_pset = proc_pset.getPSetForUpdate(
"@trigger_paths");
72 trig_pset->registerIt();
74 WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration,
actions);
75 ModuleDescription md(trig_pset->id(),
76 "TriggerResultInserter",
78 processConfiguration.get(),
81 areg->preModuleConstructionSignal_(md);
82 bool postCalled =
false;
83 std::shared_ptr<TriggerResultInserter> returnValue;
86 maker::ModuleHolderT<TriggerResultInserter> holder(
87 make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
88 static_cast<Maker const*>(
nullptr));
89 holder.setModuleDescription(md);
90 holder.registerProductsAndCallbacks(&preg);
91 returnValue = holder.module();
94 areg->postModuleConstructionSignal_(md);
97 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
106 template <
typename T>
108 std::vector<std::string>
const& pathNames,
109 PreallocationConfiguration
const& iPrealloc,
110 ProductRegistry& preg,
111 std::shared_ptr<ActivityRegistry> areg,
112 std::shared_ptr<ProcessConfiguration> processConfiguration,
119 pathStatusInserters.reserve(pathNames.size());
121 for (
auto const&
pathName : pathNames) {
122 ModuleDescription md(
125 areg->preModuleConstructionSignal_(md);
126 bool postCalled =
false;
129 maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
130 static_cast<Maker const*>(
nullptr));
131 holder.setModuleDescription(md);
132 holder.registerProductsAndCallbacks(&preg);
133 pathStatusInserters.emplace_back(holder.module());
136 areg->postModuleConstructionSignal_(md);
139 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
148 void checkAndInsertAlias(
std::string const& friendlyClassName,
154 ProductRegistry
const& preg,
155 std::multimap<BranchKey, BranchKey>& aliasMap,
156 std::map<BranchKey, BranchKey>& aliasKeys) {
160 if (preg.productList().find(
key) == preg.productList().end()) {
163 for (
auto const& product : preg.productList()) {
166 <<
"There are no products of type '" << friendlyClassName <<
"'\n"
167 <<
"with module label '" <<
moduleLabel <<
"' and instance name '" << productInstanceName <<
"'.\n";
172 if (
auto iter = aliasMap.find(
key); iter != aliasMap.end()) {
174 if (iter->second.moduleLabel() ==
alias) {
176 <<
"The module label alias '" <<
alias <<
"' is used for multiple products of type '" << friendlyClassName
177 <<
"' with module label '" <<
moduleLabel <<
"' and instance name '" << productInstanceName
178 <<
"'. One alias has the instance name '" << iter->first.productInstanceName()
179 <<
"' and the other has the instance name '" << instanceAlias <<
"'.";
183 std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
184 BranchKey aliasKey(friendlyClassName,
alias, theInstanceAlias,
processName);
185 if (preg.productList().find(aliasKey) != preg.productList().end()) {
187 <<
"A product of type '" << friendlyClassName <<
"'\n"
188 <<
"with module label '" <<
alias <<
"' and instance name '" << theInstanceAlias <<
"'\n"
189 <<
"already exists.\n";
191 auto iter = aliasKeys.find(aliasKey);
192 if (iter != aliasKeys.end()) {
194 if (iter->second !=
key) {
196 <<
"The module label alias '" <<
alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n"
197 <<
"are used for multiple products of type '" << friendlyClassName <<
"'\n"
198 <<
"One has module label '" <<
moduleLabel <<
"' and product instance name '" << productInstanceName
200 <<
"the other has module label '" << iter->second.moduleLabel() <<
"' and product instance name '"
201 << iter->second.productInstanceName() <<
"'.\n";
204 auto prodIter = preg.productList().find(
key);
205 if (prodIter != preg.productList().end()) {
206 if (!prodIter->second.produced()) {
208 <<
"The module label alias '" <<
alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n"
209 <<
"are used for a product of type '" << friendlyClassName <<
"'\n"
210 <<
"with module label '" <<
moduleLabel <<
"' and product instance name '" << productInstanceName
212 <<
"An EDAlias can only be used for products produced in the current process. This one is not.\n";
214 aliasMap.insert(std::make_pair(
key, aliasKey));
215 aliasKeys.insert(std::make_pair(aliasKey,
key));
221 std::vector<std::string> aliases = proc_pset.getParameter<std::vector<std::string>>(
"@all_aliases");
222 if (aliases.empty()) {
232 std::multimap<BranchKey, BranchKey> aliasMap;
234 std::map<BranchKey, BranchKey> aliasKeys;
237 std::multimap<std::string, BranchKey> moduleLabelToBranches;
238 for (
auto const&
prod : preg.productList()) {
240 moduleLabelToBranches.emplace(
prod.first.moduleLabel(),
prod.first);
247 std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<
VParameterSet>();
256 if (friendlyClassName == star) {
257 bool processHasLabel =
false;
259 for (
auto it = moduleLabelToBranches.lower_bound(
moduleLabel);
260 it != moduleLabelToBranches.end() && it->first ==
moduleLabel;
262 processHasLabel =
true;
263 if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
268 checkAndInsertAlias(it->second.friendlyClassName(),
270 it->second.productInstanceName(),
278 if (not
match and processHasLabel) {
284 <<
"There are no products with module label '" <<
moduleLabel <<
"' and product instance name '"
285 << productInstanceName <<
"'.\n";
287 }
else if (productInstanceName == star) {
290 for (ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
291 it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName &&
299 checkAndInsertAlias(friendlyClassName,
301 it->first.productInstanceName(),
312 for (
auto const& product : preg.productList()) {
315 <<
"There are no products of type '" << friendlyClassName <<
"'\n"
321 checkAndInsertAlias(friendlyClassName,
336 for (
auto const& aliasEntry : aliasMap) {
337 ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
338 assert(it != preg.productList().end());
339 preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
343 typedef std::vector<std::string>
vstring;
347 struct BranchesCases {
348 BranchesCases(std::vector<std::string> cases) : caseLabels{
std::move(cases)} {}
349 std::vector<BranchKey> chosenBranches;
350 std::vector<std::string> caseLabels;
352 std::map<std::string, BranchesCases> switchMap;
353 for (
auto&
prod : preg.productListUpdator()) {
354 if (
prod.second.isSwitchAlias()) {
355 auto it = switchMap.find(
prod.second.moduleLabel());
356 if (it == switchMap.end()) {
358 auto inserted = switchMap.emplace(
prod.second.moduleLabel(),
359 switchPSet.getParameter<std::vector<std::string>>(
"@all_cases"));
365 for (
auto const& productIter : preg.productList()) {
366 BranchKey
const& branchKey = productIter.first;
375 BranchDescription
const&
desc = productIter.second;
376 if (
desc.branchType() ==
prod.second.branchType() and
377 desc.unwrappedTypeID().typeInfo() ==
prod.second.unwrappedTypeID().typeInfo() and
378 branchKey.moduleLabel() ==
prod.second.switchAliasModuleLabel() and
379 branchKey.productInstanceName() ==
prod.second.productInstanceName()) {
380 prod.second.setSwitchAliasForBranch(
desc);
381 it->second.chosenBranches.push_back(
prod.first);
387 ex <<
"Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n"
388 <<
" friendly class name = " <<
prod.second.friendlyClassName() <<
"\n"
389 <<
" module label = " <<
prod.second.moduleLabel() <<
"\n"
390 <<
" product instance name = " <<
prod.second.productInstanceName() <<
"\n"
392 <<
"\n\nbut did not find any. Please contact a framework developer.";
393 ex.addContext(
"Calling Schedule.cc:processSwitchProducers()");
398 if (switchMap.empty())
401 for (
auto& elem : switchMap) {
402 std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
406 std::map<std::string, std::vector<BranchKey>> caseBranches;
407 for (
auto const&
item : preg.productList()) {
411 if (
auto found =
std::find(caseLabels.begin(), caseLabels.end(),
item.first.moduleLabel());
412 found != caseLabels.end()) {
413 caseBranches[*
found].push_back(
item.first);
417 for (
auto const& caseLabel : caseLabels) {
418 ex <<
"Products for case " << caseLabel <<
" (friendly class name, product instance name):\n";
419 auto& branches = caseBranches[caseLabel];
420 std::sort(branches.begin(), branches.end());
421 for (
auto const&
branch : branches) {
422 ex <<
" " <<
branch.friendlyClassName() <<
" " <<
branch.productInstanceName() <<
"\n";
429 std::vector<bool> foundBranches;
430 for (
auto const& switchItem : switchMap) {
431 auto const& switchLabel = switchItem.first;
432 auto const& chosenBranches = switchItem.second.chosenBranches;
433 auto const& caseLabels = switchItem.second.caseLabels;
434 foundBranches.resize(chosenBranches.size());
435 for (
auto const& caseLabel : caseLabels) {
436 std::fill(foundBranches.begin(), foundBranches.end(),
false);
437 for (
auto& nonConstItem : preg.productListUpdator()) {
438 auto const&
item = nonConstItem;
448 nonConstItem.second.setTransient(
true);
450 auto range = std::equal_range(chosenBranches.begin(),
451 chosenBranches.end(),
452 BranchKey(
item.first.friendlyClassName(),
454 item.first.productInstanceName(),
455 item.first.processName()));
458 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel <<
" with a product "
459 <<
item.first <<
" that is not produced by the chosen case "
461 .getUntrackedParameter<std::string>(
"@chosen_case")
462 <<
". If the intention is to produce only a subset of the products listed below, each case with "
463 "more products needs to be replaced with an EDAlias to only the necessary products, and the "
464 "EDProducer itself needs to be moved to a Task.\n\n";
465 addProductsToException(caseLabels, ex);
472 auto const&
bd =
item.second;
473 if (not
bd.branchAliases().empty()) {
475 <<
"SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch "
476 "aliases for SwitchProducer with label "
477 << switchLabel <<
" for case " << caseLabel <<
":";
478 for (
auto const& branchAlias :
bd.branchAliases()) {
479 ex <<
" " << branchAlias;
486 for (
size_t i = 0;
i < chosenBranches.size();
i++) {
487 if (not foundBranches[
i]) {
489 .getUntrackedParameter<std::string>(
"@chosen_case");
491 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel
492 <<
" that does not produce a product " << chosenBranches[
i] <<
" that is produced by the chosen case "
494 <<
". If the intention is to produce only a subset of the products listed below, each case with more "
495 "products needs to be replaced with an EDAlias to only the necessary products, and the "
496 "EDProducer itself needs to be moved to a Task.\n\n";
497 addProductsToException(caseLabels, ex);
506 vstring const& end_path_name_list,
508 std::set<std::string>
const& usedModuleLabels,
523 std::string const moduleEdmType(
"@module_edm_type");
529 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
533 vstring scheduledPaths = proc_pset.getParameter<
vstring>(
"@paths");
534 std::set<std::string> modulesOnPaths;
536 std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
537 for (
auto const& endPath : end_path_name_list) {
538 noEndPaths.erase(endPath);
542 for (
auto const&
path : noEndPaths) {
550 std::vector<std::string> labelsToBeDropped;
551 labelsToBeDropped.reserve(modulesInConfigSet.size());
552 std::set_difference(modulesInConfigSet.begin(),
553 modulesInConfigSet.end(),
554 usedModuleLabels.begin(),
555 usedModuleLabels.end(),
556 std::back_inserter(labelsToBeDropped));
558 const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
559 for (
auto const& modLabel : usedModuleLabels) {
563 edmType = proc_pset.getParameterSet(modLabel).getParameter<
std::string>(moduleEdmType);
564 if (edmType == outputModule) {
565 outputModuleLabels.push_back(modLabel);
566 labelsToBeDropped.push_back(modLabel);
568 if (edmType == edAnalyzer) {
569 if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
570 labelsToBeDropped.push_back(modLabel);
577 labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
583 vstring::iterator endAfterRemove =
584 std::remove_if(modulesInConfig.begin(),
585 modulesInConfig.end(),
586 std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
587 modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
593 for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
594 iEndPath != endEndPath;
597 vstring::iterator iSave =
labels.begin();
598 vstring::iterator iBegin =
labels.begin();
600 for (vstring::iterator iLabel =
labels.begin(), iEnd =
labels.end(); iLabel != iEnd; ++iLabel) {
601 if (binary_search_string(labelsToBeDropped, *iLabel)) {
602 if (binary_search_string(outputModuleLabels, *iLabel)) {
603 outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
606 if (iSave != iLabel) {
607 iSave->swap(*iLabel);
615 proc_pset.eraseSimpleParameter(*iEndPath);
616 endPathsToBeDropped.push_back(*iEndPath);
624 endAfterRemove = std::remove_if(scheduledPaths.begin(),
625 scheduledPaths.end(),
626 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
627 scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
631 vstring scheduledEndPaths = proc_pset.getParameter<
vstring>(
"@end_paths");
632 endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
633 scheduledEndPaths.end(),
634 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
635 scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
639 class RngEDConsumer :
public EDConsumerBase {
641 explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
643 if (rng.isAvailable()) {
644 rng->consumes(consumesCollector());
645 for (
auto const& consumesInfo : this->consumesInfo()) {
646 typesConsumed.emplace(consumesInfo.type());
666 std::shared_ptr<ActivityRegistry> areg,
667 std::shared_ptr<ProcessConfiguration> processConfiguration,
668 bool hasSubprocesses,
673 ? std::shared_ptr<TriggerResultInserter>{}
674 : makeInserter(proc_pset, prealloc, preg,
actions, areg, processConfiguration)},
676 all_output_communicators_(),
677 preallocConfig_(prealloc),
678 pathNames_(&tns.getTrigPaths()),
679 endPathNames_(&tns.getEndPaths()),
680 wantSummary_(tns.wantSummary()),
681 endpathsAreActive_(
true) {
682 makePathStatusInserters(pathStatusInserters_,
687 processConfiguration,
690 makePathStatusInserters(endPathStatusInserters_,
695 processConfiguration,
698 assert(0 < prealloc.numberOfStreams());
699 streamSchedules_.reserve(prealloc.numberOfStreams());
700 for (
unsigned int i = 0;
i < prealloc.numberOfStreams(); ++
i) {
701 streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
702 pathStatusInserters_,
703 endPathStatusInserters_,
712 processConfiguration,
720 const std::string kTriggerResults(
"TriggerResults");
721 std::vector<std::string> modulesToUse;
722 modulesToUse.reserve(streamSchedules_[0]->allWorkers().
size());
723 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
724 if (worker->description()->moduleLabel() != kTriggerResults) {
725 modulesToUse.push_back(worker->description()->moduleLabel());
729 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
730 if (nUnscheduledModules > 0) {
731 std::vector<std::string>
temp;
732 temp.reserve(modulesToUse.size());
733 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
734 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(
temp));
735 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(
temp));
736 temp.swap(modulesToUse);
740 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
741 pathStatusInserters_,
742 endPathStatusInserters_,
750 processConfiguration,
755 std::set<std::string> usedModuleLabels;
756 for (
auto const& worker : allWorkers()) {
757 if (worker->description()->moduleLabel() != kTriggerResults) {
758 usedModuleLabels.insert(worker->description()->moduleLabel());
761 std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>(
"@all_modules"));
762 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
763 reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
764 processEDAliases(proc_pset, processConfiguration->processName(), preg);
768 if (nUnscheduledModules > 0) {
769 std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
770 preg.setUnscheduledProducts(unscheduledModules);
773 processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
774 proc_pset.registerIt();
775 processConfiguration->setParameterSetID(proc_pset.id());
776 processConfiguration->setProcessConfigurationID();
780 size_t all_workers_count = allWorkers().size();
782 moduleRegistry_->forAllModuleHolders([
this](maker::ModuleHolder* iHolder) {
783 auto comm = iHolder->createOutputModuleCommunicator();
785 all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
789 limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
793 assert(all_workers_count == allWorkers().
size());
795 branchIDListHelper.updateFromRegistry(preg);
797 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
798 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
801 processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
805 for (
auto&
c : all_output_communicators_) {
806 c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
809 for (
auto& product : preg.productListUpdator()) {
815 std::set<TypeID> productTypesConsumed;
816 std::set<TypeID> elementTypesConsumed;
818 for (
auto const& worker : allWorkers()) {
819 for (
auto const& consumesInfo : worker->consumesInfo()) {
821 productTypesConsumed.emplace(consumesInfo.type());
823 elementTypesConsumed.emplace(consumesInfo.type());
828 if (hasSubprocesses) {
832 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
833 preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
836 for (
auto&
c : all_output_communicators_) {
837 c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
841 std::vector<const ModuleDescription*> modDesc;
842 const auto&
workers = allWorkers();
843 modDesc.reserve(
workers.size());
847 std::back_inserter(modDesc),
848 [](
const Worker* iWorker) ->
const ModuleDescription* {
return iWorker->description(); });
851 summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc, tns, processContext);
852 auto timeKeeperPtr = summaryTimeKeeper_.get();
884 int maxEventSpecs = 0;
885 int maxEventsOut = -1;
892 std::vector<std::string> psetNamesE;
899 if (maxEventSpecs > 1) {
901 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
906 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
912 <<
"\nNo entry in 'maxEvents' for output module label '" <<
moduleLabel <<
"'.\n";
924 if (!
c->limitReached()) {
929 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n"
930 <<
"has reached its configured limit.\n";
954 <<
"---------- Event Summary ------------";
968 <<
"---------- Path Summary ------------";
969 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
970 <<
" " << std::right << std::setw(10) <<
"Executed"
971 <<
" " << std::right << std::setw(10) <<
"Passed"
972 <<
" " << std::right << std::setw(10) <<
"Failed"
973 <<
" " << std::right << std::setw(10) <<
"Error"
978 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
979 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
980 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
981 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
982 <<
p.timesExcept <<
" " <<
p.name <<
"";
1004 <<
"-------End-Path Summary ------------";
1005 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1006 <<
" " << std::right << std::setw(10) <<
"Executed"
1007 <<
" " << std::right << std::setw(10) <<
"Passed"
1008 <<
" " << std::right << std::setw(10) <<
"Failed"
1009 <<
" " << std::right << std::setw(10) <<
"Error"
1014 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1015 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
1016 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
1017 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
1018 <<
p.timesExcept <<
" " <<
p.name <<
"";
1024 <<
"---------- Modules in Path: " <<
p.name <<
" ------------";
1025 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1026 <<
" " << std::right << std::setw(10) <<
"Visited"
1027 <<
" " << std::right << std::setw(10) <<
"Passed"
1028 <<
" " << std::right << std::setw(10) <<
"Failed"
1029 <<
" " << std::right << std::setw(10) <<
"Error"
1034 unsigned int bitpos = 0;
1035 for (
auto const&
mod :
p.moduleInPathSummaries) {
1036 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1037 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1038 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1039 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1040 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1048 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------";
1049 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1050 <<
" " << std::right << std::setw(10) <<
"Visited"
1051 <<
" " << std::right << std::setw(10) <<
"Passed"
1052 <<
" " << std::right << std::setw(10) <<
"Failed"
1053 <<
" " << std::right << std::setw(10) <<
"Error"
1058 unsigned int bitpos = 0;
1059 for (
auto const&
mod :
p.moduleInPathSummaries) {
1060 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1061 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1062 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1063 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1064 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1071 <<
"---------- Module Summary ------------";
1072 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Visited"
1073 <<
" " << std::right << std::setw(10) <<
"Executed"
1074 <<
" " << std::right << std::setw(10) <<
"Passed"
1075 <<
" " << std::right << std::setw(10) <<
"Failed"
1076 <<
" " << std::right << std::setw(10) <<
"Error"
1081 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" "
1082 << std::right << std::setw(10) << worker.timesRun <<
" " << std::right
1083 << std::setw(10) << worker.timesPassed <<
" " << std::right << std::setw(10)
1084 << worker.timesFailed <<
" " << std::right << std::setw(10) << worker.timesExcept
1085 <<
" " << worker.moduleLabel <<
"";
1096 <<
"---------- Event Summary ---[sec]----";
1104 <<
" efficiency CPU/Real/thread = "
1108 constexpr
int kColumn1Size = 10;
1109 constexpr
int kColumn2Size = 12;
1110 constexpr
int kColumn3Size = 12;
1113 <<
"---------- Path Summary ---[Real sec]----";
1114 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1115 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1118 const int timesRun =
std::max(1,
p.timesRun);
1120 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
1121 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1123 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1124 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1130 <<
"-------End-Path Summary ---[Real sec]----";
1131 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1132 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1136 const int timesRun =
std::max(1,
p.timesRun);
1139 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
1140 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1142 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1143 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1150 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----";
1151 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1152 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1155 for (
auto const&
mod :
p.moduleInPathSummaries) {
1157 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
1158 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1159 <<
mod.moduleLabel <<
"";
1163 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1164 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1171 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----";
1172 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1173 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1176 for (
auto const&
mod :
p.moduleInPathSummaries) {
1178 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
1179 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1180 <<
mod.moduleLabel <<
"";
1184 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1185 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1191 <<
"---------- Module Summary ---[Real sec]----";
1192 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1193 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1194 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1199 << std::setw(kColumn1Size) << worker.realTime /
totalEvents <<
" " << std::right
1200 << std::setw(kColumn2Size) << worker.realTime /
std::max(1, worker.timesRun) <<
" "
1201 << std::right << std::setw(kColumn3Size)
1202 << worker.realTime /
std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel
1205 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1206 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1207 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1218 using std::placeholders::_1;
1221 worker->respondToCloseOutputFile();
1226 using std::placeholders::_1;
1252 std::exception_ptr ptr;
1256 task.doneWaiting(ptr);
1264 c->writeRunAsync(tHolder, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1290 std::exception_ptr ptr;
1294 task.doneWaiting(ptr);
1302 c->writeProcessBlockAsync(tHolder, pbp, processContext, activityRegistry);
1328 std::exception_ptr ptr;
1332 task.doneWaiting(ptr);
1339 c->writeLumiAsync(tHolder, lbp, processContext, activityRegistry);
1344 using std::placeholders::_1;
1353 using std::placeholders::_1;
1358 using std::placeholders::_1;
1365 globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1379 unsigned int iStreamID,
1392 if (worker->description()->moduleLabel() == iLabel) {
1397 if (
nullptr ==
found) {
1406 s->replaceModule(newMod, iLabel);
1419 found->updateLookup(iIndices);
1421 auto const&
processName = newMod->moduleDescription().processName();
1422 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(
processName);
1423 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(
processName);
1424 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(
processName);
1425 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(
processName);
1426 found->resolvePutIndicies(
InProcess, processBlockModuleToIndicies);
1427 found->resolvePutIndicies(
InRun, runModuleToIndicies);
1428 found->resolvePutIndicies(
InLumi, lumiModuleToIndicies);
1429 found->resolvePutIndicies(
InEvent, eventModuleToIndicies);
1438 stream->deleteModule(iLabel);
1444 std::vector<ModuleDescription const*>
result;
1475 std::vector<ModuleDescription const*>& descriptions,
1476 unsigned int hint)
const {
1477 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1481 std::vector<ModuleDescription const*>& descriptions,
1482 unsigned int hint)
const {
1483 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1487 std::vector<ModuleDescription const*>& allModuleDescriptions,
1488 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1490 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1492 allModuleDescriptions.clear();
1493 moduleIDToIndex.clear();
1494 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1495 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1497 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1501 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1502 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().
size());
1504 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().
size());
1506 std::map<std::string, ModuleDescription const*> labelToDesc;
1510 allModuleDescriptions.push_back(
p);
1511 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(
p->id(),
i));
1512 labelToDesc[
p->moduleLabel()] =
p;
1520 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1521 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(
i);
1524 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1525 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(
i);
1527 worker->modulesWhoseProductsAreConsumed(
modules, modulesInPreviousProcesses, preg, labelToDesc);
1529 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1530 worker->description()->moduleLabel());
1540 s->enableEndPaths(active);
1547 rep.eventSummary.totalEvents = 0;
1548 rep.eventSummary.totalEventsPassed = 0;
1549 rep.eventSummary.totalEventsFailed = 0;
1551 s->getTriggerReport(
rep);
1557 rep.eventSummary.totalEvents = 0;
1558 rep.eventSummary.cpuTime = 0.;
1559 rep.eventSummary.realTime = 0.;
1564 int returnValue = 0;
1566 returnValue +=
s->totalEvents();
1572 int returnValue = 0;
1574 returnValue +=
s->totalEventsPassed();
1580 int returnValue = 0;
1582 returnValue +=
s->totalEventsFailed();