Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
art::Worker Class Referenceabstract

#include <Worker.h>

Inheritance diagram for art::Worker:
art::WorkerT< T > art::WorkerT< OutputModule > art::OutputWorker

Public Types

enum  State {
  Ready, Pass, Fail, Working,
  ExceptionThrown
}
 

Public Member Functions

virtual ~Worker ()=default
 
 Worker (ModuleDescription const &, WorkerParams const &)
 
void beginJob (detail::SharedResources const &)
 
void endJob ()
 
void respondToOpenInputFile (FileBlock const &fb)
 
void respondToCloseInputFile (FileBlock const &fb)
 
void respondToOpenOutputFiles (FileBlock const &fb)
 
void respondToCloseOutputFiles (FileBlock const &fb)
 
bool doWork (Transition, Principal &, ModuleContext const &)
 
void doWork_event (hep::concurrency::WaitingTaskPtr workerInPathDoneTask, EventPrincipal &, ModuleContext const &)
 
void doWork_event (EventPrincipal &, ModuleContext const &)
 
ScheduleID scheduleID () const
 
ModuleDescription const & description () const
 
std::string const & label () const
 
bool returnCode () const
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
void reset ()
 
std::size_t timesVisited () const
 
std::size_t timesRun () const
 
std::size_t timesPassed () const
 
std::size_t timesFailed () const
 
std::size_t timesExcept () const
 
void runWorker (EventPrincipal &, ModuleContext const &)
 

Protected Member Functions

virtual std::string workerType () const =0
 
virtual hep::concurrency::SerialTaskQueueChain * implSerialTaskQueueChain () const =0
 
virtual void implBeginJob (detail::SharedResources const &resources)=0
 
virtual void implEndJob ()=0
 
virtual bool implDoBegin (RunPrincipal &rp, ModuleContext const &mc)=0
 
virtual bool implDoEnd (RunPrincipal &rp, ModuleContext const &mc)=0
 
virtual bool implDoBegin (SubRunPrincipal &srp, ModuleContext const &mc)=0
 
virtual bool implDoEnd (SubRunPrincipal &srp, ModuleContext const &mc)=0
 
virtual bool implDoProcess (EventPrincipal &, ModuleContext const &)=0
 

Protected Attributes

std::atomic< std::size_t > counts_visited_ {}
 
std::atomic< std::size_t > counts_run_ {}
 
std::atomic< std::size_t > counts_passed_ {}
 
std::atomic< std::size_t > counts_failed_ {}
 
std::atomic< std::size_t > counts_thrown_ {}
 

Private Member Functions

virtual void implRespondToOpenInputFile (FileBlock const &fb)=0
 
virtual void implRespondToCloseInputFile (FileBlock const &fb)=0
 
virtual void implRespondToOpenOutputFiles (FileBlock const &fb)=0
 
virtual void implRespondToCloseOutputFiles (FileBlock const &fb)=0
 

Private Attributes

ScheduleID const scheduleID_
 
ModuleDescription const md_
 
ActionTable const & actions_
 
ActivityRegistry const & actReg_
 
std::atomic< int > state_ {Ready}
 
std::exception_ptr cached_exception_ {}
 
std::atomic< boolworkStarted_ {false}
 
std::atomic< boolreturnCode_ {false}
 
hep::concurrency::WaitingTaskList waitingTasks_
 

Friends

class RunWorkerFunctor
 

Detailed Description

Definition at line 50 of file Worker.h.

Member Enumeration Documentation

Enumerator
Ready 
Pass 
Fail 
Working 
ExceptionThrown 

Definition at line 54 of file Worker.h.

Constructor & Destructor Documentation

virtual art::Worker::~Worker ( )
virtualdefault
art::Worker::Worker ( ModuleDescription const &  md,
WorkerParams const &  wp 
)

Definition at line 105 of file Worker.cc.

