CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::GlobalSchedule Class Reference

#include <GlobalSchedule.h>

Public Types

typedef std::vector< Worker * > AllWorkers
 
typedef std::vector< std::string > vstring
 
typedef boost::shared_ptr< WorkerWorkerPtr
 
typedef std::vector< Worker * > Workers
 

Public Member Functions

AllWorkers const & allWorkers () const
 returns the collection of pointers to workers More...
 
void beginJob (ProductRegistry const &)
 
void endJob (ExceptionCollector &collector)
 
std::vector< ModuleDescription
const * > 
getAllModuleDescriptions () const
 
void getTriggerReport (TriggerReport &rep) const
 
 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)
 
 GlobalSchedule (GlobalSchedule const &)=delete
 
template<typename T >
void processOneGlobal (typename T::MyPrincipal &principal, EventSetup const &eventSetup, bool cleaningUpAfterException=false)
 
void replaceModule (maker::ModuleHolder *iMod, std::string const &iLabel)
 clone the type of module with label iLabel but configure with iPSet. More...
 
bool terminate () const
 Return whether each output module has reached its maximum count. More...
 

Private Member Functions

ExceptionToActionTable const & actionTable () const
 returns the action table More...
 
void addToAllWorkers (Worker *w)
 
template<typename T >
void runNow (typename T::MyPrincipal &p, EventSetup const &es, GlobalContext const *context)
 

Private Attributes

boost::shared_ptr
< ActivityRegistry
actReg_
 
ProcessContext const * processContext_
 
WorkerPtr results_inserter_
 
WorkerManager workerManager_
 

Detailed Description

Definition at line 73 of file GlobalSchedule.h.

Member Typedef Documentation

typedef std::vector<Worker*> edm::GlobalSchedule::AllWorkers

Definition at line 76 of file GlobalSchedule.h.

typedef std::vector<std::string> edm::GlobalSchedule::vstring

Definition at line 75 of file GlobalSchedule.h.

typedef boost::shared_ptr<Worker> edm::GlobalSchedule::WorkerPtr

Definition at line 77 of file GlobalSchedule.h.

typedef std::vector<Worker*> edm::GlobalSchedule::Workers

Definition at line 78 of file GlobalSchedule.h.

Constructor & Destructor Documentation

edm::GlobalSchedule::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 
)

Definition at line 19 of file GlobalSchedule.cc.

References edm::actions, actReg_, addToAllWorkers(), edm::errors::Configuration, edm::hlt::Exception, edm::ParameterSet::getPSetForUpdate(), edm::WorkerManager::getWorker(), edm::global::EDProducerBase::moduleDescription(), results_inserter_, and workerManager_.

28  :
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) {
48  results_inserter_.reset(new edm::WorkerT<TriggerResultInserter::ModuleType>(inserter, inserter->moduleDescription(), &actions));
49  inserter->doPreallocate(prealloc);
50  results_inserter_->setActivityRegistry(actReg_);
52  }
53 
54  } // GlobalSchedule::GlobalSchedule
processConfiguration
Definition: Schedule.cc:362
void addToAllWorkers(Worker *w)
actions
Definition: Schedule.cc:362
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, boost::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
boost::shared_ptr< ActivityRegistry > actReg_
areg
Definition: Schedule.cc:362
ProcessContext const * processContext_
WorkerPtr results_inserter_
WorkerManager workerManager_
prealloc
Definition: Schedule.cc:362
edm::GlobalSchedule::GlobalSchedule ( GlobalSchedule const &  )
delete

Member Function Documentation

ExceptionToActionTable const& edm::GlobalSchedule::actionTable ( ) const
inlineprivate

returns the action table

Definition at line 130 of file GlobalSchedule.h.

References edm::WorkerManager::actionTable(), and workerManager_.

130  {
131  return workerManager_.actionTable();
132  }
WorkerManager workerManager_
ExceptionToActionTable const & actionTable() const
Definition: WorkerManager.h:68
void edm::GlobalSchedule::addToAllWorkers ( Worker w)
private

