Skip to content

Commit 06e9871

Browse files
committed
Have StreamSchedule::fillWorkers return its value
1 parent 88db339 commit 06e9871

File tree

2 files changed

+51
-65
lines changed

2 files changed

+51
-65
lines changed

FWCore/Framework/interface/StreamSchedule.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,15 @@ namespace edm {
262262
SignallingProductRegistryFiller& preg,
263263
PreallocationConfiguration const* prealloc,
264264
std::shared_ptr<ProcessConfiguration const> processConfiguration);
265-
void fillWorkers(ParameterSet& proc_pset,
266-
SignallingProductRegistryFiller& preg,
267-
PreallocationConfiguration const* prealloc,
268-
std::shared_ptr<ProcessConfiguration const> processConfiguration,
269-
std::string const& name,
270-
bool ignoreFilters,
271-
PathWorkers& out,
272-
std::vector<std::string> const& endPathNames,
273-
ConditionalTaskHelper const& conditionalTaskHelper,
274-
std::unordered_set<std::string>& allConditionalModules);
265+
PathWorkers fillWorkers(ParameterSet& proc_pset,
266+
SignallingProductRegistryFiller& preg,
267+
PreallocationConfiguration const* prealloc,
268+
std::shared_ptr<ProcessConfiguration const> processConfiguration,
269+
std::string const& name,
270+
bool ignoreFilters,
271+
std::vector<std::string> const& endPathNames,
272+
ConditionalTaskHelper const& conditionalTaskHelper,
273+
std::unordered_set<std::string>& allConditionalModules);
275274
void fillTrigPath(ParameterSet& proc_pset,
276275
SignallingProductRegistryFiller& preg,
277276
PreallocationConfiguration const* prealloc,

FWCore/Framework/src/StreamSchedule.cc

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ namespace edm {
9898

9999
// Here we make the trigger results inserter directly. This should
100100
// probably be a utility in the WorkerRegistry or elsewhere.
101-
101+
/*
102102
StreamSchedule::WorkerPtr makeInserter(ExceptionToActionTable const& actions,
103103
std::shared_ptr<ActivityRegistry> areg,
104104
std::shared_ptr<TriggerResultInserter> inserter) {
@@ -107,7 +107,7 @@ namespace edm {
107107
ptr->setActivityRegistry(areg);
108108
return ptr;
109109
}
110-
110+
*/
111111
void initializeBranchToReadingWorker(std::vector<std::string> const& branchesToDeleteEarly,
112112
ProductRegistry const& preg,
113113
std::multimap<std::string, Worker*>& branchToReadingWorker) {
@@ -158,15 +158,16 @@ namespace edm {
158158
WorkerManager& workerManager,
159159
SignallingProductRegistryFiller& preg,
160160
PreallocationConfiguration const* prealloc,
161-
std::shared_ptr<ProcessConfiguration const> processConfiguration) {
161+
std::shared_ptr<ProcessConfiguration const> processConfiguration,
162+
bool addToAllWorkers = true) {
162163
bool isTracked;
163164
ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
164165
if (modpset == nullptr) {
165166
return nullptr;
166167
}
167168
assert(isTracked);
168169

169-
return workerManager.getWorker(*modpset, preg, prealloc, processConfiguration, moduleLabel);
170+
return workerManager.getWorker(*modpset, preg, prealloc, processConfiguration, moduleLabel, addToAllWorkers);
170171
}
171172

172173
// If ConditionalTask modules exist in the container of module
@@ -284,7 +285,9 @@ namespace edm {
284285

285286
for (auto const& cond : allConditionalMods) {
286287
//force the creation of the conditional modules so alias check can work
287-
(void)getWorker(cond, proc_pset, workerManagerLumisAndEvents, preg, prealloc, processConfiguration);
288+
// must be sure this is not added to the list of all workers else the system will hang in case the
289+
// module is not used.
290+
(void)getWorker(cond, proc_pset, workerManagerLumisAndEvents, preg, prealloc, processConfiguration, false);
288291
}
289292

290293
fillAliasMap(proc_pset, allConditionalMods);
@@ -424,8 +427,9 @@ namespace edm {
424427
if (hasPath) {
425428
// the results inserter stands alone
426429
inserter->setTrigResultForStream(streamID.value(), results());
427-
428-
results_inserter_ = makeInserter(actions, actReg_, inserter);
430+
results_inserter_ = modReg->getExistingModule(inserter->moduleDescription().moduleLabel())->makeWorker(&actions);
431+
results_inserter_->setActivityRegistry(areg);
432+
//results_inserter_ = makeInserter(actions, actReg_, inserter);
429433
addToAllWorkers(results_inserter_.get());
430434
}
431435

@@ -522,16 +526,9 @@ namespace edm {
522526
// We could add special code to create workers for those, but instead we skip them because they
523527
// do not have beginStream, endStream, or run/lumi begin/end stream transition functions.
524528

525-
Worker* workerBeginEnd =
526-
getWorker(moduleLabel, proc_pset, workerManagerBeginEnd_, preg, &prealloc, processConfiguration);
527-
if (workerBeginEnd) {
528-
workerManagerBeginEnd_.addToAllWorkers(workerBeginEnd);
529-
}
529+
(void)getWorker(moduleLabel, proc_pset, workerManagerBeginEnd_, preg, &prealloc, processConfiguration);
530530

531-
Worker* workerRuns = getWorker(moduleLabel, proc_pset, workerManagerRuns_, preg, &prealloc, processConfiguration);
532-
if (workerRuns) {
533-
workerManagerRuns_.addToAllWorkers(workerRuns);
534-
}
531+
(void)getWorker(moduleLabel, proc_pset, workerManagerRuns_, preg, &prealloc, processConfiguration);
535532
}
536533

537534
} // StreamSchedule::StreamSchedule
@@ -825,16 +822,16 @@ namespace edm {
825822
return returnValue;
826823
}
827824

828-
void StreamSchedule::fillWorkers(ParameterSet& proc_pset,
829-
SignallingProductRegistryFiller& preg,
830-
PreallocationConfiguration const* prealloc,
831-
std::shared_ptr<ProcessConfiguration const> processConfiguration,
832-
std::string const& pathName,
833-
bool ignoreFilters,
834-
PathWorkers& out,
835-
std::vector<std::string> const& endPathNames,
836-
ConditionalTaskHelper const& conditionalTaskHelper,
837-
std::unordered_set<std::string>& allConditionalModules) {
825+
StreamSchedule::PathWorkers StreamSchedule::fillWorkers(
826+
ParameterSet& proc_pset,
827+
SignallingProductRegistryFiller& preg,
828+
PreallocationConfiguration const* prealloc,
829+
std::shared_ptr<ProcessConfiguration const> processConfiguration,
830+
std::string const& pathName,
831+
bool ignoreFilters,
832+
std::vector<std::string> const& endPathNames,
833+
ConditionalTaskHelper const& conditionalTaskHelper,
834+
std::unordered_set<std::string>& allConditionalModules) {
838835
vstring modnames = proc_pset.getParameter<vstring>(pathName);
839836
PathWorkers tmpworkers;
840837

@@ -930,7 +927,7 @@ namespace edm {
930927
++placeInPath;
931928
}
932929

933-
out.swap(tmpworkers);
930+
return tmpworkers;
934931
}
935932

936933
void StreamSchedule::fillTrigPath(ParameterSet& proc_pset,
@@ -943,17 +940,15 @@ namespace edm {
943940
std::vector<std::string> const& endPathNames,
944941
ConditionalTaskHelper const& conditionalTaskHelper,
945942
std::unordered_set<std::string>& allConditionalModules) {
946-
PathWorkers tmpworkers;
947-
fillWorkers(proc_pset,
948-
preg,
949-
prealloc,
950-
processConfiguration,
951-
name,
952-
false,
953-
tmpworkers,
954-
endPathNames,
955-
conditionalTaskHelper,
956-
allConditionalModules);
943+
PathWorkers tmpworkers = fillWorkers(proc_pset,
944+
preg,
945+
prealloc,
946+
processConfiguration,
947+
name,
948+
false,
949+
endPathNames,
950+
conditionalTaskHelper,
951+
allConditionalModules);
957952

958953
// an empty path will cause an extra bit that is not used
959954
if (!tmpworkers.empty()) {
@@ -962,9 +957,6 @@ namespace edm {
962957
} else {
963958
empty_trig_paths_.push_back(bitpos);
964959
}
965-
for (WorkerInPath const& workerInPath : tmpworkers) {
966-
addToAllWorkers(workerInPath.getWorker());
967-
}
968960
}
969961

970962
void StreamSchedule::fillEndPath(ParameterSet& proc_pset,
@@ -976,17 +968,15 @@ namespace edm {
976968
std::vector<std::string> const& endPathNames,
977969
ConditionalTaskHelper const& conditionalTaskHelper,
978970
std::unordered_set<std::string>& allConditionalModules) {
979-
PathWorkers tmpworkers;
980-
fillWorkers(proc_pset,
981-
preg,
982-
prealloc,
983-
processConfiguration,
984-
name,
985-
true,
986-
tmpworkers,
987-
endPathNames,
988-
conditionalTaskHelper,
989-
allConditionalModules);
971+
PathWorkers tmpworkers = fillWorkers(proc_pset,
972+
preg,
973+
prealloc,
974+
processConfiguration,
975+
name,
976+
true,
977+
endPathNames,
978+
conditionalTaskHelper,
979+
allConditionalModules);
990980

991981
if (!tmpworkers.empty()) {
992982
end_paths_.emplace_back(bitpos,
@@ -1000,9 +990,6 @@ namespace edm {
1000990
} else {
1001991
empty_end_paths_.push_back(bitpos);
1002992
}
1003-
for (WorkerInPath const& workerInPath : tmpworkers) {
1004-
addToAllWorkers(workerInPath.getWorker());
1005-
}
1006993
}
1007994

1008995
void StreamSchedule::beginStream() {

0 commit comments

Comments
 (0)