106  : scheduleID_{wp.scheduleID_}
107  , md_{md}
108  , actions_{wp.actions_}
109  , actReg_{wp.actReg_}
110  , waitingTasks_{wp.taskGroup_}
111  {
112  TDEBUG_FUNC_SI(5, wp.scheduleID_)
113  << hex << this << dec << " name: " << md.moduleName()
114  << " label: " << md.moduleLabel();
115  }
QTextStream & hex(QTextStream &s)
ActionTable const & actions_
Definition: Worker.h:122
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
#define TDEBUG_FUNC_SI(LEVEL, SI)
ScheduleID const scheduleID_
Definition: Worker.h:120
QTextStream & dec(QTextStream &s)
hep::concurrency::WaitingTaskList waitingTasks_
Definition: Worker.h:143

Member Function Documentation

void art::Worker::beginJob ( detail::SharedResources const &  resources)

Definition at line 193 of file Worker.cc.

193  {
195  implBeginJob(resources);
197  }
198  catch (...) {
199  rethrow_with_context(std::current_exception(), md_, "beginJob");
200  }
virtual void implBeginJob(detail::SharedResources const &resources)=0
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleBeginJob
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleBeginJob
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
ModuleDescription const & art::Worker::description ( ) const

Definition at line 118 of file Worker.cc.

119  {
120  return md_;
121  }
ModuleDescription const md_
Definition: Worker.h:121
bool art::Worker::doWork ( Transition  trans,
Principal principal,
ModuleContext const &  mc 
)

Definition at line 245 of file Worker.cc.

248  {
249  switch (state_.load()) {
250  case Ready:
251  break;
252  case Pass:
253  return true;
254  case Fail:
255  return false;
256  case ExceptionThrown: {
257  // Rethrow the cached exception again. It seems impossible to
258  // get here a second time unless a cet::exception has been
259  // thrown previously.
260  mf::LogWarning("repeat") << "A module has been invoked a second time "
261  "even though it caught an exception during "
262  "the previous invocation.\nThis may be an "
263  "indication of a configuration problem.\n";
264  rethrow_exception(cached_exception_);
265  }
266  case Working:
267  break; // See below.
268  }
269  bool rc = false;
270  try {
271  if (state_.load() == Working) {
272  // Not part of the switch statement above because we want the
273  // exception to be caught by our handling mechanism.
275  << "A Module has been invoked while it is still being executed.\n"
276  << "Product dependencies have invoked a module execution cycle.\n";
277  }
278  state_ = Working;
279  if (trans == Transition::BeginRun) {
280  actReg_.sPreModuleBeginRun.invoke(mc);
281  rc = implDoBegin(dynamic_cast<RunPrincipal&>(principal), mc);
282  actReg_.sPostModuleBeginRun.invoke(mc);
283  } else if (trans == Transition::EndRun) {
284  actReg_.sPreModuleEndRun.invoke(mc);
285  rc = implDoEnd(dynamic_cast<RunPrincipal&>(principal), mc);
286  actReg_.sPostModuleEndRun.invoke(mc);
287  } else if (trans == Transition::BeginSubRun) {
288  actReg_.sPreModuleBeginSubRun.invoke(mc);
289  rc = implDoBegin(dynamic_cast<SubRunPrincipal&>(principal), mc);
290  actReg_.sPostModuleBeginSubRun.invoke(mc);
291  } else if (trans == Transition::EndSubRun) {
292  actReg_.sPreModuleEndSubRun.invoke(mc);
293  rc = implDoEnd(dynamic_cast<SubRunPrincipal&>(principal), mc);
294  actReg_.sPostModuleEndSubRun.invoke(mc);
295  }
296  state_ = Pass;
297  }
298  catch (cet::exception& e) {
300  e << "The above exception was thrown while processing module "
301  << brief_context(md_, principal) << '\n';
302  if (auto edmEx = dynamic_cast<art::Exception*>(&e)) {
303  cached_exception_ = std::make_exception_ptr(*edmEx);
304  } else {
305  auto art_ex = art::Exception{errors::OtherArt, std::string(), e};
306  cached_exception_ = std::make_exception_ptr(art_ex);
307  }
308  throw;
309  }
310  catch (std::bad_alloc const& bda) {
312  auto art_ex =
314  << "A bad_alloc exception occurred during a call to the module "
315  << brief_context(md_, principal) << '\n'
316  << "The job has probably exhausted the virtual memory available to the "
317  "process.\n";
318  cached_exception_ = make_exception_ptr(art_ex);
319  rethrow_exception(cached_exception_);
320  }
321  catch (std::exception const& e) {
323  auto art_ex = Exception{errors::StdException}
324  << "An exception occurred during a call to the module "
325  << brief_context(md_, principal) << e.what();
326  cached_exception_ = make_exception_ptr(art_ex);
327  rethrow_exception(cached_exception_);
328  }
329  catch (std::string const& s) {
331  auto art_ex = Exception{errors::BadExceptionType, "string"}
332  << "A string thrown as an exception occurred during a call "
333  "to the module "
334  << brief_context(md_, principal) << '\n'
335  << s << '\n';
336  cached_exception_ = make_exception_ptr(art_ex);
337  rethrow_exception(cached_exception_);
338  }
339  catch (char const* c) {
341  auto art_ex = Exception{errors::BadExceptionType, "char const*"}
342  << "A char const* thrown as an exception occurred during a "
343  "call to the module "
344  << brief_context(md_, principal) << '\n'
345  << c << '\n';
346  cached_exception_ = make_exception_ptr(art_ex);
347  rethrow_exception(cached_exception_);
348  }
349  catch (...) {
351  auto art_ex =
352  Exception{errors::Unknown, "repeated"}
353  << "An unknown occurred during a previous call to the module "
354  << brief_context(md_, principal) << '\n';
355  cached_exception_ = make_exception_ptr(art_ex);
356  rethrow_exception(cached_exception_);
357  }
358  return rc;
359  }
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleBeginRun
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleEndRun
std::string string
Definition: nybbler.cc:12
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleEndRun
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleEndSubRun
std::atomic< int > state_
Definition: Worker.h:124
virtual bool implDoEnd(RunPrincipal &rp, ModuleContext const &mc)=0
const double e
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleBeginRun
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleEndSubRun
virtual bool implDoBegin(RunPrincipal &rp, ModuleContext const &mc)=0
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleBeginSubRun
std::exception_ptr cached_exception_
Definition: Worker.h:134
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleBeginSubRun
static QCString * s
Definition: config.cpp:1042
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void art::Worker::doWork_event ( hep::concurrency::WaitingTaskPtr  workerInPathDoneTask,
EventPrincipal ,
ModuleContext const &   
)
void art::Worker::doWork_event ( EventPrincipal p,
ModuleContext const &  mc 
)

