1 #ifndef art_Framework_Principal_Worker_h 2 #define art_Framework_Principal_Worker_h 31 #include "cetlib/exempt_ptr.h" 32 #include "cetlib_except/exception.h" 44 class ActivityRegistry;
48 class SubRunPrincipal;
56 virtual ~Worker() noexcept =
default;
149 template <BranchActionType>
164 cet::exempt_ptr<ActivityRegistry>
actReg_{
nullptr};
169 template <
typename T>
177 template <
typename PRINCIPAL>
187 template <
typename PRINCIPAL>
197 template <
typename PRINCIPAL>
206 template <
typename T>
216 template <
typename T>
222 counts.template increment<stats::Visited>();
236 <<
"A module has been invoked a second time even though" 237 " it caught an exception during the previous invocation." 238 "\nThis may be an indication of a configuration problem.\n";
251 <<
"A Module has been invoked while it is still being executed.\n" 252 <<
"Product dependencies have invoked a module execution cycle.\n";
255 assert(
actReg_.get() !=
nullptr);
290 counts.template increment<stats::Passed>();
292 mf::LogWarning(
"IgnoreCompletely") <<
"Module ignored an exception\n" 298 mf::LogWarning(
"FailModule") <<
"Module failed due to an exception\n" 300 counts.template increment<stats::Failed>();
313 counts.template increment<stats::ExceptionThrown>();
315 e <<
"cet::exception going through module ";
317 if (
auto edmEx = dynamic_cast<art::Exception*>(&e)) {
327 catch (std::bad_alloc
const& bda) {
328 counts.template increment<stats::ExceptionThrown>();
332 <<
"A std::bad_alloc exception occurred during a call to the module ";
334 <<
"The job has probably exhausted the virtual memory available to the " 339 counts.template increment<stats::ExceptionThrown>();
343 <<
"A std::exception occurred during a call to the module ";
345 <<
"and cannot be repropagated.\n" 346 <<
"Previous information:\n" 350 catch (std::string
const&
s) {
351 counts.template increment<stats::ExceptionThrown>();
356 "during a call to the module ";
358 <<
"and cannot be repropagated.\n" 359 <<
"Previous information:\n string = " <<
s;
362 catch (
char const* c) {
363 counts.template increment<stats::ExceptionThrown>();
368 "during a call to the module ";
370 <<
"and cannot be repropagated.\n" 371 <<
"Previous information:\n const char* = " << c <<
"\n";
375 counts.template increment<stats::ExceptionThrown>();
380 <<
"An unknown occurred during a previous call to the module ";
382 <<
"and cannot be repropagated.\n";
void setActivityRegistry(cet::exempt_ptr< ActivityRegistry > areg)
virtual ~Worker() noexcept=default
virtual bool implDoProcess(EventPrincipal &, CurrentProcessingContext const *cpc, CountingStatistics &)=0
void respondToOpenOutputFiles(FileBlock const &fb)
std::size_t timesVisited() const
void respondToCloseOutputFiles(FileBlock const &fb)
actions::ActionCodes find(std::string const &category) const
CountingStatistics counts_
std::size_t times() const
ActionTable const & actions_
cet::exception & exceptionContext(ModuleDescription const &md, T const &ip, cet::exception &ex)
virtual void implRespondToOpenInputFile(FileBlock const &fb)=0
virtual void implBeginJob()=0
virtual void implRespondToCloseOutputFiles(FileBlock const &fb)=0
std::shared_ptr< art::Exception > cached_exception_
cet::exempt_ptr< ActivityRegistry > actReg_
virtual std::string workerType() const =0
std::string const & moduleName() const
ModuleDescription const & description() const
ModuleDescription const * descPtr() const
void respondToOpenInputFile(FileBlock const &fb)
std::string const & moduleLabel() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
virtual void implRespondToCloseInputFile(FileBlock const &fb)=0
static bool invoke(Worker *const w, PRINCIPAL &p, CurrentProcessingContext const *cpc)
Worker(ModuleDescription const &iMD, WorkerParams const &iWP)
bool doWork(typename T::MyPrincipal &, CurrentProcessingContext const *cpc)
static bool invoke(Worker *const w, PRINCIPAL &p, CurrentProcessingContext const *cpc)
std::size_t timesExcept() const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::size_t timesRun() const
virtual bool modifiesEvent() const =0
virtual void implEndJob()=0
void respondToCloseInputFile(FileBlock const &fb)
virtual bool implDoBegin(RunPrincipal &rp, CurrentProcessingContext const *cpc)=0
std::size_t timesPassed() const
std::size_t timesFailed() const
std::string const & label() const
virtual void implRespondToOpenOutputFiles(FileBlock const &fb)=0
static bool invoke(Worker *const w, PRINCIPAL &p, CurrentProcessingContext const *cpc)
cet::coded_exception< error, detail::translate > exception
virtual bool implDoEnd(RunPrincipal &rp, CurrentProcessingContext const *cpc)=0