15 #include "cetlib_except/exception.h" 16 #include "hep_concurrency/SerialTaskQueueChain.h" 17 #include "hep_concurrency/WaitingTask.h" 18 #include "hep_concurrency/WaitingTaskList.h" 43 std::ostringstream result;
44 result << brief_context(md) <<
' ';
48 result << static_cast<art::RunPrincipal const&>(principal).runID();
51 result << static_cast<art::SubRunPrincipal const&>(principal).subRunID();
54 result << static_cast<art::EventPrincipal const&>(principal).eventID();
63 rethrow_with_context(std::exception_ptr eptr,
65 std::string
const& transition)
69 std::string
const brief_module_context =
70 brief_context(md) +
" during " + transition;
72 rethrow_exception(eptr);
76 "An exception was thrown while processing module " +
85 "A string exception was thrown while processing module " +
89 catch (
char const* c) {
92 "A char const* exception was thrown while processing module " +
98 <<
"An unknown exception was thrown while processing module " +
106 Worker::~Worker() =
default;
116 << hex <<
this << dec <<
" name: " << md.
moduleName()
139 SerialTaskQueueChain*
154 << hex <<
this << dec <<
" Resetting waitingTasks_";
203 rethrow_with_context(std::current_exception(),
md_,
"beginJob");
214 rethrow_with_context(std::current_exception(),
md_,
"endJob");
264 mf::LogWarning(
"repeat") <<
"A module has been invoked a second time " 265 "even though it caught an exception during " 266 "the previous invocation.\nThis may be an " 267 "indication of a configuration problem.";
279 <<
"A Module has been invoked while it is still being executed.\n" 280 <<
"Product dependencies have invoked a module execution cycle.\n";
285 doBegin(dynamic_cast<RunPrincipal&>(principal), mc);
289 doEnd(dynamic_cast<RunPrincipal&>(principal), mc);
293 doBegin(dynamic_cast<SubRunPrincipal&>(principal), mc);
297 doEnd(dynamic_cast<SubRunPrincipal&>(principal), mc);
304 e <<
"The above exception was thrown while processing module " 305 << brief_context(
md_, principal) <<
'\n';
306 if (
auto edmEx = dynamic_cast<Exception*>(&e)) {
314 catch (std::bad_alloc
const& bda) {
318 <<
"A bad_alloc exception occurred during a call to the module " 319 << brief_context(
md_, principal) <<
'\n' 320 <<
"The job has probably exhausted the virtual memory available to the " 328 <<
"An exception occurred during a call to the module " 329 << brief_context(
md_, principal) << e.what();
333 catch (std::string
const& s) {
336 <<
"A string thrown as an exception occurred during a call " 338 << brief_context(
md_, principal) <<
'\n' 343 catch (
char const* c) {
346 <<
"A char const* thrown as an exception occurred during a " 347 "call to the module " 348 << brief_context(
md_, principal) <<
'\n' 357 <<
"An unknown occurred during a previous call to the module " 358 << brief_context(
md_, principal) <<
'\n';
382 assert(not mc.onEndPath());
387 mf::LogWarning(
"IgnoreCompletely") <<
"Module ignored an exception\n" 394 mf::LogWarning(
"FailModule") <<
"Module failed due to an exception\n" 400 e <<
"The above exception was thrown while processing module " 401 << brief_context(
md_, p) <<
'\n';
402 if (
auto edmEx = dynamic_cast<Exception*>(&e)) {
411 catch (bad_alloc
const& bda) {
416 <<
"A bad_alloc exception occurred during a call to the module " 417 << brief_context(
md_, p) <<
'\n' 418 <<
"The job has probably exhausted the virtual memory available to the " 427 <<
"An exception occurred during a call to the module " 428 << brief_context(
md_, p) <<
'\n' 433 catch (
string const& s) {
437 <<
"A string thrown as an exception occurred during a call " 439 << brief_context(
md_, p) <<
'\n' 444 catch (
char const* c) {
448 <<
"A char const* thrown as an exception occurred during a " 449 "call to the module " 450 << brief_context(
md_, p) <<
'\n' 459 <<
"An unknown occurred during a previous call to the module " 460 << brief_context(
md_, p) <<
'\n';
497 mf::LogWarning(
"IgnoreCompletely") <<
"Module ignored an exception\n" 504 mf::LogWarning(
"FailModule") <<
"Module failed due to an exception\n" 510 e <<
"The above exception was thrown while processing module " 511 << brief_context(
md_, p);
512 if (
auto art_ex = dynamic_cast<Exception*>(&e)) {
523 catch (bad_alloc
const& bda) {
528 <<
"A bad_alloc exception was thrown while processing module " 529 << brief_context(
md_, p) <<
'\n' 530 <<
"The job has probably exhausted the virtual memory available to the " 541 <<
"An exception was thrown while processing module " 542 << brief_context(
md_, p) <<
'\n' 549 catch (
string const& s) {
554 <<
"A string was thrown as an exception while processing module " 555 << brief_context(
md_, p) <<
'\n' 562 catch (
char const* c) {
567 <<
"A char const* was thrown as an exception while processing module " 568 << brief_context(
md_, p) <<
'\n' 580 <<
"An unknown exception was thrown while processing module " 581 << brief_context(
md_, p) <<
'\n';
619 bool expected =
false;
620 if (
workStarted_.compare_exchange_strong(expected,
true)) {
623 TDEBUG_FUNC_SI(4, sid) <<
"pushing onto chain " << hex << chain << dec;
624 chain->push([&p, &mc,
this] {
runWorker(p, mc); });
#define TDEBUG_BEGIN_TASK_SI(LEVEL, SI)
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleBeginRun
std::size_t timesExcept() const
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleEndRun
void respondToOpenOutputFiles(FileBlock const &fb)
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleBeginJob
void respondToCloseOutputFiles(FileBlock const &fb)
actions::ActionCodes find(std::string const &category) const
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToCloseOutputFiles
#define TDEBUG_END_TASK_SI(LEVEL, SI)
std::size_t timesPassed() const
std::string const & moduleLabel() const
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToCloseInputFile
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModule
std::string const & label() const
static constexpr ScheduleID first()
virtual void doBeginJob(detail::SharedResources const &resources)=0
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
ActionTable const & actions_
std::size_t timesRun() const
std::atomic< std::size_t > counts_visited_
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleEndRun
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleEndSubRun
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleBeginJob
std::atomic< int > state_
std::size_t timesVisited() const
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToOpenInputFile
std::string const & moduleName() const
virtual bool doProcess(EventPrincipal &, ModuleContext const &)=0
ActivityRegistry const & actReg_
void runWorker(EventPrincipal &, ModuleContext const &)
ModuleDescription const md_
virtual void doRespondToCloseInputFile(FileBlock const &fb)=0
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleBeginRun
virtual void doEndJob()=0
#define TDEBUG_FUNC_SI(LEVEL, SI)
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToOpenInputFile
ScheduleID const scheduleID_
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleEndJob
void respondToOpenInputFile(FileBlock const &fb)
virtual void doBegin(RunPrincipal &rp, ModuleContext const &mc)=0
std::atomic< bool > returnCode_
std::atomic< std::size_t > counts_run_
ModuleDescription const & description() const
ModuleThreadingType moduleThreadingType() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
#define TDEBUG_END_FUNC_SI(LEVEL, SI)
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModule
std::atomic< std::size_t > counts_thrown_
std::atomic< std::size_t > counts_passed_
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToOpenOutputFiles
virtual void doRespondToCloseOutputFiles(FileBlock const &fb)=0
virtual void doEnd(RunPrincipal &rp, ModuleContext const &mc)=0
std::atomic< std::size_t > counts_failed_
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
virtual void doRespondToOpenOutputFiles(FileBlock const &fb)=0
virtual hep::concurrency::SerialTaskQueueChain * doSerialTaskQueueChain() const =0
#define TDEBUG_BEGIN_FUNC_SI(LEVEL, SI)
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleEndJob
void doWork(Transition, Principal &, ModuleContext const &)
void respondToCloseInputFile(FileBlock const &fb)
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleEndSubRun
void beginJob(detail::SharedResources const &)
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleContext const &)> sPostModuleBeginSubRun
virtual void doRespondToOpenInputFile(FileBlock const &fb)=0
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain() const
std::exception_ptr cached_exception_
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleContext const &)> sPreModuleBeginSubRun
hep::concurrency::WaitingTaskList waitingTasks_
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToCloseOutputFiles
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleRespondToOpenOutputFiles
void doWork_event(hep::concurrency::WaitingTaskPtr workerInPathDoneTask, EventPrincipal &, ModuleContext const &)
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleRespondToCloseInputFile
cet::coded_exception< error, detail::translate > exception
BranchType branchType() const
std::atomic< bool > workStarted_
std::size_t timesFailed() const