Definition at line 363 of file Worker.cc.

363  {
364  ++counts_visited_;
365  returnCode_ = false;
366  // Transition from Ready state to Working state.
367  state_ = Working;
368  actReg_.sPreModule.invoke(mc);
369  // Note: Only the TriggerResults inserter--a producer--calls this
370  // function. The return code is thus always true.
371  returnCode_ = implDoProcess(p, mc);
372  actReg_.sPostModule.invoke(mc);
373  assert(returnCode_.load());
374  state_ = Pass;
375  }
376  catch (cet::exception& e) {
377  auto action = actions_.find(e.root_cause());
378  assert(not mc.onEndPath());
380  state_ = Pass;
381  returnCode_ = true;
382  ++counts_passed_;
383  mf::LogWarning("IgnoreCompletely") << "Module ignored an exception\n"
384  << e.what() << "\n";
385  // WARNING: We will continue execution below!!!
386  } else if (action == actions::FailModule) {
387  state_ = Fail;
388  returnCode_ = true;
389  ++counts_failed_;
390  mf::LogWarning("FailModule") << "Module failed due to an exception\n"
391  << e.what() << "\n";
392  // WARNING: We will continue execution below!!!
393  } else {
395  ++counts_thrown_;
396  e << "The above exception was thrown while processing module "
397  << brief_context(md_, p) << '\n';
398  if (auto edmEx = dynamic_cast<Exception*>(&e)) {
399  cached_exception_ = make_exception_ptr(*edmEx);
400  } else {
402  make_exception_ptr(Exception{errors::OtherArt, string(), e});
403  }
404  rethrow_exception(cached_exception_);
405  }
406  }
407  catch (bad_alloc const& bda) {
409  ++counts_thrown_;
410  auto art_ex =
412  << "A bad_alloc exception occurred during a call to the module "
413  << brief_context(md_, p) << '\n'
414  << "The job has probably exhausted the virtual memory available to the "
415  "process.\n";
416  cached_exception_ = make_exception_ptr(art_ex);
417  rethrow_exception(cached_exception_);
418  }
419  catch (exception const& e) {
421  ++counts_thrown_;
422  auto art_ex = Exception{errors::StdException}
423  << "An exception occurred during a call to the module "
424  << brief_context(md_, p) << '\n'
425  << e.what();
426  cached_exception_ = make_exception_ptr(art_ex);
427  rethrow_exception(cached_exception_);
428  }
429  catch (string const& s) {
431  ++counts_thrown_;
432  auto art_ex = Exception{errors::BadExceptionType, "string"}
433  << "A string thrown as an exception occurred during a call "
434  "to the module "
435  << brief_context(md_, p) << '\n'
436  << s << '\n';
437  cached_exception_ = make_exception_ptr(art_ex);
438  rethrow_exception(cached_exception_);
439  }
440  catch (char const* c) {
442  ++counts_thrown_;
443  auto art_ex = Exception{errors::BadExceptionType, "char const*"}
444  << "A char const* thrown as an exception occurred during a "
445  "call to the module "
446  << brief_context(md_, p) << '\n'
447  << c << "\n";
448  cached_exception_ = make_exception_ptr(art_ex);
449  rethrow_exception(cached_exception_);
450  }
451  catch (...) {
452  ++counts_thrown_;
454  auto art_ex = Exception{errors::Unknown, "repeated"}
455  << "An unknown occurred during a previous call to the module "
456  << brief_context(md_, p) << '\n';
457  cached_exception_ = make_exception_ptr(art_ex);
458  rethrow_exception(cached_exception_);
459  }
std::string string
Definition: nybbler.cc:12
actions::ActionCodes find(std::string const &category) const
Definition: Actions.cc:71
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModule
ActionTable const & actions_
Definition: Worker.h:122
std::atomic< std::size_t > counts_visited_
Definition: Worker.h:146
std::atomic< int > state_
Definition: Worker.h:124
const double e
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
virtual bool implDoProcess(EventPrincipal &, ModuleContext const &)=0
std::atomic< bool > returnCode_
Definition: Worker.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModule
std::atomic< std::size_t > counts_thrown_
Definition: Worker.h:150
std::atomic< std::size_t > counts_passed_
Definition: Worker.h:148
std::atomic< std::size_t > counts_failed_
Definition: Worker.h:149
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::exception_ptr cached_exception_
Definition: Worker.h:134
static QCString * s
Definition: config.cpp:1042
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void art::Worker::endJob ( )

