CMS 3D CMS Logo

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

#include <Worker.h>

Inheritance diagram for edm::Worker:
edm::WorkerT< T >

Classes

class  RunModuleTask
 
class  TransitionIDValue
 
class  TransitionIDValueBase
 

Public Types

enum  State { Ready, Pass, Fail, Exception }
 
enum  Types { kAnalyzer, kFilter, kProducer, kOutputModule }
 

Public Member Functions

void addedToPath ()
 
void beginJob ()
 
void beginStream (StreamID id, StreamContext &streamContext)
 
void callWhenDoneAsync (WaitingTask *task)
 
void clearCounters ()
 
virtual std::vector< ConsumesInfoconsumesInfo () const =0
 
ModuleDescription const * descPtr () const
 
ModuleDescription const & description () const
 
template<typename T >
bool doWork (typename T::MyPrincipal const &, EventSetup const &c, StreamID stream, ParentContext const &parentContext, typename T::Context const *context)
 
template<typename T >
void doWorkAsync (WaitingTask *task, typename T::MyPrincipal const &, EventSetup const &c, StreamID stream, ParentContext const &parentContext, typename T::Context const *context)
 
void endJob ()
 
void endStream (StreamID id, StreamContext &streamContext)
 
virtual void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc) const =0
 
virtual Types moduleType () const =0
 
Workeroperator= (Worker const &)=delete
 
void postDoEvent (EventPrincipal const &)
 
void postForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
 
void preForkReleaseResources ()
 
void registerThinnedAssociations (ProductRegistry const &registry, ThinnedAssociationsHelper &helper)
 
void reset ()
 
virtual void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies)=0
 
void respondToCloseInputFile (FileBlock const &fb)
 
void respondToOpenInputFile (FileBlock const &fb)
 
void setActivityRegistry (std::shared_ptr< ActivityRegistry > areg)
 
void setEarlyDeleteHelper (EarlyDeleteHelper *iHelper)
 
void skipOnPath ()
 
State state () const
 
int timesExcept () const
 
int timesFailed () const
 
int timesPass () const
 
int timesPassed () const
 
int timesRun () const
 
int timesVisited () const
 
virtual void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &)=0
 
 Worker (ModuleDescription const &iMD, ExceptionToActionTable const *iActions)
 
 Worker (Worker const &)=delete
 
virtual ~Worker ()
 

Protected Member Functions

ActivityRegistryactivityRegistry ()
 
virtual void implBeginJob ()=0
 
virtual void implBeginStream (StreamID)=0
 
