CMS 3D CMS Logo

GlobalSchedule.cc
Go to the documentation of this file.
6 
13 
14 #include <algorithm>
15 #include <cassert>
16 #include <cstdlib>
17 #include <functional>
18 #include <map>
19 
20 namespace edm {
21  GlobalSchedule::GlobalSchedule(std::shared_ptr<TriggerResultInserter> inserter,
22  std::vector<edm::propagate_const<std::shared_ptr<PathStatusInserter>>>& pathStatusInserters,
23  std::vector<edm::propagate_const<std::shared_ptr<EndPathStatusInserter>>>& endPathStatusInserters,
24  std::shared_ptr<ModuleRegistry> modReg,
25  std::vector<std::string> const& iModulesToUse,
26  ParameterSet& proc_pset,
27  ProductRegistry& pregistry,
28  PreallocationConfiguration const& prealloc,
30  std::shared_ptr<ActivityRegistry> areg,
31  std::shared_ptr<ProcessConfiguration> processConfiguration,
32  ProcessContext const* processContext) :
33  workerManager_(modReg,areg,actions),
34  actReg_(areg),
35  processContext_(processContext)
36  {
37  for (auto const& moduleLabel : iModulesToUse) {
38  bool isTracked;
39  ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
40  if (modpset != nullptr) { // It will be null for PathStatusInserters, it should
41  // be impossible to be null for anything else
42  assert(isTracked);
43 
44  //side effect keeps this module around
45  addToAllWorkers(workerManager_.getWorker(*modpset, pregistry, &prealloc,processConfiguration, moduleLabel));
46  }
47  }
48  if(inserter) {
49  results_inserter_ = WorkerPtr(new edm::WorkerT<TriggerResultInserter::ModuleType>(inserter, inserter->moduleDescription(), &actions)); // propagate_const<T> has no reset() function
50  inserter->doPreallocate(prealloc);
51  results_inserter_->setActivityRegistry(actReg_);
53  }
54 
55  for(auto & pathStatusInserter : pathStatusInserters) {
56  std::shared_ptr<PathStatusInserter> inserterPtr = get_underlying(pathStatusInserter);
58  inserterPtr->moduleDescription(),
59  &actions));
60  pathStatusInserterWorkers_.emplace_back(workerPtr);
61  inserterPtr->doPreallocate(prealloc);
62  workerPtr->setActivityRegistry(actReg_);
63  addToAllWorkers(workerPtr.get());
64  }
65 
66  for(auto & endPathStatusInserter : endPathStatusInserters) {
67  std::shared_ptr<EndPathStatusInserter> inserterPtr = get_underlying(endPathStatusInserter);
69  inserterPtr->moduleDescription(),
70  &actions));
71  endPathStatusInserterWorkers_.emplace_back(workerPtr);
72  inserterPtr->doPreallocate(prealloc);
73  workerPtr->setActivityRegistry(actReg_);
74  addToAllWorkers(workerPtr.get());
75  }
76 
77  } // GlobalSchedule::GlobalSchedule
78 
80  workerManager_.endJob(collector);
81  }
82 
83  void GlobalSchedule::beginJob(ProductRegistry const& iRegistry) {
84  workerManager_.beginJob(iRegistry);
85  }
86 
88  std::string const& iLabel) {
89  Worker* found = nullptr;
90  for (auto const& worker : allWorkers()) {
91  if (worker->description().moduleLabel() == iLabel) {
92  found = worker;
93  break;
94  }
95  }
96  if (nullptr == found) {
97  return;
98  }
99 
100  iMod->replaceModuleFor(found);
101  found->beginJob();
102  }
103 
104  std::vector<ModuleDescription const*>
106  std::vector<ModuleDescription const*> result;
107  result.reserve(allWorkers().size());
108 
109  for (auto const& worker : allWorkers()) {
110  ModuleDescription const* p = worker->descPtr();
111  result.push_back(p);
112  }
113  return result;
114  }
115 
116  void
119  }
120 
121 }
size
Write out results.
edm::propagate_const< WorkerPtr > results_inserter_
std::vector< edm::propagate_const< WorkerPtr > > endPathStatusInserterWorkers_
void replaceModule(maker::ModuleHolder *iMod, std::string const &iLabel)
clone the type of module with label iLabel but configure with iPSet.
roAction_t actions[nactions]
Definition: GenABIO.cc:187
const double w
Definition: UKUtility.cc:23
virtual void replaceModuleFor(Worker *) const =0
void beginJob(ProductRegistry const &iRegistry)
void addToAllWorkers(Worker *w)
void beginJob(ProductRegistry const &)
T & get_underlying(propagate_const< T > &)
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
std::shared_ptr< Worker > WorkerPtr
void endJob(ExceptionCollector &collector)
element_type const * get() const
std::shared_ptr< ActivityRegistry > actReg_
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
HLT enums.
void beginJob()
Definition: Worker.cc:245
std::vector< edm::propagate_const< WorkerPtr > > pathStatusInserterWorkers_
WorkerManager workerManager_
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)
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
void addToAllWorkers(Worker *w)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)