Definition at line 203 of file Worker.cc.

203  {
204  actReg_.sPreModuleEndJob.invoke(md_);
205  implEndJob();
206  actReg_.sPostModuleEndJob.invoke(md_);
207  }
208  catch (...) {
209  rethrow_with_context(std::current_exception(), md_, "endJob");
210  }
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleEndJob
virtual void implEndJob()=0
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleEndJob
virtual void art::Worker::implBeginJob ( detail::SharedResources const &  resources)
protectedpure virtual
virtual bool art::Worker::implDoBegin ( RunPrincipal rp,
ModuleContext const &  mc 
)
protectedpure virtual
virtual bool art::Worker::implDoBegin ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
protectedpure virtual
virtual bool art::Worker::implDoEnd ( RunPrincipal rp,
ModuleContext const &  mc 
)
protectedpure virtual
virtual bool art::Worker::implDoEnd ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
protectedpure virtual
virtual bool art::Worker::implDoProcess ( EventPrincipal ,
ModuleContext const &   
)
protectedpure virtual
virtual void art::Worker::implEndJob ( )
protectedpure virtual
virtual void art::Worker::implRespondToCloseInputFile ( FileBlock const &  fb)
privatepure virtual
virtual void art::Worker::implRespondToCloseOutputFiles ( FileBlock const &  fb)
privatepure virtual
virtual void art::Worker::implRespondToOpenInputFile ( FileBlock const &  fb)
privatepure virtual
virtual void art::Worker::implRespondToOpenOutputFiles ( FileBlock const &  fb)
privatepure virtual
virtual hep::concurrency::SerialTaskQueueChain* art::Worker::implSerialTaskQueueChain ( ) const
protectedpure virtual
string const & art::Worker::label ( ) const

