55 using std::placeholders::_1;
57 bool binary_search_string(std::vector<std::string>
const&
v,
std::string const&
s) {
58 return std::binary_search(
v.begin(),
v.end(),
s);
64 std::shared_ptr<TriggerResultInserter> makeInserter(
ParameterSet& proc_pset,
65 PreallocationConfiguration
const& iPrealloc,
66 ProductRegistry& preg,
67 ExceptionToActionTable
const&
actions,
68 std::shared_ptr<ActivityRegistry> areg,
69 std::shared_ptr<ProcessConfiguration> processConfiguration) {
70 ParameterSet* trig_pset = proc_pset.getPSetForUpdate(
"@trigger_paths");
71 trig_pset->registerIt();
73 WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration,
actions);
74 ModuleDescription md(trig_pset->id(),
75 "TriggerResultInserter",
77 processConfiguration.get(),
80 areg->preModuleConstructionSignal_(md);
81 bool postCalled =
false;
82 std::shared_ptr<TriggerResultInserter> returnValue;
85 maker::ModuleHolderT<TriggerResultInserter> holder(
86 make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
87 static_cast<Maker const*>(
nullptr));
88 holder.setModuleDescription(md);
89 holder.registerProductsAndCallbacks(&preg);
90 returnValue = holder.module();
93 areg->postModuleConstructionSignal_(md);
96 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
105 template <
typename T>
107 std::vector<std::string>
const& pathNames,
108 PreallocationConfiguration
const& iPrealloc,
109 ProductRegistry& preg,
110 std::shared_ptr<ActivityRegistry> areg,
111 std::shared_ptr<ProcessConfiguration> processConfiguration,
118 pathStatusInserters.reserve(pathNames.size());
120 for (
auto const&
pathName : pathNames) {
121 ModuleDescription md(
124 areg->preModuleConstructionSignal_(md);
125 bool postCalled =
false;
128 maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
129 static_cast<Maker const*>(
nullptr));
130 holder.setModuleDescription(md);
131 holder.registerProductsAndCallbacks(&preg);
132 pathStatusInserters.emplace_back(holder.module());
135 areg->postModuleConstructionSignal_(md);
138 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
147 void checkAndInsertAlias(
std::string const& friendlyClassName,
153 ProductRegistry
const& preg,
154 std::multimap<BranchKey, BranchKey>& aliasMap,
155 std::map<BranchKey, BranchKey>& aliasKeys) {
159 if (preg.productList().find(
key) == preg.productList().end()) {
162 for (
auto const& product : preg.productList()) {
165 <<
"There are no products of type '" << friendlyClassName <<
"'\n"
166 <<
"with module label '" <<
moduleLabel <<
"' and instance name '" << productInstanceName <<
"'.\n";
171 if (
auto iter = aliasMap.find(
key); iter != aliasMap.end()) {
173 if (iter->second.moduleLabel() ==
alias) {
175 <<
"The module label alias '" <<
alias <<
"' is used for multiple products of type '" << friendlyClassName
176 <<
"' with module label '" <<
moduleLabel <<
"' and instance name '" << productInstanceName
177 <<
"'. One alias has the instance name '" << iter->first.productInstanceName()
178 <<
"' and the other has the instance name '" << instanceAlias <<
"'.";
182 std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
183 BranchKey aliasKey(friendlyClassName,
alias, theInstanceAlias,
processName);
184 if (preg.productList().find(aliasKey) != preg.productList().end()) {
186 <<
"A product of type '" << friendlyClassName <<
"'\n"
187 <<
"with module label '" <<
alias <<
"' and instance name '" << theInstanceAlias <<
"'\n"
188 <<
"already exists.\n";
190 auto iter = aliasKeys.find(aliasKey);
191 if (iter != aliasKeys.end()) {
193 if (iter->second !=
key) {
195 <<
"The module label alias '" <<
alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n"
196 <<
"are used for multiple products of type '" << friendlyClassName <<
"'\n"
197 <<
"One has module label '" <<
moduleLabel <<
"' and product instance name '" << productInstanceName
199 <<
"the other has module label '" << iter->second.moduleLabel() <<
"' and product instance name '"
200 << iter->second.productInstanceName() <<
"'.\n";
203 auto prodIter = preg.productList().find(
key);
204 if (prodIter != preg.productList().end()) {
205 if (!prodIter->second.produced()) {
207 <<
"The module label alias '" <<
alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n"
208 <<
"are used for a product of type '" << friendlyClassName <<
"'\n"
209 <<
"with module label '" <<
moduleLabel <<
"' and product instance name '" << productInstanceName
211 <<
"An EDAlias can only be used for products produced in the current process. This one is not.\n";
213 aliasMap.insert(std::make_pair(
key, aliasKey));
214 aliasKeys.insert(std::make_pair(aliasKey,
key));
220 std::vector<std::string> aliases = proc_pset.getParameter<std::vector<std::string>>(
"@all_aliases");
221 if (aliases.empty()) {
231 std::multimap<BranchKey, BranchKey> aliasMap;
233 std::map<BranchKey, BranchKey> aliasKeys;
236 std::multimap<std::string, BranchKey> moduleLabelToBranches;
237 for (
auto const&
prod : preg.productList()) {
239 moduleLabelToBranches.emplace(
prod.first.moduleLabel(),
prod.first);
246 std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<
VParameterSet>();
255 if (friendlyClassName == star) {
256 bool processHasLabel =
false;
258 for (
auto it = moduleLabelToBranches.lower_bound(
moduleLabel);
259 it != moduleLabelToBranches.end() && it->first ==
moduleLabel;
261 processHasLabel =
true;
262 if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
267 checkAndInsertAlias(it->second.friendlyClassName(),
269 it->second.productInstanceName(),
277 if (not
match and processHasLabel) {
283 <<
"There are no products with module label '" <<
moduleLabel <<
"' and product instance name '"
284 << productInstanceName <<
"'.\n";
286 }
else if (productInstanceName == star) {
289 for (ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
290 it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName &&
298 checkAndInsertAlias(friendlyClassName,
300 it->first.productInstanceName(),
311 for (
auto const& product : preg.productList()) {
314 <<
"There are no products of type '" << friendlyClassName <<
"'\n"
320 checkAndInsertAlias(friendlyClassName,
335 for (
auto const& aliasEntry : aliasMap) {
336 ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
337 assert(it != preg.productList().end());
338 preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
342 typedef std::vector<std::string>
vstring;
346 struct BranchesCases {
347 BranchesCases(std::vector<std::string> cases) : caseLabels{
std::move(cases)} {}
348 std::vector<BranchKey> chosenBranches;
349 std::vector<std::string> caseLabels;
351 std::map<std::string, BranchesCases> switchMap;
352 for (
auto&
prod : preg.productListUpdator()) {
353 if (
prod.second.isSwitchAlias()) {
354 auto it = switchMap.find(
prod.second.moduleLabel());
355 if (it == switchMap.end()) {
357 auto inserted = switchMap.emplace(
prod.second.moduleLabel(),
358 switchPSet.getParameter<std::vector<std::string>>(
"@all_cases"));
364 for (
auto const& productIter : preg.productList()) {
365 BranchKey
const& branchKey = productIter.first;
374 BranchDescription
const&
desc = productIter.second;
375 if (
desc.branchType() ==
prod.second.branchType() and
376 desc.unwrappedTypeID().typeInfo() ==
prod.second.unwrappedTypeID().typeInfo() and
377 branchKey.moduleLabel() ==
prod.second.switchAliasModuleLabel() and
378 branchKey.productInstanceName() ==
prod.second.productInstanceName()) {
379 prod.second.setSwitchAliasForBranch(
desc);
380 it->second.chosenBranches.push_back(
prod.first);
386 ex <<
"Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n"
387 <<
" friendly class name = " <<
prod.second.friendlyClassName() <<
"\n"
388 <<
" module label = " <<
prod.second.moduleLabel() <<
"\n"
389 <<
" product instance name = " <<
prod.second.productInstanceName() <<
"\n"
391 <<
"\n\nbut did not find any. Please contact a framework developer.";
392 ex.addContext(
"Calling Schedule.cc:processSwitchProducers()");
397 if (switchMap.empty())
400 for (
auto& elem : switchMap) {
401 std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
405 std::map<std::string, std::vector<BranchKey>> caseBranches;
406 for (
auto const&
item : preg.productList()) {
410 if (
auto found =
std::find(caseLabels.begin(), caseLabels.end(),
item.first.moduleLabel());
411 found != caseLabels.end()) {
412 caseBranches[*
found].push_back(
item.first);
416 for (
auto const& caseLabel : caseLabels) {
417 ex <<
"Products for case " << caseLabel <<
" (friendly class name, product instance name):\n";
418 auto& branches = caseBranches[caseLabel];
419 std::sort(branches.begin(), branches.end());
420 for (
auto const&
branch : branches) {
421 ex <<
" " <<
branch.friendlyClassName() <<
" " <<
branch.productInstanceName() <<
"\n";
428 std::vector<bool> foundBranches;
429 for (
auto const& switchItem : switchMap) {
430 auto const& switchLabel = switchItem.first;
431 auto const& chosenBranches = switchItem.second.chosenBranches;
432 auto const& caseLabels = switchItem.second.caseLabels;
433 foundBranches.resize(chosenBranches.size());
434 for (
auto const& caseLabel : caseLabels) {
435 std::fill(foundBranches.begin(), foundBranches.end(),
false);
436 for (
auto& nonConstItem : preg.productListUpdator()) {
437 auto const&
item = nonConstItem;
447 nonConstItem.second.setTransient(
true);
449 auto range = std::equal_range(chosenBranches.begin(),
450 chosenBranches.end(),
451 BranchKey(
item.first.friendlyClassName(),
453 item.first.productInstanceName(),
454 item.first.processName()));
457 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel <<
" with a product "
458 <<
item.first <<
" that is not produced by the chosen case "
460 .getUntrackedParameter<std::string>(
"@chosen_case")
461 <<
". If the intention is to produce only a subset of the products listed below, each case with "
462 "more products needs to be replaced with an EDAlias to only the necessary products, and the "
463 "EDProducer itself needs to be moved to a Task.\n\n";
464 addProductsToException(caseLabels, ex);
471 auto const&
bd =
item.second;
472 if (not
bd.branchAliases().empty()) {
474 <<
"SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch "
475 "aliases for SwitchProducer with label "
476 << switchLabel <<
" for case " << caseLabel <<
":";
477 for (
auto const& branchAlias :
bd.branchAliases()) {
478 ex <<
" " << branchAlias;
485 for (
size_t i = 0;
i < chosenBranches.size();
i++) {
486 if (not foundBranches[
i]) {
488 .getUntrackedParameter<std::string>(
"@chosen_case");
490 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel
491 <<
" that does not produce a product " << chosenBranches[
i] <<
" that is produced by the chosen case "
493 <<
". If the intention is to produce only a subset of the products listed below, each case with more "
494 "products needs to be replaced with an EDAlias to only the necessary products, and the "
495 "EDProducer itself needs to be moved to a Task.\n\n";
496 addProductsToException(caseLabels, ex);
505 vstring const& end_path_name_list,
507 std::set<std::string>
const& usedModuleLabels,
522 std::string const moduleEdmType(
"@module_edm_type");
528 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
532 vstring scheduledPaths = proc_pset.getParameter<
vstring>(
"@paths");
533 std::set<std::string> modulesOnPaths;
535 std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
536 for (
auto const& endPath : end_path_name_list) {
537 noEndPaths.erase(endPath);
541 for (
auto const&
path : noEndPaths) {
549 std::vector<std::string> labelsToBeDropped;
550 labelsToBeDropped.reserve(modulesInConfigSet.size());
551 std::set_difference(modulesInConfigSet.begin(),
552 modulesInConfigSet.end(),
553 usedModuleLabels.begin(),
554 usedModuleLabels.end(),
555 std::back_inserter(labelsToBeDropped));
557 const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
558 for (
auto const& modLabel : usedModuleLabels) {
562 edmType = proc_pset.getParameterSet(modLabel).getParameter<
std::string>(moduleEdmType);
563 if (edmType == outputModule) {
564 outputModuleLabels.push_back(modLabel);
565 labelsToBeDropped.push_back(modLabel);
567 if (edmType == edAnalyzer) {
568 if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
569 labelsToBeDropped.push_back(modLabel);
576 labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
582 vstring::iterator endAfterRemove =
583 std::remove_if(modulesInConfig.begin(),
584 modulesInConfig.end(),
585 std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
586 modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
592 for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
593 iEndPath != endEndPath;
596 vstring::iterator iSave =
labels.begin();
597 vstring::iterator iBegin =
labels.begin();
599 for (vstring::iterator iLabel =
labels.begin(), iEnd =
labels.end(); iLabel != iEnd; ++iLabel) {
600 if (binary_search_string(labelsToBeDropped, *iLabel)) {
601 if (binary_search_string(outputModuleLabels, *iLabel)) {
602 outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
605 if (iSave != iLabel) {
606 iSave->swap(*iLabel);
614 proc_pset.eraseSimpleParameter(*iEndPath);
615 endPathsToBeDropped.push_back(*iEndPath);
623 endAfterRemove = std::remove_if(scheduledPaths.begin(),
624 scheduledPaths.end(),
625 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
626 scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
630 vstring scheduledEndPaths = proc_pset.getParameter<
vstring>(
"@end_paths");
631 endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
632 scheduledEndPaths.end(),
633 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
634 scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
638 class RngEDConsumer :
public EDConsumerBase {
640 explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
642 if (rng.isAvailable()) {
643 rng->consumes(consumesCollector());
644 for (
auto const& consumesInfo : this->consumesInfo()) {
645 typesConsumed.emplace(consumesInfo.type());
664 std::shared_ptr<ActivityRegistry> areg,
665 std::shared_ptr<ProcessConfiguration> processConfiguration,
666 bool hasSubprocesses,
671 ? std::shared_ptr<TriggerResultInserter>{}
672 : makeInserter(proc_pset, prealloc, preg,
actions, areg, processConfiguration)},
674 all_output_communicators_(),
675 preallocConfig_(prealloc),
676 pathNames_(&tns.getTrigPaths()),
677 endPathNames_(&tns.getEndPaths()),
678 wantSummary_(tns.wantSummary()),
679 endpathsAreActive_(
true) {
680 makePathStatusInserters(pathStatusInserters_,
685 processConfiguration,
688 makePathStatusInserters(endPathStatusInserters_,
693 processConfiguration,
696 assert(0 < prealloc.numberOfStreams());
697 streamSchedules_.reserve(prealloc.numberOfStreams());
698 for (
unsigned int i = 0;
i < prealloc.numberOfStreams(); ++
i) {
699 streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
700 pathStatusInserters_,
701 endPathStatusInserters_,
710 processConfiguration,
718 const std::string kTriggerResults(
"TriggerResults");
719 std::vector<std::string> modulesToUse;
720 modulesToUse.reserve(streamSchedules_[0]->allWorkers().
size());
721 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
722 if (worker->description()->moduleLabel() != kTriggerResults) {
723 modulesToUse.push_back(worker->description()->moduleLabel());
727 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
728 if (nUnscheduledModules > 0) {
729 std::vector<std::string>
temp;
730 temp.reserve(modulesToUse.size());
731 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
732 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(
temp));
733 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(
temp));
734 temp.swap(modulesToUse);
738 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
739 pathStatusInserters_,
740 endPathStatusInserters_,
748 processConfiguration,
753 std::set<std::string> usedModuleLabels;
754 for (
auto const& worker : allWorkers()) {
755 if (worker->description()->moduleLabel() != kTriggerResults) {
756 usedModuleLabels.insert(worker->description()->moduleLabel());
759 std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>(
"@all_modules"));
760 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
761 reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
762 processEDAliases(proc_pset, processConfiguration->processName(), preg);
766 if (nUnscheduledModules > 0) {
767 std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
768 preg.setUnscheduledProducts(unscheduledModules);
771 processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
772 proc_pset.registerIt();
773 processConfiguration->setParameterSetID(proc_pset.id());
774 processConfiguration->setProcessConfigurationID();
778 size_t all_workers_count = allWorkers().size();
780 moduleRegistry_->forAllModuleHolders([
this](maker::ModuleHolder* iHolder) {
781 auto comm = iHolder->createOutputModuleCommunicator();
783 all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
787 limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
791 assert(all_workers_count == allWorkers().
size());
793 branchIDListHelper.updateFromRegistry(preg);
795 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
796 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
801 for (
auto&
c : all_output_communicators_) {
802 c->selectProducts(preg, thinnedAssociationsHelper);
805 for (
auto& product : preg.productListUpdator()) {
811 std::set<TypeID> productTypesConsumed;
812 std::set<TypeID> elementTypesConsumed;
814 for (
auto const& worker : allWorkers()) {
815 for (
auto const& consumesInfo : worker->consumesInfo()) {
817 productTypesConsumed.emplace(consumesInfo.type());
819 elementTypesConsumed.emplace(consumesInfo.type());
824 if (hasSubprocesses) {
828 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
829 preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
832 for (
auto&
c : all_output_communicators_) {
833 c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
837 std::vector<const ModuleDescription*> modDesc;
838 const auto&
workers = allWorkers();
839 modDesc.reserve(
workers.size());
843 std::back_inserter(modDesc),
844 [](
const Worker* iWorker) ->
const ModuleDescription* {
return iWorker->description(); });
847 summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc, tns, processContext);
848 auto timeKeeperPtr = summaryTimeKeeper_.get();
880 int maxEventSpecs = 0;
881 int maxEventsOut = -1;
888 std::vector<std::string> psetNamesE;
895 if (maxEventSpecs > 1) {
897 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
902 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
908 <<
"\nNo entry in 'maxEvents' for output module label '" <<
moduleLabel <<
"'.\n";
920 if (!
c->limitReached()) {
925 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n"
926 <<
"has reached its configured limit.\n";
950 <<
"---------- Event Summary ------------";
964 <<
"---------- Path Summary ------------";
965 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
966 <<
" " << std::right << std::setw(10) <<
"Executed"
967 <<
" " << std::right << std::setw(10) <<
"Passed"
968 <<
" " << std::right << std::setw(10) <<
"Failed"
969 <<
" " << std::right << std::setw(10) <<
"Error"
974 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
975 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
976 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
977 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
978 <<
p.timesExcept <<
" " <<
p.name <<
"";
1000 <<
"-------End-Path Summary ------------";
1001 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1002 <<
" " << std::right << std::setw(10) <<
"Executed"
1003 <<
" " << std::right << std::setw(10) <<
"Passed"
1004 <<
" " << std::right << std::setw(10) <<
"Failed"
1005 <<
" " << std::right << std::setw(10) <<
"Error"
1010 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1011 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
1012 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
1013 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
1014 <<
p.timesExcept <<
" " <<
p.name <<
"";
1020 <<
"---------- Modules in Path: " <<
p.name <<
" ------------";
1021 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1022 <<
" " << std::right << std::setw(10) <<
"Visited"
1023 <<
" " << std::right << std::setw(10) <<
"Passed"
1024 <<
" " << std::right << std::setw(10) <<
"Failed"
1025 <<
" " << std::right << std::setw(10) <<
"Error"
1030 unsigned int bitpos = 0;
1031 for (
auto const&
mod :
p.moduleInPathSummaries) {
1032 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1033 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1034 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1035 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1036 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1044 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------";
1045 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1046 <<
" " << std::right << std::setw(10) <<
"Visited"
1047 <<
" " << std::right << std::setw(10) <<
"Passed"
1048 <<
" " << std::right << std::setw(10) <<
"Failed"
1049 <<
" " << std::right << std::setw(10) <<
"Error"
1054 unsigned int bitpos = 0;
1055 for (
auto const&
mod :
p.moduleInPathSummaries) {
1056 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1057 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1058 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1059 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1060 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1067 <<
"---------- Module Summary ------------";
1068 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Visited"
1069 <<
" " << std::right << std::setw(10) <<
"Executed"
1070 <<
" " << std::right << std::setw(10) <<
"Passed"
1071 <<
" " << std::right << std::setw(10) <<
"Failed"
1072 <<
" " << std::right << std::setw(10) <<
"Error"
1077 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" "
1078 << std::right << std::setw(10) << worker.timesRun <<
" " << std::right
1079 << std::setw(10) << worker.timesPassed <<
" " << std::right << std::setw(10)
1080 << worker.timesFailed <<
" " << std::right << std::setw(10) << worker.timesExcept
1081 <<
" " << worker.moduleLabel <<
"";
1092 <<
"---------- Event Summary ---[sec]----";
1100 <<
" efficiency CPU/Real/thread = "
1104 constexpr
int kColumn1Size = 10;
1105 constexpr
int kColumn2Size = 12;
1106 constexpr
int kColumn3Size = 12;
1109 <<
"---------- Path Summary ---[Real sec]----";
1110 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1111 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1114 const int timesRun =
std::max(1,
p.timesRun);
1116 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
1117 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1119 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1120 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1126 <<
"-------End-Path Summary ---[Real sec]----";
1127 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1128 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1132 const int timesRun =
std::max(1,
p.timesRun);
1135 << std::setw(kColumn1Size) <<
p.realTime /
totalEvents <<
" " << std::right
1136 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1138 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1139 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1146 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----";
1147 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1148 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1151 for (
auto const&
mod :
p.moduleInPathSummaries) {
1153 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
1154 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1155 <<
mod.moduleLabel <<
"";
1159 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1160 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1167 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----";
1168 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1169 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1172 for (
auto const&
mod :
p.moduleInPathSummaries) {
1174 << std::setw(kColumn1Size) <<
mod.realTime /
totalEvents <<
" " << std::right
1175 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1176 <<
mod.moduleLabel <<
"";
1180 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1181 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1187 <<
"---------- Module Summary ---[Real sec]----";
1188 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1189 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1190 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1195 << std::setw(kColumn1Size) << worker.realTime /
totalEvents <<
" " << std::right
1196 << std::setw(kColumn2Size) << worker.realTime /
std::max(1, worker.timesRun) <<
" "
1197 << std::right << std::setw(kColumn3Size)
1198 << worker.realTime /
std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel
1201 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1202 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1203 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1214 using std::placeholders::_1;
1219 using std::placeholders::_1;
1245 std::exception_ptr ptr;
1249 task.doneWaiting(ptr);
1257 c->writeRunAsync(tHolder, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1283 std::exception_ptr ptr;
1287 task.doneWaiting(ptr);
1295 c->writeProcessBlockAsync(tHolder, pbp, processContext, activityRegistry);
1321 std::exception_ptr ptr;
1325 task.doneWaiting(ptr);
1332 c->writeLumiAsync(tHolder, lbp, processContext, activityRegistry);
1337 using std::placeholders::_1;
1346 using std::placeholders::_1;
1351 using std::placeholders::_1;
1370 unsigned int iStreamID,
1383 if (worker->description()->moduleLabel() == iLabel) {
1388 if (
nullptr ==
found) {
1397 s->replaceModule(newMod, iLabel);
1410 found->updateLookup(iIndices);
1412 auto const&
processName = newMod->moduleDescription().processName();
1413 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(
processName);
1414 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(
processName);
1415 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(
processName);
1416 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(
processName);
1417 found->resolvePutIndicies(
InProcess, processBlockModuleToIndicies);
1418 found->resolvePutIndicies(
InRun, runModuleToIndicies);
1419 found->resolvePutIndicies(
InLumi, lumiModuleToIndicies);
1420 found->resolvePutIndicies(
InEvent, eventModuleToIndicies);
1429 stream->deleteModule(iLabel);
1435 std::vector<ModuleDescription const*>
result;
1466 std::vector<ModuleDescription const*>& descriptions,
1467 unsigned int hint)
const {
1468 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1472 std::vector<ModuleDescription const*>& descriptions,
1473 unsigned int hint)
const {
1474 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1478 std::vector<ModuleDescription const*>& allModuleDescriptions,
1479 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1481 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1483 allModuleDescriptions.clear();
1484 moduleIDToIndex.clear();
1485 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1486 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1488 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1492 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1493 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().
size());
1495 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().
size());
1497 std::map<std::string, ModuleDescription const*> labelToDesc;
1501 allModuleDescriptions.push_back(
p);
1502 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(
p->id(),
i));
1503 labelToDesc[
p->moduleLabel()] =
p;
1511 for (
auto iBranchType = 0
U; iBranchType <
NumBranchTypes; ++iBranchType) {
1512 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(
i);
1515 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1516 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(
i);
1518 worker->modulesWhoseProductsAreConsumed(
modules, modulesInPreviousProcesses, preg, labelToDesc);
1520 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1521 worker->description()->moduleLabel());
1531 s->enableEndPaths(active);
1538 rep.eventSummary.totalEvents = 0;
1539 rep.eventSummary.totalEventsPassed = 0;
1540 rep.eventSummary.totalEventsFailed = 0;
1542 s->getTriggerReport(
rep);
1548 rep.eventSummary.totalEvents = 0;
1549 rep.eventSummary.cpuTime = 0.;
1550 rep.eventSummary.realTime = 0.;
1555 int returnValue = 0;
1557 returnValue +=
s->totalEvents();
1563 int returnValue = 0;
1565 returnValue +=
s->totalEventsPassed();
1571 int returnValue = 0;
1573 returnValue +=
s->totalEventsFailed();