1 #include "artdaq/Application/DispatcherApp.hh"
2 #include "artdaq/Application/DispatcherCore.hh"
3 #include "artdaq-core/Utilities/ExceptionHandler.hh"
22 if (Dispatcher_ptr_.get() == 0)
26 external_request_status_ = Dispatcher_ptr_->initialize(pset);
27 if (!external_request_status_)
29 report_string_ =
"Error initializing ";
30 report_string_.append(app_name +
" ");
31 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
34 return external_request_status_;
40 external_request_status_ = Dispatcher_ptr_->start(
id);
41 if (!external_request_status_)
43 report_string_ =
"Error starting ";
44 report_string_.append(app_name +
" ");
45 report_string_.append(
"for run number ");
46 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
47 report_string_.append(
".");
50 return external_request_status_;
56 external_request_status_ = Dispatcher_ptr_->stop();
57 if (!external_request_status_)
59 report_string_ =
"Error stopping ";
60 report_string_.append(app_name +
".");
63 return external_request_status_;
69 external_request_status_ = Dispatcher_ptr_->pause();
70 if (!external_request_status_)
72 report_string_ =
"Error pausing ";
73 report_string_.append(app_name +
".");
75 return external_request_status_;
81 external_request_status_ = Dispatcher_ptr_->resume();
82 if (!external_request_status_)
84 report_string_ =
"Error resuming ";
85 report_string_.append(app_name +
".");
88 return external_request_status_;
94 external_request_status_ = Dispatcher_ptr_->shutdown();
95 if (!external_request_status_)
97 report_string_ =
"Error shutting down ";
98 report_string_.append(app_name +
".");
101 return external_request_status_;
116 std::string resultString;
119 if (which ==
"transition_status")
121 if (report_string_.length() > 0) {
return report_string_; }
122 else {
return "Success"; }
134 if (Dispatcher_ptr_.get() != 0)
136 resultString.append(Dispatcher_ptr_->report(which));
140 resultString.append(
"This Dispatcher has not yet been initialized and ");
141 resultString.append(
"therefore can not provide reporting.");
149 TLOG_DEBUG(app_name) <<
"DispatcherApp::register_monitor called with argument \"" << info.to_string() <<
"\"" << TLOG_ENDL;
155 return Dispatcher_ptr_->register_monitor(info);
159 ExceptionHandler(ExceptionHandlerRethrow::no,
160 "Error in call to DispatcherCore's register_monitor function");
162 return "Error in artdaq::DispatcherApp::register_monitor: an exception was thrown in the call to DispatcherCore::register_monitor, possibly due to a problem with the argument";
167 return "Error in artdaq::DispatcherApp::register_monitor: DispatcherCore object wasn't initialized";
174 TLOG_DEBUG(app_name) <<
"DispatcherApp::unregister_monitor called with argument \"" << label <<
"\"" << TLOG_ENDL;
180 return Dispatcher_ptr_->unregister_monitor(label);
184 ExceptionHandler(ExceptionHandlerRethrow::no,
185 "Error in call to DispatcherCore's unregister_monitor function");
187 return "Error in artdaq::DispatcherApp::unregister_monitor: an exception was thrown in the call to DispatcherCore::unregister_monitor, possibly due to a problem with the argument";
192 return "Error in artdaq::DispatcherApp::unregister_monitor: DispatcherCore object wasn't initialized";
bool do_start(art::RunID id, uint64_t, uint64_t) override
Start the DispatcherCore.
bool do_pause(uint64_t, uint64_t) override
Pause the DispatcherCore.
DispatcherCore implements the state machine for the Dispatcher artdaq application. DispatcherCore processes incoming events in one of three roles: Data Logger, Online Monitor, or Dispatcher.
bool do_resume(uint64_t, uint64_t) override
Resume the DispatcherCore.
std::string unregister_monitor(std::string const &label) override
Remove an art Online Monitor from the DispatcherCore.
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Initialize the DispatcherCore.
DispatcherApp(int rank, std::string name)
DispatcherApp Constructor.
bool do_stop(uint64_t, uint64_t) override
Stop the DispatcherCore.
bool do_soft_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Soft-initialize the DispatcherCore. No-Op.
bool do_reinitialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Reinitialize the DispatcherCore. No-Op.
std::string register_monitor(fhicl::ParameterSet const &info) override
Register an art Online Monitor to the DispatcherCore.
std::string report(std::string const &which) const override
If which is "transition_status", report the status of the last transition. Otherwise pass through to ...
bool do_shutdown(uint64_t) override
Shutdown the DispatcherCore.