Definition at line 124 of file Worker.cc.

125  {
126  return md_.moduleLabel();
127  }
std::string const & moduleLabel() const
ModuleDescription const md_
Definition: Worker.h:121
void art::Worker::reset ( )

Definition at line 146 of file Worker.cc.

147  {
148  state_ = Ready;
149  cached_exception_ = std::exception_ptr{};
151  << hex << this << dec << " Resetting waitingTasks_";
152  waitingTasks_.reset();
153  workStarted_ = false;
154  returnCode_ = false;
155  }
QTextStream & hex(QTextStream &s)
std::atomic< int > state_
Definition: Worker.h:124
#define TDEBUG_FUNC_SI(LEVEL, SI)
ScheduleID const scheduleID_
Definition: Worker.h:120
QTextStream & dec(QTextStream &s)
std::atomic< bool > returnCode_
Definition: Worker.h:137
std::exception_ptr cached_exception_
Definition: Worker.h:134
hep::concurrency::WaitingTaskList waitingTasks_
Definition: Worker.h:143
std::atomic< bool > workStarted_
Definition: Worker.h:136
void art::Worker::respondToCloseInputFile ( FileBlock const &  fb)

Definition at line 221 of file Worker.cc.

222  {
226  }
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToCloseInputFile
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
virtual void implRespondToCloseInputFile(FileBlock const &fb)=0
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToCloseInputFile
void art::Worker::respondToCloseOutputFiles ( FileBlock const &  fb)

Definition at line 237 of file Worker.cc.

238  {
242  }
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToCloseOutputFiles
virtual void implRespondToCloseOutputFiles(FileBlock const &fb)=0
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToCloseOutputFiles
void art::Worker::respondToOpenInputFile ( FileBlock const &  fb)

Definition at line 213 of file Worker.cc.

214  {
218  }
virtual void implRespondToOpenInputFile(FileBlock const &fb)=0
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToOpenInputFile
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToOpenInputFile
void art::Worker::respondToOpenOutputFiles ( FileBlock const &  fb)

Definition at line 229 of file Worker.cc.

230  {
234  }
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToOpenOutputFiles
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToOpenOutputFiles
virtual void implRespondToOpenOutputFiles(FileBlock const &fb)=0
bool art::Worker::returnCode ( ) const

Definition at line 131 of file Worker.cc.

132  {
133  return returnCode_.load();
134  }
std::atomic< bool > returnCode_
Definition: Worker.h:137
void art::Worker::runWorker ( EventPrincipal p,
ModuleContext const &  mc 
)

Definition at line 462 of file Worker.cc.

