CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
edm::Worker::RunModuleTask< T > Class Template Reference
Inheritance diagram for edm::Worker::RunModuleTask< T >:
edm::WaitingTask

Classes

struct  EnableQueueGuard
 

Public Member Functions

tbb::task * execute () override
 
 RunModuleTask (Worker *worker, typename T::MyPrincipal const &ep, EventSetupImpl const &es, ServiceToken const &token, StreamID streamID, ParentContext const &parentContext, typename T::Context const *context)
 
- Public Member Functions inherited from edm::WaitingTask
std::exception_ptr const * exceptionPtr () const
 Returns exception thrown by dependent task. More...
 
 WaitingTask ()
 Constructor. More...
 
 ~WaitingTask () override
 

Private Attributes

T::Context const * m_context
 
EventSetupImpl const & m_es
 
ParentContext const m_parentContext
 
T::MyPrincipal const & m_principal
 
ServiceToken m_serviceToken
 
StreamID m_streamID
 
Workerm_worker
 

Detailed Description

template<typename T>
class edm::Worker::RunModuleTask< T >

Definition at line 402 of file Worker.h.

Constructor & Destructor Documentation

template<typename T >
edm::Worker::RunModuleTask< T >::RunModuleTask ( Worker worker,
typename T::MyPrincipal const &  ep,
EventSetupImpl const &  es,
ServiceToken const &  token,
StreamID  streamID,
ParentContext const &  parentContext,
typename T::Context const *  context 
)
inline

Definition at line 404 of file Worker.h.

411  : m_worker(worker),
412  m_principal(ep),
413  m_es(es),
414  m_streamID(streamID),
415  m_parentContext(parentContext),
416  m_context(context),
417  m_serviceToken(token) {}
T::Context const * m_context
Definition: Worker.h:498
T::MyPrincipal const & m_principal
Definition: Worker.h:494
ParentContext const m_parentContext
Definition: Worker.h:497
EventSetupImpl const & m_es
Definition: Worker.h:495
ServiceToken m_serviceToken
Definition: Worker.h:499

Member Function Documentation

template<typename T >
tbb::task* edm::Worker::RunModuleTask< T >::execute ( void  )
inlineoverride

Definition at line 433 of file Worker.h.

References f, eostools::move(), cmsRelvalreport::principal(), and createBeamHaloJobs::queue.

433  {
434  //Need to make the services available early so other services can see them
436 
437  //incase the emit causes an exception, we need a memory location
438  // to hold the exception_ptr
439  std::exception_ptr temp_excptr;
440  auto excptr = exceptionPtr();
441  if (T::isEvent_ && !m_worker->hasAcquire()) {
442  try {
443  //pre was called in prefetchAsync
445  } catch (...) {
446  temp_excptr = std::current_exception();
447  if (not excptr) {
448  excptr = &temp_excptr;
449  }
450  }
451  }
452 
453  if (not excptr) {
454  if (auto queue = m_worker->serializeRunModule()) {
455  auto const& principal = m_principal;
456  auto& es = m_es;
457  auto f = [worker = m_worker,
458  &principal,
459  &es,
460  streamID = m_streamID,
461  parentContext = m_parentContext,
462  sContext = m_context,
463  serviceToken = m_serviceToken]() {
464  //Need to make the services available
465  ServiceRegistry::Operate guard(serviceToken);
466 
467  //If needed, we pause the queue in begin transition and resume it
468  // at the end transition. This guarantees that the module
469  // only processes one transition at a time
470  EnableQueueGuard enableQueueGuard{workerhelper::CallImpl<T>::enableGlobalQueue(worker)};
471  std::exception_ptr* ptr = nullptr;
472  worker->template runModuleAfterAsyncPrefetch<T>(ptr, principal, es, streamID, parentContext, sContext);
473  };
474  //keep another global transition from running if necessary
475  auto gQueue = workerhelper::CallImpl<T>::pauseGlobalQueue(m_worker);
476  if (gQueue) {
477  gQueue->push([queue, gQueue, f]() mutable {
478  gQueue->pause();
479  queue.push(std::move(f));
480  });
481  } else {
482  queue.push(std::move(f));
483  }
484  return nullptr;
485  }
486  }
487 
489  return nullptr;
490  }
T::Context const * m_context
Definition: Worker.h:498
T::MyPrincipal const & m_principal
Definition: Worker.h:494
ParentContext const m_parentContext
Definition: Worker.h:497
std::exception_ptr runModuleAfterAsyncPrefetch(std::exception_ptr const *iEPtr, typename T::MyPrincipal const &ep, EventSetupImpl const &es, StreamID streamID, ParentContext const &parentContext, typename T::Context const *context)
Definition: Worker.h:897
def principal(options)
double f[11][100]
virtual bool hasAcquire() const =0
virtual TaskQueueAdaptor serializeRunModule()=0
void emitPostModuleEventPrefetchingSignal()
Definition: Worker.h:374
std::exception_ptr const * exceptionPtr() const
Returns exception thrown by dependent task.
Definition: WaitingTask.h:51
long double T
EventSetupImpl const & m_es
Definition: Worker.h:495
def move(src, dest)
Definition: eostools.py:511
ServiceToken m_serviceToken
Definition: Worker.h:499

Member Data Documentation

template<typename T >
T::Context const* edm::Worker::RunModuleTask< T >::m_context
private

Definition at line 498 of file Worker.h.

template<typename T >
EventSetupImpl const& edm::Worker::RunModuleTask< T >::m_es
private

Definition at line 495 of file Worker.h.

template<typename T >
ParentContext const edm::Worker::RunModuleTask< T >::m_parentContext
private

Definition at line 497 of file Worker.h.

template<typename T >
T::MyPrincipal const& edm::Worker::RunModuleTask< T >::m_principal
private

Definition at line 494 of file Worker.h.

template<typename T >
ServiceToken edm::Worker::RunModuleTask< T >::m_serviceToken
private

Definition at line 499 of file Worker.h.

template<typename T >
StreamID edm::Worker::RunModuleTask< T >::m_streamID
private

Definition at line 496 of file Worker.h.

template<typename T >
Worker* edm::Worker::RunModuleTask< T >::m_worker
private

Definition at line 493 of file Worker.h.