Definition at line 95 of file GlobalSchedule.cc.

References edm::WorkerManager::addToAllWorkers(), and workerManager_.

Referenced by GlobalSchedule().

95  {
97  }
T w() const
void addToAllWorkers(Worker *w, bool useStopwatch)
WorkerManager workerManager_
AllWorkers const& edm::GlobalSchedule::allWorkers ( ) const
inline

returns the collection of pointers to workers

Definition at line 119 of file GlobalSchedule.h.

References edm::WorkerManager::allWorkers(), and workerManager_.

Referenced by getAllModuleDescriptions(), replaceModule(), and runNow().

119  {
120  return workerManager_.allWorkers();
121  }
AllWorkers const & allWorkers() const
Definition: WorkerManager.h:64
WorkerManager workerManager_
void edm::GlobalSchedule::beginJob ( ProductRegistry const &  iRegistry)

Definition at line 61 of file GlobalSchedule.cc.

References edm::WorkerManager::beginJob(), and workerManager_.

61  {
62  workerManager_.beginJob(iRegistry);
63  }
void beginJob(ProductRegistry const &iRegistry)
WorkerManager workerManager_
void edm::GlobalSchedule::endJob ( ExceptionCollector collector)

Definition at line 57 of file GlobalSchedule.cc.

References edm::WorkerManager::endJob(), and workerManager_.

57  {
58  workerManager_.endJob(collector);
59  }
WorkerManager workerManager_
std::vector< ModuleDescription const * > edm::GlobalSchedule::getAllModuleDescriptions ( ) const

Return a vector allowing const access to all the ModuleDescriptions for this GlobalSchedule. *** N.B. *** Ownership of the ModuleDescriptions is not *** passed to the caller. Do not call delete on these *** pointers!

Definition at line 83 of file GlobalSchedule.cc.

References allWorkers(), AlCaHLTBitMon_ParallelJobs::p, query::result, and findQualityFiles::size.

83  {
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  }
tuple result
Definition: query.py:137
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
tuple size
Write out results.
void edm::GlobalSchedule::getTriggerReport ( TriggerReport rep) const

Return the trigger report information on paths, modules-in-path, modules-in-endpath, and modules.

template<typename T >
void edm::GlobalSchedule::processOneGlobal ( typename T::MyPrincipal &  principal,
EventSetup const &  eventSetup,
bool  cleaningUpAfterException = false 
)

Definition at line 147 of file GlobalSchedule.h.

References actReg_, edm::addContextAndPrintException(), edm::convertException::badAllocToEDM(), trackerHits::c, edm::convertException::charPtrToEDM(), cms::Exception::context(), alignCSCRings::e, cppFunctionSkipper::exception, edm::StreamID::invalidStreamID(), processContext_, edm::WorkerManager::processOneOccurrence(), alignCSCRings::s, edm::convertException::stdToEDM(), AlCaHLTBitMon_QueryRunRegistry::string, edm::convertException::stringToEDM(), edm::convertException::unknownToEDM(), and workerManager_.

149  {
150  GlobalContext globalContext = T::makeGlobalContext(ep, processContext_);
151 
152  GlobalScheduleSignalSentry<T> sentry(actReg_.get(), &ep, &es, &globalContext);
153 
154  // This call takes care of the unscheduled processing.
155  workerManager_.processOneOccurrence<T>(ep, es, StreamID::invalidStreamID(), &globalContext, &globalContext, cleaningUpAfterException);
156 
157  try {
158  try {
159  runNow<T>(ep,es,&globalContext);
160  }
161  catch (cms::Exception& e) { throw; }
162  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
163  catch (std::exception& e) { convertException::stdToEDM(e); }
165  catch(char const* c) { convertException::charPtrToEDM(c); }
166  catch (...) { convertException::unknownToEDM(); }
167  }
168  catch(cms::Exception& ex) {
169  if (ex.context().empty()) {
170  addContextAndPrintException("Calling function GlobalSchedule::processOneGlobal", ex, cleaningUpAfterException);
171  } else {
172  addContextAndPrintException("", ex, cleaningUpAfterException);
173  }
174  throw;
175  }
176  //If we got here no other exception has happened so we can propogate any Service related exceptions
177  sentry.allowThrow();
178  }
void processOneOccurrence(typename T::MyPrincipal &principal, EventSetup const &eventSetup, StreamID streamID, typename T::Context const *topContext, U const *context, bool cleaningUpAfterException=false)
Definition: WorkerManager.h:92
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
static StreamID invalidStreamID()
Definition: StreamID.h:48
void stdToEDM(std::exception const &e)
std::list< std::string > const & context() const
Definition: Exception.cc:191
boost::shared_ptr< ActivityRegistry > actReg_
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
ProcessContext const * processContext_
WorkerManager workerManager_
long double T
void edm::GlobalSchedule::replaceModule ( maker::ModuleHolder *  iMod,
std::string const &  iLabel 
)

clone the type of module with label iLabel but configure with iPSet.

Definition at line 65 of file GlobalSchedule.cc.

References allWorkers(), edm::Worker::beginJob(), and newFWLiteAna::found.

66  {
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  }
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
template<typename T >
void edm::GlobalSchedule::runNow ( typename T::MyPrincipal &  p,
EventSetup const &  es,
GlobalContext const *  context 
)
private

Definition at line 181 of file GlobalSchedule.h.

References cms::Exception::addContext(), allWorkers(), edm::InLumi, edm::InRun, edm::StreamID::invalidStreamID(), and AlCaHLTBitMon_ParallelJobs::p.

182  {
183  //do nothing for event since we will run when requested
184  for(auto & worker: allWorkers()) {
185  try {
186  ParentContext parentContext(context);
187  worker->doWork<T>(p, es, nullptr,StreamID::invalidStreamID(), parentContext, context);
188  }
189  catch (cms::Exception & ex) {
190  std::ostringstream ost;
191  if (T::begin_ && T::branchType_ == InRun) {
192  ost << "Calling beginRun";
193  }
194  else if (T::begin_ && T::branchType_ == InLumi) {
195  ost << "Calling beginLuminosityBlock";
196  }
197  else if (!T::begin_ && T::branchType_ == InLumi) {
198  ost << "Calling endLuminosityBlock";
199  }
200  else if (!T::begin_ && T::branchType_ == InRun) {
201  ost << "Calling endRun";
202  }
203  else {
204  // It should be impossible to get here ...
205  ost << "Calling unknown function";
206  }
207  ost << " for unscheduled module " << worker->description().moduleName()
208  << "/'" << worker->description().moduleLabel() << "'";
209  ex.addContext(ost.str());
210  ost.str("");
211  ost << "Processing " << p.id();
212  ex.addContext(ost.str());
213  throw;
214  }
215  }
216  }
static StreamID invalidStreamID()
Definition: StreamID.h:48
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
void addContext(std::string const &context)
Definition: Exception.cc:227
long double T
bool edm::GlobalSchedule::terminate ( ) const

Return whether each output module has reached its maximum count.

Member Data Documentation

boost::shared_ptr<ActivityRegistry> edm::GlobalSchedule::actReg_
private

Definition at line 137 of file GlobalSchedule.h.

Referenced by GlobalSchedule(), and processOneGlobal().

ProcessContext const* edm::GlobalSchedule::processContext_
private

Definition at line 141 of file GlobalSchedule.h.

Referenced by processOneGlobal().

WorkerPtr edm::GlobalSchedule::results_inserter_
private

Definition at line 138 of file GlobalSchedule.h.

Referenced by GlobalSchedule().

WorkerManager edm::GlobalSchedule::workerManager_
private