463  {
464  auto const sid = mc.scheduleID();
465  TDEBUG_BEGIN_TASK_SI(4, sid);
466  returnCode_ = false;
467  try {
468  // Transition from Ready state to Working state.
469  state_ = Working;
470  actReg_.sPreModule.invoke(mc);
471  // Note: Only filters ever return false, and when they do it
472  // means they have rejected.
473  returnCode_ = implDoProcess(p, mc);
474  actReg_.sPostModule.invoke(mc);
475  state_ = Fail;
476  if (returnCode_.load()) {
477  state_ = Pass;
478  }
479  }
480  catch (cet::exception& e) {
481  auto action = actions_.find(e.root_cause());
482  // If we are processing an endPath, treat SkipEvent or FailPath
483  // as FailModule, so any subsequent OutputModules are still run.
484  if (mc.onEndPath()) {
487  }
488  }
490  state_ = Pass;
491  returnCode_ = true;
492  ++counts_passed_;
493  mf::LogWarning("IgnoreCompletely") << "Module ignored an exception\n"
494  << e.what() << "\n";
495  // WARNING: We will continue execution below!!!
496  } else if (action == actions::FailModule) {
497  state_ = Fail;
498  returnCode_ = true;
499  ++counts_failed_;
500  mf::LogWarning("FailModule") << "Module failed due to an exception\n"
501  << e.what() << "\n";
502  // WARNING: We will continue execution below!!!
503  } else {
505  ++counts_thrown_;
506  e << "The above exception was thrown while processing module "
507  << brief_context(md_, p);
508  if (auto art_ex = dynamic_cast<Exception*>(&e)) {
509  cached_exception_ = make_exception_ptr(*art_ex);
510  } else {
512  make_exception_ptr(Exception{errors::OtherArt, string(), e});
513  }
514  waitingTasks_.doneWaiting(cached_exception_);
515  TDEBUG_END_TASK_SI(4, sid) << "because of EXCEPTION";
516  return;
517  }
518  }
519  catch (bad_alloc const& bda) {
521  ++counts_thrown_;
522  auto art_ex =
524  << "A bad_alloc exception was thrown while processing module "
525  << brief_context(md_, p) << '\n'
526  << "The job has probably exhausted the virtual memory available to the "
527  "process.\n";
528  cached_exception_ = make_exception_ptr(art_ex);
529  waitingTasks_.doneWaiting(cached_exception_);
530  TDEBUG_END_TASK_SI(4, sid) << "because of EXCEPTION";
531  return;
532  }
533  catch (exception const& e) {
535  ++counts_thrown_;
536  auto art_ex = Exception{errors::StdException}
537  << "An exception was thrown while processing module "
538  << brief_context(md_, p) << '\n'
539  << e.what();
540  cached_exception_ = make_exception_ptr(art_ex);
541  waitingTasks_.doneWaiting(cached_exception_);
542  TDEBUG_END_TASK_SI(4, sid) << "because of EXCEPTION";
543  return;
544  }
545  catch (string const& s) {
547  ++counts_thrown_;
548  auto art_ex =
550  << "A string was thrown as an exception while processing module "
551  << brief_context(md_, p) << '\n'
552  << s << '\n';
553  cached_exception_ = make_exception_ptr(art_ex);
554  waitingTasks_.doneWaiting(cached_exception_);
555  TDEBUG_END_TASK_SI(4, sid) << "because of EXCEPTION";
556  return;
557  }
558  catch (char const* c) {
560  ++counts_thrown_;
561  auto art_ex =
562  Exception{errors::BadExceptionType, "char const*"}
563  << "A char const* was thrown as an exception while processing module "
564  << brief_context(md_, p) << '\n'
565  << c << "\n";
566  cached_exception_ = make_exception_ptr(art_ex);
567  waitingTasks_.doneWaiting(cached_exception_);
568  TDEBUG_END_TASK_SI(4, sid) << "because of EXCEPTION";
569  return;
570  }
571  catch (...) {
572  ++counts_thrown_;
574  auto art_ex =
575  Exception{errors::Unknown, "repeated"}
576  << "An unknown exception was thrown while processing module "
577  << brief_context(md_, p) << '\n';
578  cached_exception_ = make_exception_ptr(art_ex);
579  waitingTasks_.doneWaiting(cached_exception_);
580  TDEBUG_END_TASK_SI(4, sid) << "because of EXCEPTION";
581  return;
582  }
583  waitingTasks_.doneWaiting(exception_ptr{});
584  TDEBUG_END_TASK_SI(4, sid);
585  }
#define TDEBUG_BEGIN_TASK_SI(LEVEL, SI)
std::string string
Definition: nybbler.cc:12
actions::ActionCodes find(std::string const &category) const
Definition: Actions.cc:71
#define TDEBUG_END_TASK_SI(LEVEL, SI)
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModule
ActionTable const & actions_
Definition: Worker.h:122
std::atomic< int > state_
Definition: Worker.h:124
const double e
ActivityRegistry const & actReg_
Definition: Worker.h:123
ModuleDescription const md_
Definition: Worker.h:121
virtual bool implDoProcess(EventPrincipal &, ModuleContext const &)=0
std::atomic< bool > returnCode_
Definition: Worker.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModule
std::atomic< std::size_t > counts_thrown_
Definition: Worker.h:150
std::atomic< std::size_t > counts_passed_
Definition: Worker.h:148
std::atomic< std::size_t > counts_failed_
Definition: Worker.h:149
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::exception_ptr cached_exception_
Definition: Worker.h:134
hep::concurrency::WaitingTaskList waitingTasks_
Definition: Worker.h:143
static QCString * s
Definition: config.cpp:1042
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
ScheduleID art::Worker::scheduleID ( ) const
inline

