42 #include <fmt/format.h> 52 template <
typename InputIterator,
typename ForwardIterator,
typename Func>
53 void transform_into(InputIterator begin, InputIterator end, ForwardIterator
out, Func
func) {
63 template <
typename FROM,
typename TO,
typename FUNC>
64 void fill_summary(FROM
const& from, TO&
to, FUNC
func) {
65 if (
to.size() != from.size()) {
67 transform_into(from.begin(), from.end(),
temp.begin(),
func);
70 transform_into(from.begin(), from.end(),
to.begin(),
func);
80 std::shared_ptr<ActivityRegistry> areg,
81 std::shared_ptr<TriggerResultInserter> inserter) {
84 ptr->setActivityRegistry(areg);
88 void initializeBranchToReadingWorker(std::vector<std::string>
const& branchesToDeleteEarly,
89 ProductRegistry
const& preg,
90 std::multimap<std::string, Worker*>& branchToReadingWorker) {
91 auto vBranchesToDeleteEarly = branchesToDeleteEarly;
93 std::sort(vBranchesToDeleteEarly.begin(), vBranchesToDeleteEarly.end(), std::less<std::string>());
94 vBranchesToDeleteEarly.erase(
std::unique(vBranchesToDeleteEarly.begin(), vBranchesToDeleteEarly.end()),
95 vBranchesToDeleteEarly.end());
98 auto allBranchNames = preg.allBranchNames();
100 for (
auto&
b : allBranchNames) {
101 b.resize(
b.size() - 1);
103 std::sort(allBranchNames.begin(), allBranchNames.end(), std::less<std::string>());
104 std::vector<std::string>
temp;
105 temp.reserve(vBranchesToDeleteEarly.size());
108 vBranchesToDeleteEarly.end(),
109 allBranchNames.begin(),
110 allBranchNames.end(),
111 std::back_inserter(
temp));
112 vBranchesToDeleteEarly.swap(
temp);
113 if (
temp.size() != vBranchesToDeleteEarly.size()) {
114 std::vector<std::string> missingProducts;
117 vBranchesToDeleteEarly.begin(),
118 vBranchesToDeleteEarly.end(),
119 std::back_inserter(missingProducts));
120 LogInfo l(
"MissingProductsForCanDeleteEarly");
121 l <<
"The following products in the 'canDeleteEarly' list are not available in this job and will be ignored.";
122 for (
auto const&
n : missingProducts) {
128 for (
auto const&
branch : vBranchesToDeleteEarly) {
129 branchToReadingWorker.insert(std::make_pair(
branch, static_cast<Worker*>(
nullptr)));
135 WorkerManager& workerManager,
136 ProductRegistry& preg,
137 PreallocationConfiguration
const* prealloc,
138 std::shared_ptr<ProcessConfiguration const> processConfiguration) {
141 if (modpset ==
nullptr) {
146 return workerManager.getWorker(*modpset, preg, prealloc, processConfiguration,
moduleLabel);
155 template <
typename T>
156 auto findConditionalTaskModulesRange(
T& modnames) {
157 auto beg =
std::find(modnames.begin(), modnames.end(),
"#");
158 if (beg == modnames.end()) {
159 return std::pair(modnames.end(), modnames.end());
161 return std::pair(beg + 1, std::prev(modnames.end()));
164 std::optional<std::string> findBestMatchingAlias(
165 std::unordered_multimap<std::string, edm::BranchDescription const*>
const& conditionalModuleBranches,
166 std::unordered_multimap<std::string, StreamSchedule::AliasInfo>
const& aliasMap,
168 ConsumesInfo
const& consumesInfo) {
169 std::optional<std::string>
best;
171 bool bestIsAmbiguous =
false;
173 auto updateBest = [&
best, &wildcardsInBest, &bestIsAmbiguous](
175 int const wildcards =
static_cast<int>(instanceIsWildcard) + static_cast<int>(typeIsWildcard);
176 if (wildcards == 0) {
177 bestIsAmbiguous =
false;
180 if (not best
or wildcards < wildcardsInBest) {
182 wildcardsInBest = wildcards;
183 bestIsAmbiguous =
false;
184 }
else if (best and *best !=
label and wildcardsInBest == wildcards) {
185 bestIsAmbiguous =
true;
190 auto findAlias = aliasMap.equal_range(productModuleLabel);
191 for (
auto it = findAlias.first;
it != findAlias.second; ++
it) {
193 it->second.instanceLabel !=
"*" ?
it->second.instanceLabel :
it->second.originalInstanceLabel;
194 bool const instanceIsWildcard = (aliasInstanceLabel ==
"*");
195 if (instanceIsWildcard
or consumesInfo.instance() == aliasInstanceLabel) {
196 bool const typeIsWildcard =
it->second.friendlyClassName ==
"*";
197 if (typeIsWildcard
or (consumesInfo.type().friendlyClassName() ==
it->second.friendlyClassName)) {
198 if (updateBest(
it->second.originalModuleLabel, instanceIsWildcard, typeIsWildcard)) {
199 return it->second.originalModuleLabel;
204 auto branches = conditionalModuleBranches.equal_range(productModuleLabel);
205 for (
auto itBranch = branches.first; itBranch != branches.second; ++
it) {
206 if (typeIsWildcard
or itBranch->second->productInstanceName() ==
it->second.originalInstanceLabel) {
208 TypeID(itBranch->second->wrappedType().typeInfo()),
209 itBranch->second->className())) {
210 if (updateBest(
it->second.originalModuleLabel, instanceIsWildcard, typeIsWildcard)) {
211 return it->second.originalModuleLabel;
219 if (bestIsAmbiguous) {
221 <<
"Encountered ambiguity when trying to find a best-matching alias for\n" 222 <<
" friendly class name " << consumesInfo.type().friendlyClassName() <<
"\n" 223 <<
" module label " << productModuleLabel <<
"\n" 224 <<
" product instance name " << consumesInfo.instance() <<
"\n" 225 <<
"when processing EDAliases for modules in ConditionalTasks. Two aliases have the same number of " 227 << wildcardsInBest <<
")";
235 typedef std::vector<std::string>
vstring;
246 std::shared_ptr<ProcessConfiguration const> processConfiguration,
248 std::vector<std::string>
const& trigPathNames) {
249 std::unordered_set<std::string> allConditionalMods;
250 for (
auto const&
pathName : trigPathNames) {
254 auto condRange = findConditionalTaskModulesRange(modnames);
255 if (condRange.first == condRange.second)
259 allConditionalMods.insert(condRange.first, condRange.second);
262 for (
auto const&
cond : allConditionalMods) {
264 (
void)getWorker(
cond, proc_pset, workerManagerLumisAndEvents, preg, prealloc, processConfiguration);
272 if (allConditionalMods.find(
prod.first.moduleLabel()) != allConditionalMods.end()) {
281 std::unordered_set<std::string>
const& conditionalmods)
const {
282 std::unordered_multimap<std::string, edm::BranchDescription const*>
ret;
283 for (
auto const&
mod : conditionalmods) {
292 auto aliases = proc_pset.
getParameter<std::vector<std::string>>(
"@all_aliases");
294 for (
auto const&
alias : aliases) {
296 auto aliasedToModuleLabels =
info.getParameterNames();
297 for (
auto const&
mod : aliasedToModuleLabels) {
298 if (not
mod.empty() and
mod[0] !=
'@' and allConditionalMods.find(
mod) != allConditionalMods.end()) {
299 auto aliasVPSet =
info.getParameter<std::vector<edm::ParameterSet>>(
mod);
300 for (
auto const& aliasPSet : aliasVPSet) {
304 if (aliasPSet.exists(
"type")) {
307 if (aliasPSet.exists(
"toProductInstance")) {
310 if (aliasPSet.exists(
"fromProductInstance")) {
311 originalInstance = aliasPSet.getParameter<
std::string>(
"fromProductInstance");
324 std::unordered_set<std::string>
const& allConditionalMods) {
325 auto const& all_modules = proc_pset.
getParameter<std::vector<std::string>>(
"@all_modules");
326 std::vector<std::string> switchEDAliases;
327 for (
auto const&
module : all_modules) {
329 if (mod_pset.getParameter<
std::string>(
"@module_type") ==
"SwitchProducer") {
330 auto const& all_cases = mod_pset.
getParameter<std::vector<std::string>>(
"@all_cases");
331 for (
auto const& case_label : all_cases) {
334 switchEDAliases.push_back(case_label);
340 switchEDAliases, allConditionalMods, proc_pset, processConfiguration.
processName(), preg);
343 std::unordered_multimap<std::string, AliasInfo>
aliasMap_;
350 std::shared_ptr<TriggerResultInserter> inserter,
353 std::shared_ptr<ModuleRegistry> modReg,
359 std::shared_ptr<ActivityRegistry> areg,
360 std::shared_ptr<ProcessConfiguration const> processConfiguration,
363 : workerManagerBeginEnd_(modReg, areg,
actions),
364 workerManagerRuns_(modReg, areg,
actions),
365 workerManagerLumisAndEvents_(modReg, areg,
actions),
373 number_of_unscheduled_modules_(0),
375 streamContext_(streamID_, processContext) {
376 bool hasPath =
false;
377 std::vector<std::string>
const& pathNames = tns.
getTrigPaths();
378 std::vector<std::string>
const& endPathNames = tns.
getEndPaths();
382 std::unordered_set<std::string> conditionalModules;
386 for (
auto const& trig_name : pathNames) {
390 processConfiguration,
395 conditionalTaskHelper,
412 for (
auto const& end_path_name : endPathNames) {
416 processConfiguration,
420 conditionalTaskHelper,
428 std::set<std::string> usedWorkerLabels;
430 usedWorkerLabels.insert(worker->description()->moduleLabel());
432 std::vector<std::string> modulesInConfig(proc_pset.
getParameter<std::vector<std::string>>(
"@all_modules"));
433 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
434 std::vector<std::string> unusedLabels;
436 modulesInConfigSet.end(),
437 usedWorkerLabels.begin(),
438 usedWorkerLabels.end(),
439 back_inserter(unusedLabels));
440 std::set<std::string> unscheduledLabels;
441 std::vector<std::string> shouldBeUsedLabels;
442 if (!unusedLabels.empty()) {
447 for (
auto const&
label : unusedLabels) {
451 assert(modulePSet !=
nullptr);
453 *modulePSet, preg, &prealloc, processConfiguration,
label, unscheduledLabels, shouldBeUsedLabels);
455 if (!shouldBeUsedLabels.empty()) {
456 std::ostringstream unusedStream;
457 unusedStream <<
"'" << shouldBeUsedLabels.front() <<
"'";
458 for (std::vector<std::string>::iterator itLabel = shouldBeUsedLabels.begin() + 1,
459 itLabelEnd = shouldBeUsedLabels.end();
460 itLabel != itLabelEnd;
462 unusedStream <<
",'" << *itLabel <<
"'";
464 LogInfo(
"path") <<
"The following module labels are not assigned to any path:\n" << unusedStream.str() <<
"\n";
470 if (
streamID.
value() == 0 and not conditionalModules.empty()) {
475 std::vector<std::string_view> labelsToPrint;
477 unscheduledLabels.begin(),
478 unscheduledLabels.end(),
479 std::back_inserter(labelsToPrint),
480 [&conditionalModules](
auto const& lab) {
return conditionalModules.find(lab) != conditionalModules.end(); });
482 if (not labelsToPrint.empty()) {
484 log <<
"The following modules were part of some ConditionalTask, but were not\n" 485 <<
"consumed by any other module in any of the Paths to which the ConditionalTask\n" 486 <<
"was associated. Perhaps they should be either removed from the\n" 487 <<
"job, or moved to a Task to make it explicit they are unscheduled.\n";
488 for (
auto const& modLabel : labelsToPrint) {
489 log.format(
"\n {}", modLabel);
504 if (workerBeginEnd) {
517 std::vector<std::string>
const& branchesToDeleteEarly,
518 std::multimap<std::string, std::string>
const& referencesToBranches,
519 std::vector<std::string>
const& modulesToSkip,
522 std::multimap<std::string, Worker*> branchToReadingWorker;
523 initializeBranchToReadingWorker(branchesToDeleteEarly, preg, branchToReadingWorker);
525 const std::vector<std::string>
kEmpty;
526 std::map<Worker*, unsigned int> reserveSizeForWorker;
527 unsigned int upperLimitOnReadingWorker = 0;
528 unsigned int upperLimitOnIndicies = 0;
529 unsigned int nUniqueBranchesToDelete = branchToReadingWorker.size();
535 if (!branchToReadingWorker.empty()) {
541 auto found = branchToReadingWorker.equal_range(
desc.branchName());
543 --nUniqueBranchesToDelete;
544 branchToReadingWorker.erase(
found.first,
found.second);
551 if (branchToReadingWorker.empty()) {
555 std::unordered_set<std::string> modulesToExclude(modulesToSkip.begin(), modulesToSkip.end());
557 if (modulesToExclude.end() != modulesToExclude.find(
w->description()->moduleLabel())) {
561 auto consumes =
w->consumesInfo();
562 if (not consumes.empty()) {
563 bool foundAtLeastOneMatchingBranch =
false;
564 for (
auto const& product : consumes) {
566 product.type().friendlyClassName(),
567 product.label().data(),
568 product.instance().data(),
569 product.process().data());
572 auto found = branchToReadingWorker.end();
573 if (product.process().empty()) {
574 auto startFound = branchToReadingWorker.lower_bound(
branch);
575 if (startFound != branchToReadingWorker.end()) {
576 if (startFound->first.substr(0,
branch.size()) ==
branch) {
582 auto exactFound = branchToReadingWorker.equal_range(
branch);
583 if (exactFound.first != exactFound.second) {
584 found = exactFound.first;
587 if (
found != branchToReadingWorker.end()) {
588 if (not foundAtLeastOneMatchingBranch) {
589 ++upperLimitOnReadingWorker;
590 foundAtLeastOneMatchingBranch =
true;
592 ++upperLimitOnIndicies;
593 ++reserveSizeForWorker[
w];
594 if (
nullptr ==
found->second) {
597 branchToReadingWorker.insert(make_pair(
found->first,
w));
603 auto found = referencesToBranches.end();
604 if (product.process().empty()) {
605 auto startFound = referencesToBranches.lower_bound(
branch);
606 if (startFound != referencesToBranches.end()) {
607 if (startFound->first.substr(0,
branch.size()) ==
branch) {
614 auto exactFound = referencesToBranches.equal_range(
branch);
615 if (exactFound.first != exactFound.second) {
616 found = exactFound.first;
619 if (
found != referencesToBranches.end()) {
620 for (
auto itr =
found; (itr != referencesToBranches.end()) and (itr->first ==
found->first); ++itr) {
621 auto foundInBranchToReadingWorker = branchToReadingWorker.find(itr->second);
622 if (foundInBranchToReadingWorker == branchToReadingWorker.end()) {
625 if (not foundAtLeastOneMatchingBranch) {
626 ++upperLimitOnReadingWorker;
627 foundAtLeastOneMatchingBranch =
true;
629 ++upperLimitOnIndicies;
630 ++reserveSizeForWorker[
w];
631 if (
nullptr == foundInBranchToReadingWorker->second) {
632 foundInBranchToReadingWorker->second =
w;
634 branchToReadingWorker.insert(make_pair(itr->second,
w));
643 auto it = branchToReadingWorker.begin();
644 std::vector<std::string> unusedBranches;
645 while (
it != branchToReadingWorker.end()) {
646 if (
it->second ==
nullptr) {
647 unusedBranches.push_back(
it->first);
651 branchToReadingWorker.erase(
temp);
656 if (not unusedBranches.empty()) {
658 l <<
"The following products in the 'canDeleteEarly' list are not used in this job and will be ignored.\n" 659 " If possible, remove the producer from the job.";
660 for (
auto const&
n : unusedBranches) {
665 if (!branchToReadingWorker.empty()) {
669 std::map<const Worker*, EarlyDeleteHelper*> alreadySeenWorkers;
671 size_t nextOpenIndex = 0;
673 for (
auto& branchAndWorker : branchToReadingWorker) {
674 if (lastBranchName != branchAndWorker.first) {
676 BranchID bid(branchAndWorker.first +
".");
678 lastBranchName = branchAndWorker.first;
680 auto found = alreadySeenWorkers.find(branchAndWorker.second);
681 if (alreadySeenWorkers.end() ==
found) {
686 size_t index = nextOpenIndex;
687 size_t nIndices = reserveSizeForWorker[branchAndWorker.second];
692 alreadySeenWorkers.insert(std::make_pair(branchAndWorker.second, &(
earlyDeleteHelpers_.back())));
693 nextOpenIndex += nIndices;
703 if (itLast->end() !=
it->begin()) {
705 unsigned int delta =
it->begin() - itLast->end();
720 p.setEarlyDeleteHelpers(alreadySeenWorkers);
723 p.setEarlyDeleteHelpers(alreadySeenWorkers);
731 std::unordered_set<std::string>& conditionalModules,
732 std::unordered_multimap<std::string, edm::BranchDescription const*>
const& conditionalModuleBranches,
733 std::unordered_multimap<std::string, AliasInfo>
const& aliasMap,
737 std::shared_ptr<ProcessConfiguration const> processConfiguration) {
738 std::vector<Worker*> returnValue;
741 using namespace productholderindexhelper;
742 for (
auto const& ci : consumesInfo) {
743 if (not ci.skipCurrentProcess() and
744 (ci.process().empty()
or ci.process() == processConfiguration->processName())) {
746 bool productFromConditionalModule =
false;
747 auto itFound = conditionalModules.find(productModuleLabel);
748 if (itFound == conditionalModules.end()) {
751 auto foundAlias = findBestMatchingAlias(conditionalModuleBranches, aliasMap, productModuleLabel, ci);
753 productModuleLabel = *foundAlias;
754 productFromConditionalModule =
true;
755 itFound = conditionalModules.find(productModuleLabel);
757 if (itFound == conditionalModules.end()) {
763 auto findBranches = conditionalModuleBranches.equal_range(productModuleLabel);
764 for (
auto itBranch = findBranches.first; itBranch != findBranches.second; ++itBranch) {
765 if (itBranch->second->productInstanceName() == ci.instance()) {
767 if (ci.type() == itBranch->second->unwrappedTypeID()) {
768 productFromConditionalModule =
true;
774 ci.type(),
TypeID(itBranch->second->wrappedType().typeInfo()), itBranch->second->
className())) {
775 productFromConditionalModule =
true;
782 if (productFromConditionalModule) {
783 auto condWorker = getWorker(
787 conditionalModules.erase(itFound);
791 conditionalModuleBranches,
796 processConfiguration);
797 returnValue.insert(returnValue.end(), dependents.begin(), dependents.end());
798 returnValue.push_back(condWorker);
808 std::shared_ptr<ProcessConfiguration const> processConfiguration,
812 std::vector<std::string>
const& endPathNames,
814 std::unordered_set<std::string>& allConditionalModules) {
819 auto condRange = findConditionalTaskModulesRange(modnames);
821 std::unordered_set<std::string> conditionalmods;
823 std::unordered_multimap<std::string, edm::BranchDescription const*> conditionalModsBranches;
824 std::unordered_map<std::string, unsigned int> conditionalModOrder;
825 if (condRange.first != condRange.second) {
826 for (
auto it = condRange.first;
it != condRange.second; ++
it) {
828 conditionalModOrder.emplace(*
it,
it - modnames.begin() - 1);
831 conditionalmods = std::unordered_set<std::string>(std::make_move_iterator(condRange.first),
832 std::make_move_iterator(condRange.second));
835 modnames.erase(std::prev(condRange.first), modnames.end());
838 allConditionalModules.insert(conditionalmods.begin(), conditionalmods.end());
841 unsigned int placeInPath = 0;
842 for (
auto const&
name : modnames) {
844 bool doNotRunConcurrently =
false;
846 if (
name[0] ==
'!') {
848 }
else if (
name[0] ==
'-' or name[0] ==
'+') {
853 doNotRunConcurrently =
true;
863 if (worker ==
nullptr) {
869 <<
"The unknown module label \"" <<
moduleLabel <<
"\" appears in " << pathType <<
" \"" <<
pathName 870 <<
"\"\n please check spelling or remove that label from the path.";
881 <<
"' with module label '" <<
moduleLabel <<
"' appears on EndPath '" 883 <<
"The return value of the filter will be ignored.\n" 884 <<
"To suppress this warning, either remove the filter from the endpath,\n" 885 <<
"or explicitly ignore it in the configuration by using cms.ignore().\n";
888 bool runConcurrently = not doNotRunConcurrently;
890 runConcurrently =
false;
895 conditionalModsBranches,
900 processConfiguration);
901 for (
auto condMod : condModules) {
902 tmpworkers.emplace_back(
903 condMod,
WorkerInPath::Ignore, conditionalModOrder[condMod->description()->moduleLabel()],
true);
906 tmpworkers.emplace_back(worker, filterAction, placeInPath, runConcurrently);
910 out.swap(tmpworkers);
916 std::shared_ptr<ProcessConfiguration const> processConfiguration,
920 std::vector<std::string>
const& endPathNames,
922 std::unordered_set<std::string>& allConditionalModules) {
927 processConfiguration,
932 conditionalTaskHelper,
933 allConditionalModules);
936 if (!tmpworkers.empty()) {
950 std::shared_ptr<ProcessConfiguration const> processConfiguration,
953 std::vector<std::string>
const& endPathNames,
955 std::unordered_set<std::string>& allConditionalModules) {
960 processConfiguration,
965 conditionalTaskHelper,
966 allConditionalModules);
968 if (!tmpworkers.empty()) {
991 if (worker->description()->moduleLabel() == iLabel) {
999 if (worker->description()->moduleLabel() == iLabel) {
1006 if (worker->description()->moduleLabel() == iLabel) {
1020 std::vector<ModuleDescription const*>
result;
1056 results_->at(empty_trig_path) = hltPathStatus;
1057 pathStatusInserters[empty_trig_path]->setPathStatus(
streamID_, hltPathStatus);
1068 std::exception_ptr except =
1082 auto pathErrorHolder = std::make_unique<std::atomic<std::exception_ptr*>>(
nullptr);
1083 auto pathErrorPtr = pathErrorHolder.get();
1086 [iTask,
this, weakToken, pathError =
std::move(pathErrorHolder)](std::exception_ptr
const* iPtr)
mutable {
1089 std::exception_ptr ptr;
1090 if (pathError->load()) {
1091 ptr = *pathError->load();
1092 delete pathError->load();
1094 if ((not ptr) and iPtr) {
1104 auto pathsDone =
make_waiting_task([allPathsHolder, pathErrorPtr, transitionInfo =
info,
this, weakToken](
1105 std::exception_ptr
const* iPtr)
mutable {
1111 pathErrorPtr->store(
new std::exception_ptr(*iPtr));
1149 *(iExcept.load()) = std::exception_ptr();
1151 *(iExcept.load()) = std::current_exception();
1154 *(iExcept.load()) = std::current_exception();
1158 if ((not iExcept) and
results_->accept()) {
1172 std::rethrow_exception(expt);
1177 std::ostringstream ost;
1178 ost <<
"Processing Event " <<
info.principal().id();
1181 iExcept.store(
new std::exception_ptr(std::current_exception()));
1185 iExcept.store(
new std::exception_ptr(std::current_exception()));
1189 std::exception_ptr ptr;
1191 ptr = *iExcept.load();
1204 bool const cleaningUpAfterException =
false;
1210 iExcept = std::current_exception();
1218 iExcept = std::current_exception();
1232 std::back_inserter(oLabelsToFill),
1233 std::bind(&
Path::name, std::placeholders::_1));
1237 TrigPaths::const_iterator itFound = std::find_if(
1240 std::bind(std::equal_to<std::string>(), iPathLabel, std::bind(&
Path::name, std::placeholders::_1)));
1242 oLabelsToFill.reserve(itFound->size());
1243 for (
size_t i = 0;
i < itFound->size(); ++
i) {
1244 oLabelsToFill.push_back(itFound->getWorker(
i)->description()->moduleLabel());
1250 std::vector<ModuleDescription const*>& descriptions,
1251 unsigned int hint)
const {
1252 descriptions.clear();
1254 TrigPaths::const_iterator itFound;
1258 if (itFound->name() == iPathLabel)
1263 itFound = std::find_if(
1266 std::bind(std::equal_to<std::string>(), iPathLabel, std::bind(&
Path::name, std::placeholders::_1)));
1271 descriptions.reserve(itFound->size());
1272 for (
size_t i = 0;
i < itFound->size(); ++
i) {
1273 descriptions.push_back(itFound->getWorker(
i)->description());
1279 std::vector<ModuleDescription const*>& descriptions,
1280 unsigned int hint)
const {
1281 descriptions.clear();
1283 TrigPaths::const_iterator itFound;
1287 if (itFound->name() == iEndPathLabel)
1292 itFound = std::find_if(
1295 std::bind(std::equal_to<std::string>(), iEndPathLabel, std::bind(&
Path::name, std::placeholders::_1)));
1300 descriptions.reserve(itFound->size());
1301 for (
size_t i = 0;
i < itFound->size(); ++
i) {
1302 descriptions.push_back(itFound->getWorker(
i)->description());
1326 std::vector<ModuleInPathSummary>
temp(sz);
1327 for (
size_t i = 0;
i != sz; ++
i) {
1333 for (
size_t i = 0;
i != sz; ++
i) {
1361 using std::placeholders::_1;
1391 unsigned int indexEmpty = 0;
1392 unsigned int indexOfPath = 0;
1393 for (
auto& pathStatusInserter : pathStatusInserters) {
1394 std::shared_ptr<PathStatusInserter> inserterPtr =
get_underlying(pathStatusInserter);
1398 workerPtr->setActivityRegistry(
actReg_);
1407 trig_paths_.at(indexOfPath).setPathStatusInserter(inserterPtr.get(), workerPtr.get());
1416 for (
auto& endPathStatusInserter : endPathStatusInserters) {
1417 std::shared_ptr<EndPathStatusInserter> inserterPtr =
get_underlying(endPathStatusInserter);
1421 workerPtr->setActivityRegistry(
actReg_);
1430 end_paths_.at(indexOfPath).setPathStatusInserter(
nullptr, workerPtr.get());
1439 bool cleaningUpAfterException,
1440 std::exception_ptr& excpt)
const noexcept {
1445 std::ostringstream ost;
1453 excpt = std::current_exception();
static void fillModuleInPathSummary(Path const &path, size_t which, ModuleInPathSummary &sum)
void initializeEarlyDelete(ModuleRegistry &modReg, std::vector< std::string > const &branchesToDeleteEarly, std::multimap< std::string, std::string > const &referencesToBranches, std::vector< std::string > const &modulesToSkip, edm::ProductRegistry const &preg)
AllWorkers const & allWorkersBeginEnd() const
returns the collection of pointers to workers
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const *> &descriptions, unsigned int hint) const
ExceptionToActionTable const & actionTable() const
returns the action table
T getParameter(std::string const &) const
std::vector< int > empty_trig_paths_
roAction_t actions[nactions]
void exceptionContext(cms::Exception &, ESModuleCallingContext const &)
std::vector< edm::propagate_const< WorkerPtr > > pathStatusInserterWorkers_
void fillWorkers(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &name, bool ignoreFilters, PathWorkers &out, std::vector< std::string > const &endPathNames, ConditionalTaskHelper const &conditionalTaskHelper, std::unordered_set< std::string > &allConditionalModules)
void endStream(StreamID iID, StreamContext &streamContext)
virtual void replaceModuleFor(Worker *) const =0
ProductList const & productList() const
std::unordered_multimap< std::string, AliasInfo > const & aliasMap() const
void processAccumulatorsAsync(WaitingTaskHolder, typename T::TransitionInfoType const &, ServiceToken const &, StreamID, ParentContext const &, typename T::Context const *)
std::array< SelectedProducts, NumBranchTypes > SelectedProductsForBranchType
static PFTauRenderPlugin instance
std::shared_ptr< HLTGlobalStatus > TrigResPtr
WorkersInPath::size_type size_type
int totalEventsPassed() const
ret
prodAgent to be discontinued
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 ...
void processOneEventAsync(WaitingTaskHolder iTask, EventTransitionInfo &, ServiceToken const &token, std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter >>> &pathStatusInserters)
std::vector< BranchToCount > earlyDeleteBranchToCount_
void clearCounters() noexcept
std::unordered_multimap< std::string, AliasInfo > aliasMap_
void setupOnDemandSystem(EventTransitionInfo const &)
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
ConditionalTaskHelper(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, WorkerManager &workerManagerLumisAndEvents, std::vector< std::string > const &trigPathNames)
void addToAllWorkers(Worker *w)
std::string const & moduleName() const
StreamSchedule(std::shared_ptr< TriggerResultInserter > inserter, std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter >>> &pathStatusInserters, std::vector< edm::propagate_const< std::shared_ptr< EndPathStatusInserter >>> &endPathStatusInserters, std::shared_ptr< ModuleRegistry >, ParameterSet &proc_pset, service::TriggerNamesService const &tns, PreallocationConfiguration const &prealloc, ProductRegistry &pregistry, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration const > processConfiguration, StreamID streamID, ProcessContext const *processContext)
std::vector< Worker * > tryToPlaceConditionalModules(Worker *, std::unordered_set< std::string > &conditionalModules, std::unordered_multimap< std::string, edm::BranchDescription const *> const &conditionalModuleBranches, std::unordered_multimap< std::string, AliasInfo > const &aliasMap, ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration)
edm::propagate_const< WorkerPtr > results_inserter_
void deleteModuleIfExists(std::string const &moduleLabel)
std::shared_ptr< Worker > WorkerPtr
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
StreamID streamID() const
WorkerManager workerManagerBeginEnd_
unsigned int number_of_unscheduled_modules_
int totalEventsFailed() const
TEMPL(T2) struct Divides void
std::shared_ptr< ActivityRegistry > actReg_
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
T getUntrackedParameter(std::string const &, T const &) const
constexpr element_type const * get() const
oneapi::tbb::task_group * group() const noexcept
void processEDAliases(std::vector< std::string > const &aliasNamesToProcess, std::unordered_set< std::string > const &aliasModulesToProcess, ParameterSet const &proc_pset, std::string const &processName, ProductRegistry &preg)
std::vector< WorkerInPath > PathWorkers
std::vector< int > empty_end_paths_
WorkerManager workerManagerRuns_
void processSwitchEDAliases(ParameterSet const &proc_pset, ProductRegistry &preg, ProcessConfiguration const &processConfiguration, std::unordered_set< std::string > const &allConditionalMods)
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const *> &descriptions, unsigned int hint) const
TrigResConstPtr results() const
Strings const & getTrigPaths() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
def unique(seq, keepstr=True)
StreamContext streamContext_
std::vector< std::string > vstring
virtual std::vector< ConsumesInfo > consumesInfo() const =0
static void fillPathSummary(Path const &path, PathSummary &sum)
void finishedPaths(std::atomic< std::exception_ptr *> &, WaitingTaskHolder, EventTransitionInfo &)
FunctorWaitingTask< F > * make_waiting_task(F f)
void handleException(StreamContext const &, ServiceWeakToken const &, bool cleaningUpAfterException, std::exception_ptr &) const noexcept
ModuleDescription const * description() const noexcept
void fillTrigPath(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name, TrigResPtr, std::vector< std::string > const &endPathNames, ConditionalTaskHelper const &conditionalTaskHelper, std::unordered_set< std::string > &allConditionalModules)
bool typeIsViewCompatible(TypeID const &requestedViewType, TypeID const &wrappedtypeID, std::string const &className)
std::exception_ptr finishProcessOneEvent(std::exception_ptr)
ServiceToken lock() const
void deleteModule(std::string const &iLabel)
Delete the module with label iLabel.
void doneWaiting(std::exception_ptr iExcept) noexcept
static void fillWorkerSummaryAux(Worker const &w, WorkerSummary &sum)
virtual Types moduleType() const =0
Log< level::Info, false > LogInfo
void beginStream(StreamID iID, StreamContext &streamContext)
std::string const & className() const
void clearCounters()
Clear all the counters in the trigger report.
void fillAliasMap(ParameterSet const &proc_pset, std::unordered_set< std::string > const &allConditionalMods)
Strings const & getEndPaths() const
void getTriggerReport(TriggerReport &rep) const
void addToUnscheduledWorkers(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string label, std::set< std::string > &unscheduledLabels, std::vector< std::string > &shouldBeUsedLabels)
exception_actions::ActionCodes find(const std::string &category) const
std::vector< unsigned int > earlyDeleteHelperToBranchIndicies_
void forAllModuleHolders(F iFunc)
edm::propagate_const< TrigResPtr > results_
bool search_all(ForwardSequence const &s, Datum const &d)
AllWorkers const & allWorkersLumisAndEvents() const
constexpr T & get_underlying(propagate_const< T > &)
void addContext(std::string const &context)
virtual std::unique_ptr< OutputModuleCommunicator > createOutputModuleCommunicator()=0
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
static void fillWorkerSummary(Worker const *pw, WorkerSummary &sum)
std::string const & processName() const
void setupResolvers(Principal &principal)
void replaceModule(maker::ModuleHolder *iMod, std::string const &iLabel)
clone the type of module with label iLabel but configure with iPSet.
std::vector< edm::propagate_const< WorkerPtr > > endPathStatusInserterWorkers_
void makePathStatusInserters(std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter >>> &pathStatusInserters, std::vector< edm::propagate_const< std::shared_ptr< EndPathStatusInserter >>> &endPathStatusInserters, ExceptionToActionTable const &actions)
std::unordered_multimap< std::string, edm::BranchDescription const * > conditionalModuleBranches(std::unordered_set< std::string > const &conditionalmods) const
std::vector< ModuleInPathSummary > moduleInPathSummaries
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
unsigned int value() const
auto wrap(F iFunc) -> decltype(iFunc())
std::unordered_multimap< std::string, edm::BranchDescription const * > conditionalModsBranches_
Log< level::Warning, false > LogWarning
void fillEndPath(ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name, std::vector< std::string > const &endPathNames, ConditionalTaskHelper const &conditionalTaskHelper, std::unordered_set< std::string > &allConditionalModules)
std::list< std::string > const & context() const
std::string const & moduleLabel() const
T mod(const T &a, const T &b)
std::string const & name() const
WorkerManager workerManagerLumisAndEvents_
std::vector< std::string > vstring
AllWorkers const & allWorkersRuns() const
std::vector< EarlyDeleteHelper > earlyDeleteHelpers_
void addToAllWorkers(Worker *w)
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)