virtual bool implDo (EventPrincipal const &, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoBegin (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoBegin (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoEnd (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoEnd (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoPrePrefetchSelection (StreamID id, EventPrincipal const &ep, ModuleCallingContext const *mcc)=0
 
virtual bool implDoStreamBegin (StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoStreamBegin (StreamID id, LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoStreamEnd (StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual bool implDoStreamEnd (StreamID id, LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)=0
 
virtual void implEndJob ()=0
 
virtual void implEndStream (StreamID)=0
 
void resetModuleDescription (ModuleDescription const *)
 
virtual std::string workerType () const =0
 

Private Member Functions

void emitPostModuleEventPrefetchingSignal ()
 
virtual void implPostForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)=0
 
virtual void implPreForkReleaseResources ()=0
 
virtual void implRegisterThinnedAssociations (ProductRegistry const &, ThinnedAssociationsHelper &)=0
 
virtual void implRespondToCloseInputFile (FileBlock const &fb)=0
 
virtual void implRespondToOpenInputFile (FileBlock const &fb)=0
 
virtual void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const =0
 
virtual std::vector
< ProductResolverIndex > const & 
itemsShouldPutInEvent () const =0
 
virtual void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const =0
 
virtual std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFromEvent () const =0
 
void prefetchAsync (WaitingTask *, ParentContext const &parentContext, Principal const &)
 
template<typename T >
bool runModule (typename T::MyPrincipal const &, EventSetup const &c, StreamID stream, ParentContext const &parentContext, typename T::Context const *context)
 
template<typename T >
void runModuleAfterAsyncPrefetch (std::exception_ptr const *iEPtr, typename T::MyPrincipal const &ep, EventSetup const &es, StreamID streamID, ParentContext const &parentContext, typename T::Context const *context)
 
virtual SerialTaskQueueChainserializeRunModule ()=0
 
template<bool IS_EVENT>
std::exception_ptr setException (std::exception_ptr iException)
 
template<bool IS_EVENT>
bool setFailed ()
 
template<bool IS_EVENT>
bool setPassed ()
 
bool shouldRethrowException (cms::Exception &ex, ParentContext const &parentContext, bool isEvent, TransitionIDValueBase const &iID) const
 

Static Private Member Functions

static void exceptionContext (const std::string &iID, bool iIsEvent, cms::Exception &ex, ModuleCallingContext const *mcc)
 

Private Attributes

ExceptionToActionTable const * actions_
 
std::shared_ptr< ActivityRegistryactReg_
 
std::exception_ptr cached_exception_
 
edm::propagate_const
< EarlyDeleteHelper * > 
earlyDeleteHelper_
 
ModuleCallingContext moduleCallingContext_
 
std::atomic< int > numberOfPathsLeftToRun_
 
int numberOfPathsOn_
 
std::atomic< Statestate_
 
std::atomic< int > timesExcept_
 
std::atomic< int > timesFailed_
 
std::atomic< int > timesPassed_
 
std::atomic< int > timesRun_
 
std::atomic< int > timesVisited_
 
edm::WaitingTaskList waitingTasks_
 
std::atomic< bool > workStarted_
 

Friends

template<typename O >
class workerhelper::CallImpl
 

Detailed Description

Definition at line 75 of file Worker.h.

Member Enumeration Documentation

Enumerator
Ready 
Pass 
Fail 
Exception 

Definition at line 77 of file Worker.h.

Enumerator
kAnalyzer 
kFilter 
kProducer 
kOutputModule 

Definition at line 78 of file Worker.h.

Constructor & Destructor Documentation

edm::Worker::Worker ( ModuleDescription const &  iMD,
ExceptionToActionTable const *  iActions 
)

Definition at line 72 of file Worker.cc.

73  :
74  timesRun_(),
75  timesVisited_(),
76  timesPassed_(),
77  timesFailed_(),
78  timesExcept_(),
79  state_(Ready),
83  actions_(iActions),
85  actReg_(),
86  earlyDeleteHelper_(nullptr),
87  workStarted_(false)
88  {
89  }
std::atomic< int > timesVisited_
Definition: Worker.h:383
std::atomic< int > numberOfPathsLeftToRun_
Definition: Worker.h:389
std::atomic< int > timesExcept_
Definition: Worker.h:386
std::atomic< bool > workStarted_
Definition: Worker.h:401
std::atomic< int > timesFailed_
Definition: Worker.h:385
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
ExceptionToActionTable const * actions_
Definition: Worker.h:393
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
std::exception_ptr cached_exception_
Definition: Worker.h:394
std::atomic< State > state_
Definition: Worker.h:387
int numberOfPathsOn_
Definition: Worker.h:388
std::atomic< int > timesPassed_
Definition: Worker.h:384
edm::propagate_const< EarlyDeleteHelper * > earlyDeleteHelper_
Definition: Worker.h:398
std::atomic< int > timesRun_
Definition: Worker.h:382
edm::Worker::~Worker ( )
virtual

Definition at line 91 of file Worker.cc.

91  {
92  }
edm::Worker::Worker ( Worker const &  )
delete

Member Function Documentation

ActivityRegistry* edm::Worker::activityRegistry ( )
inlineprotected

Definition at line 197 of file Worker.h.

References actReg_.

197 { return actReg_.get(); }
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
void edm::Worker::addedToPath ( )
inline

Definition at line 153 of file Worker.h.

References numberOfPathsOn_.

Referenced by edm::WorkerInPath::WorkerInPath().

153  {
155  }
int numberOfPathsOn_
Definition: Worker.h:388
void edm::Worker::beginJob ( void  )

Definition at line 231 of file Worker.cc.

References actReg_, cms::Exception::addContext(), description(), Exception, implBeginJob(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), state_, and edm::convertException::wrap().

Referenced by edm::WorkerManager::beginJob(), and edm::GlobalSchedule::replaceModule().

231  {
232  try {
233  convertException::wrap([&]() {
234  ModuleBeginJobSignalSentry cpp(actReg_.get(), description());
235  implBeginJob();
236  });
237  }
238  catch(cms::Exception& ex) {
239  state_ = Exception;
240  std::ostringstream ost;
241  ost << "Calling beginJob for module " << description().moduleName() << "/'" << description().moduleLabel() << "'";
242  ex.addContext(ost.str());
243  throw;
244  }
245  }
ModuleDescription const & description() const
Definition: Worker.h:123
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
std::string const & moduleName() const
std::string const & moduleLabel() const
std::atomic< State > state_
Definition: Worker.h:387
virtual void implBeginJob()=0
void addContext(std::string const &context)
Definition: Exception.cc:227
auto wrap(F iFunc) -> decltype(iFunc())
void edm::Worker::beginStream ( StreamID  id,
StreamContext streamContext 
)

Definition at line 263 of file Worker.cc.

References actReg_, cms::Exception::addContext(), description(), Exception, implBeginStream(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::RunIndex::invalidRunIndex(), edm::StreamContext::kBeginStream, edm::ModuleCallingContext::kRunning, moduleCallingContext_, edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), edm::StreamContext::setEventID(), edm::StreamContext::setLuminosityBlockIndex(), edm::StreamContext::setRunIndex(), edm::ModuleCallingContext::setState(), edm::StreamContext::setTimestamp(), edm::StreamContext::setTransition(), state_, and edm::convertException::wrap().

Referenced by edm::StreamSchedule::replaceModule().

263  {
264  try {
265  convertException::wrap([&]() {
266  streamContext.setTransition(StreamContext::Transition::kBeginStream);
267  streamContext.setEventID(EventID(0, 0, 0));
268  streamContext.setRunIndex(RunIndex::invalidRunIndex());
269  streamContext.setLuminosityBlockIndex(LuminosityBlockIndex::invalidLuminosityBlockIndex());
270  streamContext.setTimestamp(Timestamp());
271  ParentContext parentContext(&streamContext);
272  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
274  ModuleBeginStreamSignalSentry beginSentry(actReg_.get(), streamContext, moduleCallingContext_);
275  implBeginStream(id);
276  });
277  }
278  catch(cms::Exception& ex) {
279  state_ = Exception;
280  std::ostringstream ost;
281  ost << "Calling beginStream for module " << description().moduleName() << "/'" << description().moduleLabel() << "'";
282  ex.addContext(ost.str());
283  throw;
284  }
285  }
ModuleDescription const & description() const
Definition: Worker.h:123
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
std::string const & moduleName() const
std::string const & moduleLabel() const
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
std::atomic< State > state_
Definition: Worker.h:387
static LuminosityBlockIndex invalidLuminosityBlockIndex()
void addContext(std::string const &context)
Definition: Exception.cc:227
virtual void implBeginStream(StreamID)=0
auto wrap(F iFunc) -> decltype(iFunc())
void edm::Worker::callWhenDoneAsync ( WaitingTask task)
inline

Definition at line 98 of file Worker.h.

References edm::WaitingTaskList::add(), and waitingTasks_.

Referenced by edm::PuttableProductResolver::prefetchAsync_().

98  {
99  waitingTasks_.add(task);
100  }
void add(WaitingTask *)
Adds task to the waiting list.
edm::WaitingTaskList waitingTasks_
Definition: Worker.h:400
void edm::Worker::clearCounters ( )
inline

Definition at line 145 of file Worker.h.

References timesExcept_, timesFailed_, timesPassed_, timesRun_, and timesVisited_.

Referenced by edm::StreamSchedule::clearCounters().

145  {
146  timesRun_.store(0,std::memory_order_relaxed);
147  timesVisited_.store(0,std::memory_order_relaxed);
148  timesPassed_.store(0,std::memory_order_relaxed);
149  timesFailed_.store(0,std::memory_order_relaxed);
150  timesExcept_.store(0,std::memory_order_relaxed);
151  }
std::atomic< int > timesVisited_
Definition: Worker.h:383
std::atomic< int > timesExcept_
Definition: Worker.h:386
std::atomic< int > timesFailed_
Definition: Worker.h:385
std::atomic< int > timesPassed_
Definition: Worker.h:384
std::atomic< int > timesRun_
Definition: Worker.h:382
virtual std::vector<ConsumesInfo> edm::Worker::consumesInfo ( ) const
pure virtual
ModuleDescription const* edm::Worker::descPtr ( ) const
inline

Definition at line 124 of file Worker.h.

References moduleCallingContext_, and edm::ModuleCallingContext::moduleDescription().

ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
ModuleDescription const * moduleDescription() const
ModuleDescription const& edm::Worker::description ( ) const
inline
template<typename T >
bool edm::Worker::doWork ( typename T::MyPrincipal const &  ep,
EventSetup const &  c,
StreamID  stream,
ParentContext const &  parentContext,
typename T::Context const *  context 
)

Definition at line 671 of file Worker.h.

References actReg_, edm::WaitingTaskList::add(), assert(), cached_exception_, edm::WaitingTaskList::doneWaiting(), emitPostModuleEventPrefetchingSignal(), Fail, edm::ServiceRegistry::instance(), edm::ModuleCallingContext::kInvalid, edm::ModuleCallingContext::kPrefetching, edm::make_empty_waiting_task(), moduleCallingContext_, Pass, prefetchAsync(), edm::ServiceRegistry::presentToken(), mps_fire::queue, Ready, serializeRunModule(), edm::ModuleCallingContext::setContext(), shouldRethrowException(), state_, timesRun_, timesVisited_, waitingTasks_, workStarted_, and edm::convertException::wrap().

Referenced by edm::WorkerInPath::runWorker().

675  {
676 
677  if (T::isEvent_) {
678  timesVisited_.fetch_add(1,std::memory_order_relaxed);
679  }
680  bool rc = false;
681 
682  switch(state_) {
683  case Ready: break;
684  case Pass: return true;
685  case Fail: return false;
686  case Exception: {
687  std::rethrow_exception(cached_exception_);
688  }
689  }
690 
691  bool expected = false;
692  if(not workStarted_.compare_exchange_strong(expected, true) ) {
693  //another thread beat us here
694  auto waitTask = edm::make_empty_waiting_task();
695  waitTask->increment_ref_count();
696 
697  waitingTasks_.add(waitTask.get());
698 
699  waitTask->wait_for_all();
700 
701  switch(state_) {
702  case Ready: assert(false);
703  case Pass: return true;
704  case Fail: return false;
705  case Exception: {
706  std::rethrow_exception(cached_exception_);
707  }
708  }
709  }
710 
711  //Need the context to be set until after any exception is resolved
713 
714  auto resetContext = [](ModuleCallingContext* iContext) {iContext->setContext(ModuleCallingContext::State::kInvalid,ParentContext(),nullptr); };
715  std::unique_ptr<ModuleCallingContext, decltype(resetContext)> prefetchSentry(&moduleCallingContext_,resetContext);
716 
717  try {
718  convertException::wrap([&]() {
719 
720  if (T::isEvent_) {
721 
722  //if have TriggerResults based selection we want to reject the event before doing prefetching
723  if( not workerhelper::CallImpl<T>::prePrefetchSelection(this,streamID,ep,&moduleCallingContext_) ) {
724  timesRun_.fetch_add(1,std::memory_order_relaxed);
725  rc = setPassed<T::isEvent_>();
726  waitingTasks_.doneWaiting(nullptr);
727  return;
728  }
729  auto waitTask = edm::make_empty_waiting_task();
730  {
731  //Make sure signal is sent once the prefetching is done
732  // [the 'pre' signal was sent in prefetchAsync]
733  //The purpose of this block is to send the signal after wait_for_all
734  auto sentryFunc = [this](void*) {
736  };
737  std::unique_ptr<ActivityRegistry, decltype(sentryFunc)> signalSentry(actReg_.get(),sentryFunc);
738 
739  //set count to 2 since wait_for_all requires value to not go to 0
740  waitTask->set_ref_count(2);
741 
742  prefetchAsync(waitTask.get(),parentContext, ep);
743  waitTask->decrement_ref_count();
744  waitTask->wait_for_all();
745  }
746  if(waitTask->exceptionPtr() != nullptr) {
747  std::rethrow_exception(*(waitTask->exceptionPtr()));
748  }
749  }
750  //successful prefetch so no reset necessary
751  prefetchSentry.release();
752  if(auto queue = serializeRunModule()) {
753  auto serviceToken = ServiceRegistry::instance().presentToken();
754  queue->pushAndWait([&]() {
755  //Need to make the services available
756  ServiceRegistry::Operate guard(serviceToken);
757  rc = runModule<T>(ep,es,streamID,parentContext,context);
758  });
759  } else {
760  rc = runModule<T>(ep,es,streamID,parentContext,context);
761  }
762  });
763  }
764  catch(cms::Exception& ex) {
765  TransitionIDValue<typename T::MyPrincipal> idValue(ep);
766  if(shouldRethrowException(ex, parentContext, T::isEvent_, idValue)) {
768  setException<T::isEvent_>(std::current_exception());
770  std::rethrow_exception(cached_exception_);
771  } else {
772  rc = setPassed<T::isEvent_>();
773  }
774  }
775  waitingTasks_.doneWaiting(nullptr);
776  return rc;
777  }
bool shouldRethrowException(cms::Exception &ex, ParentContext const &parentContext, bool isEvent, TransitionIDValueBase const &iID) const
Definition: Worker.cc:155
std::atomic< int > timesVisited_
Definition: Worker.h:383
std::atomic< bool > workStarted_
Definition: Worker.h:401
void add(WaitingTask *)
Adds task to the waiting list.
assert(m_qm.get())
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
virtual SerialTaskQueueChain * serializeRunModule()=0
ServiceToken presentToken() const
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
std::exception_ptr cached_exception_
Definition: Worker.h:394
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
edm::WaitingTaskList waitingTasks_
Definition: Worker.h:400
std::unique_ptr< edm::EmptyWaitingTask, waitingtask::TaskDestroyer > make_empty_waiting_task()
Create an EmptyWaitingTask which will properly be destroyed.
static ServiceRegistry & instance()
std::atomic< State > state_
Definition: Worker.h:387
void prefetchAsync(WaitingTask *, ParentContext const &parentContext, Principal const &)
Definition: Worker.cc:198
void emitPostModuleEventPrefetchingSignal()
Definition: Worker.h:290
auto wrap(F iFunc) -> decltype(iFunc())
std::atomic< int > timesRun_
Definition: Worker.h:382
template<typename T >
void edm::Worker::doWorkAsync ( WaitingTask task,
typename T::MyPrincipal const &  ep,
EventSetup const &  c,
StreamID  stream,
ParentContext const &  parentContext,
typename T::Context const *  context 
)

Definition at line 602 of file Worker.h.

References edm::WaitingTaskList::add(), edm::WaitingTaskList::doneWaiting(), edm::ModuleCallingContext::kPrefetching, moduleCallingContext_, prefetchAsync(), edm::ModuleCallingContext::setContext(), timesVisited_, waitingTasks_, and workStarted_.

Referenced by edm::UnscheduledProductResolver::prefetchAsync_(), and edm::WorkerInPath::runWorkerAsync().

607  {
608  waitingTasks_.add(task);
609  if(T::isEvent_) {
610  timesVisited_.fetch_add(1,std::memory_order_relaxed);
611  }
612 
613  bool expected = false;
614  if(workStarted_.compare_exchange_strong(expected,true)) {
616 
617  //if have TriggerResults based selection we want to reject the event before doing prefetching
618  if( not workerhelper::CallImpl<T>::prePrefetchSelection(this,streamID,ep,&moduleCallingContext_) ) {
619  setPassed<T::isEvent_>();
620  waitingTasks_.doneWaiting(nullptr);
621  return;
622  }
623 
624  auto runTask = new (tbb::task::allocate_root()) RunModuleTask<T>(
625  this, ep,es,streamID,parentContext,context);
626  prefetchAsync(runTask, parentContext, ep);
627  }
628  }
std::atomic< int > timesVisited_
Definition: Worker.h:383
std::atomic< bool > workStarted_
Definition: Worker.h:401
void add(WaitingTask *)
Adds task to the waiting list.
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
edm::WaitingTaskList waitingTasks_
Definition: Worker.h:400
void prefetchAsync(WaitingTask *, ParentContext const &parentContext, Principal const &)
Definition: Worker.cc:198
void edm::Worker::emitPostModuleEventPrefetchingSignal ( )
inlineprivate

Definition at line 290 of file Worker.h.

References actReg_, edm::ModuleCallingContext::getStreamContext(), and moduleCallingContext_.

Referenced by doWork(), and edm::Worker::RunModuleTask< T >::execute().

290  {
291  actReg_->postModuleEventPrefetchingSignal_.emit(*moduleCallingContext_.getStreamContext(),moduleCallingContext_);
292  }
StreamContext const * getStreamContext() const
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
void edm::Worker::endJob ( void  )

Definition at line 247 of file Worker.cc.

References actReg_, cms::Exception::addContext(), description(), Exception, implEndJob(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), state_, and edm::convertException::wrap().

247  {
248  try {
249  convertException::wrap([&]() {
250  ModuleEndJobSignalSentry cpp(actReg_.get(), description());
251  implEndJob();
252  });
253  }
254  catch(cms::Exception& ex) {
255  state_ = Exception;
256  std::ostringstream ost;
257  ost << "Calling endJob for module " << description().moduleName() << "/'" << description().moduleLabel() << "'";
258  ex.addContext(ost.str());
259  throw;
260  }
261  }
ModuleDescription const & description() const
Definition: Worker.h:123
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
std::string const & moduleName() const
std::string const & moduleLabel() const
std::atomic< State > state_
Definition: Worker.h:387
virtual void implEndJob()=0
void addContext(std::string const &context)
Definition: Exception.cc:227
auto wrap(F iFunc) -> decltype(iFunc())
void edm::Worker::endStream ( StreamID  id,
StreamContext streamContext 
)

Definition at line 287 of file Worker.cc.

References actReg_, cms::Exception::addContext(), description(), Exception, implEndStream(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::RunIndex::invalidRunIndex(), edm::StreamContext::kEndStream, edm::ModuleCallingContext::kRunning, moduleCallingContext_, edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), edm::StreamContext::setEventID(), edm::StreamContext::setLuminosityBlockIndex(), edm::StreamContext::setRunIndex(), edm::ModuleCallingContext::setState(), edm::StreamContext::setTimestamp(), edm::StreamContext::setTransition(), state_, and edm::convertException::wrap().

287  {
288  try {
289  convertException::wrap([&]() {
290  streamContext.setTransition(StreamContext::Transition::kEndStream);
291  streamContext.setEventID(EventID(0, 0, 0));
292  streamContext.setRunIndex(RunIndex::invalidRunIndex());
293  streamContext.setLuminosityBlockIndex(LuminosityBlockIndex::invalidLuminosityBlockIndex());
294  streamContext.setTimestamp(Timestamp());
295  ParentContext parentContext(&streamContext);
296  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
298  ModuleEndStreamSignalSentry endSentry(actReg_.get(), streamContext, moduleCallingContext_);
299  implEndStream(id);
300  });
301  }
302  catch(cms::Exception& ex) {
303  state_ = Exception;
304  std::ostringstream ost;
305  ost << "Calling endStream for module " << description().moduleName() << "/'" << description().moduleLabel() << "'";
306  ex.addContext(ost.str());
307  throw;
308  }
309  }
ModuleDescription const & description() const
Definition: Worker.h:123
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
std::string const & moduleName() const
std::string const & moduleLabel() const
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
std::atomic< State > state_
Definition: Worker.h:387
static LuminosityBlockIndex invalidLuminosityBlockIndex()
void addContext(std::string const &context)
Definition: Exception.cc:227
virtual void implEndStream(StreamID)=0
auto wrap(F iFunc) -> decltype(iFunc())
void edm::Worker::exceptionContext ( const std::string &  iID,
bool  iIsEvent,
cms::Exception ex,
ModuleCallingContext const *  mcc 
)
staticprivate

Definition at line 99 of file Worker.cc.

References cms::Exception::addContext(), edm::ModuleCallingContext::internalContext(), edm::ParentContext::kInternal, edm::ParentContext::kModule, edm::ParentContext::kPlaceInPath, edm::InternalContext::moduleCallingContext(), edm::ModuleCallingContext::moduleCallingContext(), edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), edm::PlaceInPathContext::pathContext(), edm::PathContext::pathName(), edm::ModuleCallingContext::placeInPathContext(), and edm::ModuleCallingContext::type().

Referenced by shouldRethrowException().

102  {
103 
104  ModuleCallingContext const* imcc = mcc;
105  while(imcc->type() == ParentContext::Type::kModule) {
106  std::ostringstream iost;
107  iost << "Calling method for module "
108  << imcc->moduleDescription()->moduleName() << "/'"
109  << imcc->moduleDescription()->moduleLabel() << "'";
110  ex.addContext(iost.str());
111  imcc = imcc->moduleCallingContext();
112  }
113  if(imcc->type() == ParentContext::Type::kInternal) {
114  std::ostringstream iost;
115  iost << "Calling method for module "
116  << imcc->moduleDescription()->moduleName() << "/'"
117  << imcc->moduleDescription()->moduleLabel() << "' (probably inside some kind of mixing module)";
118  ex.addContext(iost.str());
119  imcc = imcc->internalContext()->moduleCallingContext();
120  }
121  while(imcc->type() == ParentContext::Type::kModule) {
122  std::ostringstream iost;
123  iost << "Calling method for module "
124  << imcc->moduleDescription()->moduleName() << "/'"
125  << imcc->moduleDescription()->moduleLabel() << "'";
126  ex.addContext(iost.str());
127  imcc = imcc->moduleCallingContext();
128  }
129  std::ostringstream ost;
130  if (iIsEvent) {
131  ost << "Calling event method";
132  }
133  else {
134  // It should be impossible to get here, because
135  // this function only gets called when the IgnoreCompletely
136  // exception behavior is active, which can only be true
137  // for events.
138  ost << "Calling unknown function";
139  }
140  ost << " for module " << imcc->moduleDescription()->moduleName() << "/'" << imcc->moduleDescription()->moduleLabel() << "'";
141  ex.addContext(ost.str());
142 
143  if (imcc->type() == ParentContext::Type::kPlaceInPath) {
144  ost.str("");
145  ost << "Running path '";
146  ost << imcc->placeInPathContext()->pathContext()->pathName() << "'";
147  ex.addContext(ost.str());
148  }
149  ost.str("");
150  ost << "Processing ";
151  ost << iID;
152  ex.addContext(ost.str());
153  }
void addContext(std::string const &context)
Definition: Exception.cc:227
virtual void edm::Worker::implBeginJob ( )
protectedpure virtual

Implemented in edm::WorkerT< T >.

Referenced by beginJob().

virtual void edm::Worker::implBeginStream ( StreamID  )
protectedpure virtual

Implemented in edm::WorkerT< T >.

Referenced by beginStream().

virtual bool edm::Worker::implDo ( EventPrincipal const &  ,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual
virtual bool edm::Worker::implDoBegin ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual
virtual bool edm::Worker::implDoBegin ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual

Implemented in edm::WorkerT< T >.

virtual bool edm::Worker::implDoEnd ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual
virtual bool edm::Worker::implDoEnd ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual

Implemented in edm::WorkerT< T >.

virtual bool edm::Worker::implDoPrePrefetchSelection ( StreamID  id,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
protectedpure virtual
virtual bool edm::Worker::implDoStreamBegin ( StreamID  id,
RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual
virtual bool edm::Worker::implDoStreamBegin ( StreamID  id,
LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual

Implemented in edm::WorkerT< T >.

virtual bool edm::Worker::implDoStreamEnd ( StreamID  id,
RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual
virtual bool edm::Worker::implDoStreamEnd ( StreamID  id,
LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protectedpure virtual

Implemented in edm::WorkerT< T >.

virtual void edm::Worker::implEndJob ( )
protectedpure virtual

Implemented in edm::WorkerT< T >.

Referenced by endJob().

virtual void edm::Worker::implEndStream ( StreamID  )
protectedpure virtual

Implemented in edm::WorkerT< T >.

Referenced by endStream().

virtual void edm::Worker::implPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
privatepure virtual

Implemented in edm::WorkerT< T >.

Referenced by postForkReacquireResources().

virtual void edm::Worker::implPreForkReleaseResources ( )
privatepure virtual

Implemented in edm::WorkerT< T >.

Referenced by preForkReleaseResources().

virtual void edm::Worker::implRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
privatepure virtual

Implemented in edm::WorkerT< T >.

Referenced by registerThinnedAssociations().

virtual void edm::Worker::implRespondToCloseInputFile ( FileBlock const &  fb)
privatepure virtual

Implemented in edm::WorkerT< T >.

Referenced by respondToCloseInputFile().

virtual void edm::Worker::implRespondToOpenInputFile ( FileBlock const &  fb)
privatepure virtual

Implemented in edm::WorkerT< T >.

Referenced by respondToOpenInputFile().

virtual void edm::Worker::itemsMayGet ( BranchType  ,
std::vector< ProductResolverIndexAndSkipBit > &   
) const
privatepure virtual

Implemented in edm::WorkerT< T >.

virtual std::vector<ProductResolverIndex> const& edm::Worker::itemsShouldPutInEvent ( ) const
privatepure virtual

Implemented in edm::WorkerT< T >.

virtual void edm::Worker::itemsToGet ( BranchType  ,
std::vector< ProductResolverIndexAndSkipBit > &   
) const
privatepure virtual

Implemented in edm::WorkerT< T >.

virtual std::vector<ProductResolverIndexAndSkipBit> const& edm::Worker::itemsToGetFromEvent ( ) const
privatepure virtual

Implemented in edm::WorkerT< T >.

Referenced by prefetchAsync().

virtual void edm::Worker::modulesWhoseProductsAreConsumed ( std::vector< ModuleDescription const * > &  modules,
ProductRegistry const &  preg,
std::map< std::string, ModuleDescription const * > const &  labelsToDesc 
) const
pure virtual

Implemented in edm::WorkerT< T >.

virtual Types edm::Worker::moduleType ( ) const
pure virtual
Worker& edm::Worker::operator= ( Worker const &  )
delete
void edm::Worker::postDoEvent ( EventPrincipal const &  iEvent)

Definition at line 317 of file Worker.cc.

References earlyDeleteHelper_.

Referenced by edm::WorkerT< T >::implDo().

317  {
318  if(earlyDeleteHelper_) {
319  earlyDeleteHelper_->moduleRan(iEvent);
320  }
321  }
int iEvent
Definition: GenABIO.cc:230
edm::propagate_const< EarlyDeleteHelper * > earlyDeleteHelper_
Definition: Worker.h:398
void edm::Worker::postForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
inline

Definition at line 110 of file Worker.h.

References implPostForkReacquireResources().

Referenced by edm::Schedule::postForkReacquireResources().

110 {implPostForkReacquireResources(iChildIndex, iNumberOfChildren);}
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)=0
void edm::Worker::prefetchAsync ( WaitingTask iTask,
ParentContext const &  parentContext,
Principal const &  iPrincipal 
)
private

Definition at line 198 of file Worker.cc.

References actReg_, edm::ModuleCallingContext::getStreamContext(), mps_monitormerge::items, itemsToGetFromEvent(), edm::ModuleCallingContext::kPrefetching, moduleCallingContext_, edm::Principal::prefetchAsync(), edm::ProductResolverIndexAmbiguous, and edm::ModuleCallingContext::setContext().

Referenced by doWork(), and doWorkAsync().

198  {
199  // Prefetch products the module declares it consumes (not including the products it maybe consumes)
200  std::vector<ProductResolverIndexAndSkipBit> const& items = itemsToGetFromEvent();
201 
203 
204  actReg_->preModuleEventPrefetchingSignal_.emit(*moduleCallingContext_.getStreamContext(),moduleCallingContext_);
205 
206  //Need to be sure the ref count isn't set to 0 immediately
207  iTask->increment_ref_count();
208  for(auto const& item : items) {
209  ProductResolverIndex productResolverIndex = item.productResolverIndex();
210  bool skipCurrentProcess = item.skipCurrentProcess();
211  if(productResolverIndex != ProductResolverIndexAmbiguous) {
212  iPrincipal.prefetchAsync(iTask,productResolverIndex, skipCurrentProcess, &moduleCallingContext_);
213  }
214  }
215  if(0 == iTask->decrement_ref_count()) {
216  //if everything finishes before we leave this routine, we need to launch the task
217  tbb::task::spawn(*iTask);
218  }
219  }
unsigned int ProductResolverIndex
StreamContext const * getStreamContext() const
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
virtual std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent() const =0
void edm::Worker::preForkReleaseResources ( )
inline

Definition at line 109 of file Worker.h.

References implPreForkReleaseResources().

Referenced by edm::Schedule::preForkReleaseResources().

virtual void implPreForkReleaseResources()=0
void edm::Worker::registerThinnedAssociations ( ProductRegistry const &  registry,
ThinnedAssociationsHelper helper 
)
inline

Definition at line 111 of file Worker.h.

References implRegisterThinnedAssociations().

virtual void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)=0
static Interceptor::Registry registry("Interceptor")
void edm::Worker::reset ( void  )
inline

Definition at line 113 of file Worker.h.

References cached_exception_, numberOfPathsLeftToRun_, numberOfPathsOn_, Ready, edm::WaitingTaskList::reset(), state_, waitingTasks_, and workStarted_.

Referenced by edm::WorkerManager::resetAll().

113  {
114  cached_exception_ = std::exception_ptr();
115  state_ = Ready;
117  workStarted_ = false;
119  }
std::atomic< int > numberOfPathsLeftToRun_
Definition: Worker.h:389
std::atomic< bool > workStarted_
Definition: Worker.h:401
void reset()
Resets access to the resource so that added tasks will wait.
std::exception_ptr cached_exception_
Definition: Worker.h:394
edm::WaitingTaskList waitingTasks_
Definition: Worker.h:400
std::atomic< State > state_
Definition: Worker.h:387
int numberOfPathsOn_
Definition: Worker.h:388
void edm::Worker::resetModuleDescription ( ModuleDescription const *  iDesc)
protected
virtual void edm::Worker::resolvePutIndicies ( BranchType  iBranchType,
std::unordered_multimap< std::string, edm::ProductResolverIndex > const &  iIndicies 
)
pure virtual

Implemented in edm::WorkerT< T >.

void edm::Worker::respondToCloseInputFile ( FileBlock const &  fb)
inline

Definition at line 107 of file Worker.h.

References implRespondToCloseInputFile().

Referenced by edm::Schedule::respondToCloseInputFile().

virtual void implRespondToCloseInputFile(FileBlock const &fb)=0
void edm::Worker::respondToOpenInputFile ( FileBlock const &  fb)
inline

Definition at line 106 of file Worker.h.

References implRespondToOpenInputFile().

Referenced by edm::Schedule::respondToOpenInputFile().

virtual void implRespondToOpenInputFile(FileBlock const &fb)=0
template<typename T >
bool edm::Worker::runModule ( typename T::MyPrincipal const &  ep,
EventSetup const &  c,
StreamID  stream,
ParentContext const &  parentContext,
typename T::Context const *  context 
)
private

Definition at line 781 of file Worker.h.

References actReg_, moduleCallingContext_, and timesRun_.

785  {
786  //unscheduled producers should advance this
787  //if (T::isEvent_) {
788  // ++timesVisited_;
789  //}
790  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
791  if (T::isEvent_) {
792  timesRun_.fetch_add(1,std::memory_order_relaxed);
793  }
794 
795  bool rc = workerhelper::CallImpl<T>::call(this,streamID,ep,es, actReg_.get(), &moduleCallingContext_, context);
796 
797  if (rc) {
798  setPassed<T::isEvent_>();
799  } else {
800  setFailed<T::isEvent_>();
801  }
802  return rc;
803  }
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
std::atomic< int > timesRun_
Definition: Worker.h:382
template<typename T >
void edm::Worker::runModuleAfterAsyncPrefetch ( std::exception_ptr const *  iEPtr,
typename T::MyPrincipal const &  ep,
EventSetup const &  es,
StreamID  streamID,
ParentContext const &  parentContext,
typename T::Context const *  context 
)
private

Definition at line 631 of file Worker.h.

References cms::Exception::addContext(), assert(), cached_exception_, description(), edm::WaitingTaskList::doneWaiting(), edm::ModuleCallingContext::kInvalid, moduleCallingContext_, edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), edm::ModuleCallingContext::setContext(), shouldRethrowException(), waitingTasks_, and edm::convertException::wrap().

Referenced by edm::Worker::RunModuleTask< T >::execute().

636  {
637  try {
638  convertException::wrap([&]() {
639  if(iEPtr) {
640  assert(*iEPtr);
642  std::rethrow_exception(*iEPtr);
643  }
644 
645  runModule<T>(ep,es,streamID,parentContext,context);
646  });
647  } catch( cms::Exception& iException) {
648  TransitionIDValue<typename T::MyPrincipal> idValue(ep);
649  if(shouldRethrowException(iException, parentContext, T::isEvent_, idValue)) {
651  std::ostringstream iost;
652  if(iEPtr) {
653  iost<<"Prefetching for module ";
654  } else {
655  iost<<"Calling method for module ";
656  }
657  iost<<description().moduleName() << "/'"
658  << description().moduleLabel() << "'";
659  iException.addContext(iost.str());
660  setException<T::isEvent_>(std::current_exception());
662  return;
663  } else {
664  setPassed<T::isEvent_>();
665  }
666  }
667  waitingTasks_.doneWaiting(nullptr);
668  }
bool shouldRethrowException(cms::Exception &ex, ParentContext const &parentContext, bool isEvent, TransitionIDValueBase const &iID) const
Definition: Worker.cc:155
ModuleDescription const & description() const
Definition: Worker.h:123
assert(m_qm.get())
std::string const & moduleName() const
std::string const & moduleLabel() const
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
ModuleCallingContext moduleCallingContext_
Definition: Worker.h:391
std::exception_ptr cached_exception_
Definition: Worker.h:394
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
edm::WaitingTaskList waitingTasks_
Definition: Worker.h:400
void addContext(std::string const &context)
Definition: Exception.cc:227
auto wrap(F iFunc) -> decltype(iFunc())
virtual SerialTaskQueueChain* edm::Worker::serializeRunModule ( )
privatepure virtual
void edm::Worker::setActivityRegistry ( std::shared_ptr< ActivityRegistry areg)

The signals are required to live longer than the last call to 'doWork' this was done to improve performance based on profiling

Definition at line 94 of file Worker.cc.

References actReg_, and edm::areg.

94  {
95  actReg_ = areg;
96  }
std::shared_ptr< ActivityRegistry > actReg_
Definition: Worker.h:396
areg
Definition: Schedule.cc:384
void edm::Worker::setEarlyDeleteHelper ( EarlyDeleteHelper iHelper)

Definition at line 221 of file Worker.cc.

References earlyDeleteHelper_.

221  {
222  earlyDeleteHelper_=iHelper;
223  }
edm::propagate_const< EarlyDeleteHelper * > earlyDeleteHelper_
Definition: Worker.h:398
template<bool IS_EVENT>
std::exception_ptr edm::Worker::setException ( std::exception_ptr  iException)
inlineprivate

Definition at line 277 of file Worker.h.

References cached_exception_, Exception, state_, and timesExcept_.

277  {
278  if (IS_EVENT) {
279  timesExcept_.fetch_add(1,std::memory_order_relaxed);
280  }
281  cached_exception_ = iException; // propagate_const<T> has no reset() function
282  state_ = Exception;
283  return cached_exception_;
284  }
std::atomic< int > timesExcept_
Definition: Worker.h:386
std::exception_ptr cached_exception_
Definition: Worker.h:394
std::atomic< State > state_
Definition: Worker.h:387
template<bool IS_EVENT>
bool edm::Worker::setFailed ( )
inlineprivate

Definition at line 268 of file Worker.h.

References Fail, state_, and timesFailed_.

268  {
269  if(IS_EVENT) {
270  timesFailed_.fetch_add(1,std::memory_order_relaxed);
271  }
272  state_ = Fail;
273  return false;
274  }
std::atomic< int > timesFailed_
Definition: Worker.h:385
std::atomic< State > state_
Definition: Worker.h:387
template<bool IS_EVENT>
bool edm::Worker::setPassed ( )
inlineprivate

Definition at line 259 of file Worker.h.

References Pass, state_, and timesPassed_.

259  {
260  if(IS_EVENT) {
261  timesPassed_.fetch_add(1,std::memory_order_relaxed);
262  }
263  state_ = Pass;
264  return true;
265  }
std::atomic< State > state_
Definition: Worker.h:387
std::atomic< int > timesPassed_
Definition: Worker.h:384
bool edm::Worker::shouldRethrowException ( cms::Exception ex,
ParentContext const &  parentContext,
bool  isEvent,
TransitionIDValueBase const &  iID 
) const
private

Definition at line 155 of file Worker.cc.

References mps_fire::action, actions_, cms::Exception::category(), description(), exceptionContext(), edm::exception_actions::FailPath, edm::ExceptionToActionTable::find(), edm::ModuleCallingContext::getTopModuleCallingContext(), edm::exception_actions::IgnoreCompletely, edm::PathContext::isEndPath(), edm::ModuleCallingContext::kInvalid, edm::ParentContext::kPlaceInPath, edm::PlaceInPathContext::pathContext(), edm::ModuleCallingContext::placeInPathContext(), edm::printCmsExceptionWarning(), edm::exception_actions::Rethrow, edm::exception_actions::SkipEvent, edm::ModuleCallingContext::type(), and edm::Worker::TransitionIDValueBase::value().

Referenced by doWork(), and runModuleAfterAsyncPrefetch().

158  {
159 
160  // NOTE: the warning printed as a result of ignoring or failing
161  // a module will only be printed during the full true processing
162  // pass of this module
163 
164  // Get the action corresponding to this exception. However, if processing
165  // something other than an event (e.g. run, lumi) always rethrow.
167 
168  if(action == exception_actions::Rethrow) {
169  return true;
170  }
171 
172  ModuleCallingContext tempContext(&description(),ModuleCallingContext::State::kInvalid, parentContext, nullptr);
173 
174  // If we are processing an endpath and the module was scheduled, treat SkipEvent or FailPath
175  // as IgnoreCompletely, so any subsequent OutputModules are still run.
176  // For unscheduled modules only treat FailPath as IgnoreCompletely but still allow SkipEvent to throw
177  ModuleCallingContext const* top_mcc = tempContext.getTopModuleCallingContext();
178  if(top_mcc->type() == ParentContext::Type::kPlaceInPath &&
179  top_mcc->placeInPathContext()->pathContext()->isEndPath()) {
180 
181  if ((action == exception_actions::SkipEvent && tempContext.type() == ParentContext::Type::kPlaceInPath) ||
183  }
184  switch(action) {
186  {
187  exceptionContext(iID.value(), isEvent, ex, &tempContext);
188  edm::printCmsExceptionWarning("IgnoreCompletely", ex);
189  return false;
190  break;
191  }
192  default:
193  return true;
194  }
195  }
ModuleDescription const & description() const
Definition: Worker.h:123
std::string const & category() const
Definition: Exception.cc:183
exception_actions::ActionCodes find(const std::string &category) const
ExceptionToActionTable const * actions_
Definition: Worker.h:393
string action
Definition: mps_fire.py:28
static void exceptionContext(const std::string &iID, bool iIsEvent, cms::Exception &ex, ModuleCallingContext const *mcc)
Definition: Worker.cc:99
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e)
void edm::Worker::skipOnPath ( )

Definition at line 311 of file Worker.cc.

References cached_exception_, edm::WaitingTaskList::doneWaiting(), numberOfPathsLeftToRun_, and waitingTasks_.

Referenced by edm::WorkerInPath::skipWorker().

311  {
312  if( 0 == --numberOfPathsLeftToRun_) {
314  }
315  }
std::atomic< int > numberOfPathsLeftToRun_
Definition: Worker.h:389
std::exception_ptr cached_exception_
Definition: Worker.h:394
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
edm::WaitingTaskList waitingTasks_
Definition: Worker.h:400
State edm::Worker::state ( ) const
inline

Definition at line 162 of file Worker.h.

References state_.

Referenced by edm::WorkerInPath::checkResultsOfRunWorker().

162 { return state_; }
std::atomic< State > state_
Definition: Worker.h:387
int edm::Worker::timesExcept ( ) const
inline

Definition at line 161 of file Worker.h.

References timesExcept_.

Referenced by edm::fillWorkerSummaryAux().

161 { return timesExcept_.load(std::memory_order_relaxed); }
std::atomic< int > timesExcept_
Definition: Worker.h:386
int edm::Worker::timesFailed ( ) const
inline

Definition at line 160 of file Worker.h.

References timesFailed_.

Referenced by edm::fillWorkerSummaryAux().

160 { return timesFailed_.load(std::memory_order_relaxed); }
std::atomic< int > timesFailed_
Definition: Worker.h:385
int edm::Worker::timesPass ( ) const
inline

Definition at line 164 of file Worker.h.

References timesPassed().

164 { return timesPassed(); } // for backward compatibility only - to be removed soon
int timesPassed() const
Definition: Worker.h:159
int edm::Worker::timesPassed ( ) const
inline

Definition at line 159 of file Worker.h.

References timesPassed_.

Referenced by edm::fillWorkerSummaryAux(), and timesPass().

159 { return timesPassed_.load(std::memory_order_relaxed); }
std::atomic< int > timesPassed_
Definition: Worker.h:384
int edm::Worker::timesRun ( ) const
inline

Definition at line 157 of file Worker.h.

References timesRun_.

Referenced by edm::fillWorkerSummaryAux().

157 { return timesRun_.load(std::memory_order_relaxed); }
std::atomic< int > timesRun_
Definition: Worker.h:382
int edm::Worker::timesVisited ( ) const
inline

Definition at line 158 of file Worker.h.

References timesVisited_.

Referenced by edm::fillWorkerSummaryAux().

158 { return timesVisited_.load(std::memory_order_relaxed); }
std::atomic< int > timesVisited_
Definition: Worker.h:383
virtual void edm::Worker::updateLookup ( BranchType  iBranchType,
ProductResolverIndexHelper const &   
)
pure virtual

Implemented in edm::WorkerT< T >.

Referenced by edm::Schedule::changeModule().

virtual std::string edm::Worker::workerType ( ) const
protectedpure virtual

Implemented in edm::WorkerT< T >.

Friends And Related Function Documentation

template<typename O >
friend class workerhelper::CallImpl
friend

Definition at line 167 of file Worker.h.

Member Data Documentation

ExceptionToActionTable const* edm::Worker::actions_
private

Definition at line 393 of file Worker.h.

Referenced by shouldRethrowException().

std::shared_ptr<ActivityRegistry> edm::Worker::actReg_
private
std::exception_ptr edm::Worker::cached_exception_
private

Definition at line 394 of file Worker.h.

Referenced by doWork(), reset(), runModuleAfterAsyncPrefetch(), setException(), and skipOnPath().

edm::propagate_const<EarlyDeleteHelper*> edm::Worker::earlyDeleteHelper_
private

Definition at line 398 of file Worker.h.

Referenced by postDoEvent(), and setEarlyDeleteHelper().

ModuleCallingContext edm::Worker::moduleCallingContext_
private
std::atomic<int> edm::Worker::numberOfPathsLeftToRun_
private

Definition at line 389 of file Worker.h.

Referenced by reset(), and skipOnPath().

int edm::Worker::numberOfPathsOn_
private

Definition at line 388 of file Worker.h.

Referenced by addedToPath(), and reset().

std::atomic<State> edm::Worker::state_
private
std::atomic<int> edm::Worker::timesExcept_
private

Definition at line 386 of file Worker.h.

Referenced by clearCounters(), setException(), and timesExcept().

std::atomic<int> edm::Worker::timesFailed_
private

Definition at line 385 of file Worker.h.

Referenced by clearCounters(), setFailed(), and timesFailed().

std::atomic<int> edm::Worker::timesPassed_
private

Definition at line 384 of file Worker.h.

Referenced by clearCounters(), setPassed(), and timesPassed().

std::atomic<int> edm::Worker::timesRun_
private

Definition at line 382 of file Worker.h.

Referenced by clearCounters(), doWork(), runModule(), and timesRun().

std::atomic<int> edm::Worker::timesVisited_
private

Definition at line 383 of file Worker.h.

Referenced by clearCounters(), doWork(), doWorkAsync(), and timesVisited().

edm::WaitingTaskList edm::Worker::waitingTasks_
private
std::atomic<bool> edm::Worker::workStarted_
private

Definition at line 401 of file Worker.h.

Referenced by doWork(), doWorkAsync(), and reset().