Definition at line 75 of file Worker.h.

76  {
77  return scheduleID_;
78  }
ScheduleID const scheduleID_
Definition: Worker.h:120
SerialTaskQueueChain * art::Worker::serialTaskQueueChain ( ) const

Definition at line 137 of file Worker.cc.

138  {
139  return implSerialTaskQueueChain();
140  }
virtual hep::concurrency::SerialTaskQueueChain * implSerialTaskQueueChain() const =0
size_t art::Worker::timesExcept ( ) const

Definition at line 187 of file Worker.cc.

188  {
189  return counts_thrown_.load();
190  }
std::atomic< std::size_t > counts_thrown_
Definition: Worker.h:150
size_t art::Worker::timesFailed ( ) const

Definition at line 180 of file Worker.cc.

181  {
182  return counts_failed_.load();
183  }
std::atomic< std::size_t > counts_failed_
Definition: Worker.h:149
size_t art::Worker::timesPassed ( ) const

Definition at line 173 of file Worker.cc.

174  {
175  return counts_passed_.load();
176  }
std::atomic< std::size_t > counts_passed_
Definition: Worker.h:148
size_t art::Worker::timesRun ( ) const

Definition at line 166 of file Worker.cc.

167  {
168  return counts_run_.load();
169  }
std::atomic< std::size_t > counts_run_
Definition: Worker.h:147
size_t art::Worker::timesVisited ( ) const

Definition at line 159 of file Worker.cc.

160  {
161  return counts_visited_.load();
162  }
std::atomic< std::size_t > counts_visited_
Definition: Worker.h:146
virtual std::string art::Worker::workerType ( ) const
protectedpure virtual

Friends And Related Function Documentation

friend class RunWorkerFunctor
friend

Definition at line 51 of file Worker.h.

Member Data Documentation

ActionTable const& art::Worker::actions_
private

Definition at line 122 of file Worker.h.

ActivityRegistry const& art::Worker::actReg_
private

Definition at line 123 of file Worker.h.

std::exception_ptr art::Worker::cached_exception_ {}
private

Definition at line 134 of file Worker.h.

std::atomic<std::size_t> art::Worker::counts_failed_ {}
protected

Definition at line 149 of file Worker.h.

std::atomic<std::size_t> art::Worker::counts_passed_ {}
protected

Definition at line 148 of file Worker.h.

std::atomic<std::size_t> art::Worker::counts_run_ {}
protected

Definition at line 147 of file Worker.h.

std::atomic<std::size_t> art::Worker::counts_thrown_ {}
protected

Definition at line 150 of file Worker.h.

std::atomic<std::size_t> art::Worker::counts_visited_ {}
protected

Definition at line 146 of file Worker.h.

ModuleDescription const art::Worker::md_
private

Definition at line 121 of file Worker.h.

std::atomic<bool> art::Worker::returnCode_ {false}
private

Definition at line 137 of file Worker.h.

ScheduleID const art::Worker::scheduleID_
private

Definition at line 120 of file Worker.h.

std::atomic<int> art::Worker::state_ {Ready}
private

Definition at line 124 of file Worker.h.

hep::concurrency::WaitingTaskList art::Worker::waitingTasks_
private

Definition at line 143 of file Worker.h.

std::atomic<bool> art::Worker::workStarted_ {false}
private

Definition at line 136 of file Worker.h.


The documentation for this class was generated from the following files: