CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalSchedule.cc
Go to the documentation of this file.
4 
11 
12 #include <algorithm>
13 #include <cassert>
14 #include <cstdlib>
15 #include <functional>
16 #include <map>
17 
18 namespace edm {
20  boost::shared_ptr<ModuleRegistry> modReg,
21  std::vector<std::string> const& iModulesToUse,
22  ParameterSet& proc_pset,
23  ProductRegistry& pregistry,
26  boost::shared_ptr<ActivityRegistry> areg,
27  boost::shared_ptr<ProcessConfiguration> processConfiguration,
28  ProcessContext const* processContext) :
29  workerManager_(modReg,areg,actions),
30  actReg_(areg),
31  processContext_(processContext)
32  {
33  for (auto const& moduleLabel : iModulesToUse) {
34  bool isTracked;
35  ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
36  if (modpset == 0) {
38  "The unknown module label \"" << moduleLabel <<
39  "\"\n please check spelling";
40  }
41  assert(isTracked);
42 
43  //side effect keeps this module around
44  addToAllWorkers(workerManager_.getWorker(*modpset, pregistry, &prealloc,processConfiguration, moduleLabel));
45 
46  }
47  if(inserter) {
49  inserter->doPreallocate(prealloc);
50  results_inserter_->setActivityRegistry(actReg_);
52  }
53 
54  } // GlobalSchedule::GlobalSchedule
55 
56 
58  workerManager_.endJob(collector);
59  }
60 
61  void GlobalSchedule::beginJob(ProductRegistry const& iRegistry) {
62  workerManager_.beginJob(iRegistry);
63  }
64 
66  std::string const& iLabel) {
67  Worker* found = nullptr;
68  for (auto const& worker : allWorkers()) {
69  if (worker->description().moduleLabel() == iLabel) {
70  found = worker;
71  break;
72  }
73  }
74  if (nullptr == found) {
75  return;
76  }
77 
78  iMod->replaceModuleFor(found);
79  found->beginJob();
80  }
81 
82  std::vector<ModuleDescription const*>
84  std::vector<ModuleDescription const*> result;
85  result.reserve(allWorkers().size());
86 
87  for (auto const& worker : allWorkers()) {
88  ModuleDescription const* p = worker->descPtr();
89  result.push_back(p);
90  }
91  return result;
92  }
93 
94  void
97  }
98 
99 }
void replaceModule(maker::ModuleHolder *iMod, std::string const &iLabel)
clone the type of module with label iLabel but configure with iPSet.
virtual void replaceModuleFor(Worker *) const =0
void beginJob(ProductRegistry const &iRegistry)
processConfiguration
Definition: Schedule.cc:369
void addToAllWorkers(Worker *w)
actions
Definition: Schedule.cc:369
void beginJob(ProductRegistry const &)
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, boost::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
tuple result
Definition: query.py:137
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
boost::shared_ptr< ActivityRegistry > actReg_
void endJob(ExceptionCollector &collector)
areg
Definition: Schedule.cc:369
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
ModuleDescription const & moduleDescription() const
void beginJob()
Definition: Worker.cc:105
GlobalSchedule(TriggerResultInserter *inserter, boost::shared_ptr< ModuleRegistry > modReg, std::vector< std::string > const &modulesToUse, ParameterSet &proc_pset, ProductRegistry &pregistry, PreallocationConfiguration const &prealloc, ExceptionToActionTable const &actions, boost::shared_ptr< ActivityRegistry > areg, boost::shared_ptr< ProcessConfiguration > processConfiguration, ProcessContext const *processContext)
T w() const
void addToAllWorkers(Worker *w, bool useStopwatch)
WorkerPtr results_inserter_
WorkerManager workerManager_
tuple size
Write out results.
prealloc
Definition: Schedule.cc:369
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)