CMS 3D CMS Logo

GlobalSchedule.cc
Go to the documentation of this file.
7 
14 
15 #include <algorithm>
16 #include <cassert>
17 #include <cstdlib>
18 #include <functional>
19 #include <map>
20 
21 namespace edm {
23  std::shared_ptr<TriggerResultInserter> inserter,
24  std::vector<edm::propagate_const<std::shared_ptr<PathStatusInserter>>>& pathStatusInserters,
25  std::vector<edm::propagate_const<std::shared_ptr<EndPathStatusInserter>>>& endPathStatusInserters,
26  std::shared_ptr<ModuleRegistry> modReg,
27  std::vector<std::string> const& iModulesToUse,
28  ParameterSet& proc_pset,
29  ProductRegistry& pregistry,
30  PreallocationConfiguration const& prealloc,
32  std::shared_ptr<ActivityRegistry> areg,
33  std::shared_ptr<ProcessConfiguration> processConfiguration,
34  ProcessContext const* processContext)
35  : actReg_(areg), processContext_(processContext) {
36  workerManagers_.reserve(prealloc.numberOfLuminosityBlocks());
37  for (unsigned int i = 0; i < prealloc.numberOfLuminosityBlocks(); ++i) {
38  workerManagers_.emplace_back(modReg, areg, actions);
39  }
40  for (auto const& moduleLabel : iModulesToUse) {
41  bool isTracked;
42  ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
43  if (modpset != nullptr) { // It will be null for PathStatusInserters, it should
44  // be impossible to be null for anything else
45  assert(isTracked);
46 
47  //side effect keeps this module around
48  for (auto& wm : workerManagers_) {
49  wm.addToAllWorkers(wm.getWorker(*modpset, pregistry, &prealloc, processConfiguration, moduleLabel));
50  }
51  }
52  }
53  if (inserter) {
54  inserter->doPreallocate(prealloc);
55  for (auto& wm : workerManagers_) {
57  inserter, inserter->moduleDescription(), &actions)); // propagate_const<T> has no reset() function
58  results_inserter->setActivityRegistry(actReg_);
59  wm.addToAllWorkers(results_inserter.get());
60  extraWorkers_.emplace_back(std::move(results_inserter));
61  }
62  }
63 
64  for (auto& pathStatusInserter : pathStatusInserters) {
65  std::shared_ptr<PathStatusInserter> inserterPtr = get_underlying(pathStatusInserter);
66  inserterPtr->doPreallocate(prealloc);
67 
68  for (auto& wm : workerManagers_) {
69  WorkerPtr workerPtr(
70  new edm::WorkerT<PathStatusInserter::ModuleType>(inserterPtr, inserterPtr->moduleDescription(), &actions));
71  workerPtr->setActivityRegistry(actReg_);
72  wm.addToAllWorkers(workerPtr.get());
73  extraWorkers_.emplace_back(std::move(workerPtr));
74  }
75  }
76 
77  for (auto& endPathStatusInserter : endPathStatusInserters) {
78  std::shared_ptr<EndPathStatusInserter> inserterPtr = get_underlying(endPathStatusInserter);
79  inserterPtr->doPreallocate(prealloc);
80  for (auto& wm : workerManagers_) {
82  inserterPtr, inserterPtr->moduleDescription(), &actions));
83  workerPtr->setActivityRegistry(actReg_);
84  wm.addToAllWorkers(workerPtr.get());
85  extraWorkers_.emplace_back(std::move(workerPtr));
86  }
87  }
88 
89  } // GlobalSchedule::GlobalSchedule
90 
91  void GlobalSchedule::endJob(ExceptionCollector& collector) { workerManagers_[0].endJob(collector); }
92 
94  eventsetup::ESRecordsToProxyIndices const& iESIndices) {
95  workerManagers_[0].beginJob(iRegistry, iESIndices);
96  }
97 
99  Worker* found = nullptr;
100  for (auto& wm : workerManagers_) {
101  for (auto const& worker : wm.allWorkers()) {
102  if (worker->description()->moduleLabel() == iLabel) {
103  found = worker;
104  break;
105  }
106  }
107  if (nullptr == found) {
108  return;
109  }
110 
111  iMod->replaceModuleFor(found);
112  found->beginJob();
113  }
114  }
115 
117  for (auto& wm : workerManagers_) {
118  wm.deleteModuleIfExists(iLabel);
119  }
120  }
121 
122  std::vector<ModuleDescription const*> GlobalSchedule::getAllModuleDescriptions() const {
123  std::vector<ModuleDescription const*> result;
124  result.reserve(allWorkers().size());
125 
126  for (auto const& worker : allWorkers()) {
127  ModuleDescription const* p = worker->description();
128  result.push_back(p);
129  }
130  return result;
131  }
132 } // namespace edm
edm::GlobalSchedule::allWorkers
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: GlobalSchedule.h:128
mps_fire.i
i
Definition: mps_fire.py:428
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ProcessContext
Definition: ProcessContext.h:27
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Algorithms.h
cms::cuda::assert
assert(be >=bs)
edm::GlobalSchedule::deleteModule
void deleteModule(std::string const &iLabel)
Delete the module with label iLabel.
Definition: GlobalSchedule.cc:116
edm::maker::ModuleHolder
Definition: ModuleHolder.h:37
PreallocationConfiguration.h
ProductRegistry.h
edm::WorkerT
Definition: Frameworkfwd.h:62
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::GlobalSchedule::beginJob
void beginJob(ProductRegistry const &, eventsetup::ESRecordsToProxyIndices const &)
Definition: GlobalSchedule.cc:93
WorkerMaker.h
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::ProductRegistry
Definition: ProductRegistry.h:37
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::propagate_const
Definition: propagate_const.h:32
edm::GlobalSchedule::actReg_
std::shared_ptr< ActivityRegistry > actReg_
Definition: GlobalSchedule.h:155
ProcessConfiguration.h
edm::GlobalSchedule::getAllModuleDescriptions
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Definition: GlobalSchedule.cc:122
edm::ExceptionCollector
Definition: ExceptionCollector.h:33
edm::Worker
Definition: Worker.h:90
edm::GlobalSchedule::workerManagers_
std::vector< WorkerManager > workerManagers_
Definition: GlobalSchedule.h:154
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::GlobalSchedule::endJob
void endJob(ExceptionCollector &collector)
Definition: GlobalSchedule.cc:91
edm::ParameterSet
Definition: ParameterSet.h:47
GlobalSchedule.h
TriggerResultInserter.h
edm::get_underlying
constexpr T & get_underlying(propagate_const< T > &)
Definition: propagate_const.h:103
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::GlobalSchedule::extraWorkers_
std::vector< edm::propagate_const< WorkerPtr > > extraWorkers_
Definition: GlobalSchedule.h:156
edm::ExceptionToActionTable
Definition: ExceptionActions.h:16
PathStatusInserter.h
EndPathStatusInserter.h
edm::GlobalSchedule::GlobalSchedule
GlobalSchedule(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 > modReg, std::vector< std::string > const &modulesToUse, ParameterSet &proc_pset, ProductRegistry &pregistry, PreallocationConfiguration const &prealloc, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, ProcessContext const *processContext)
Definition: GlobalSchedule.cc:22
Registry.h
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::GlobalSchedule::WorkerPtr
std::shared_ptr< Worker > WorkerPtr
Definition: GlobalSchedule.h:84
edm::maker::ModuleHolder::replaceModuleFor
virtual void replaceModuleFor(Worker *) const =0
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception.h
edm::GlobalSchedule::replaceModule
void replaceModule(maker::ModuleHolder *iMod, std::string const &iLabel)
clone the type of module with label iLabel but configure with iPSet.
Definition: GlobalSchedule.cc:98
actions
roAction_t actions[nactions]
Definition: GenABIO.cc:181
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::ParameterSet::getPSetForUpdate
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
Definition: ParameterSet.cc:457
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443