1 #include "artdaq/Application/DispatcherApp.hh"
2 #include "artdaq/Application/DispatcherCore.hh"
3 #include "artdaq-core/Utilities/ExceptionHandler.hh"
21 if (Dispatcher_ptr_.get() == 0)
25 external_request_status_ = Dispatcher_ptr_->initialize(pset);
26 if (!external_request_status_)
28 report_string_ =
"Error initializing ";
29 report_string_.append(name_ +
" ");
30 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
33 return external_request_status_;
39 external_request_status_ = Dispatcher_ptr_->start(
id);
40 if (!external_request_status_)
42 report_string_ =
"Error starting ";
43 report_string_.append(name_ +
" ");
44 report_string_.append(
"for run number ");
45 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
46 report_string_.append(
".");
49 return external_request_status_;
55 external_request_status_ = Dispatcher_ptr_->stop();
56 if (!external_request_status_)
58 report_string_ =
"Error stopping ";
59 report_string_.append(name_ +
".");
62 return external_request_status_;
68 external_request_status_ = Dispatcher_ptr_->pause();
69 if (!external_request_status_)
71 report_string_ =
"Error pausing ";
72 report_string_.append(name_ +
".");
74 return external_request_status_;
80 external_request_status_ = Dispatcher_ptr_->resume();
81 if (!external_request_status_)
83 report_string_ =
"Error resuming ";
84 report_string_.append(name_ +
".");
87 return external_request_status_;
93 external_request_status_ = Dispatcher_ptr_->shutdown();
94 if (!external_request_status_)
96 report_string_ =
"Error shutting down ";
97 report_string_.append(name_ +
".");
100 return external_request_status_;
115 std::string resultString;
118 if (which ==
"transition_status")
120 if (report_string_.length() > 0) {
return report_string_; }
121 else {
return "Success"; }
133 if (Dispatcher_ptr_.get() != 0)
135 resultString.append(Dispatcher_ptr_->report(which));
139 resultString.append(
"This Dispatcher has not yet been initialized and ");
140 resultString.append(
"therefore can not provide reporting.");
148 TLOG_DEBUG(name_) <<
"DispatcherApp::register_monitor called with argument \"" << info.to_string() <<
"\"" << TLOG_ENDL;
154 return Dispatcher_ptr_->register_monitor(info);
158 ExceptionHandler(ExceptionHandlerRethrow::no,
159 "Error in call to DispatcherCore's register_monitor function");
161 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";
166 return "Error in artdaq::DispatcherApp::register_monitor: DispatcherCore object wasn't initialized";
173 TLOG_DEBUG(name_) <<
"DispatcherApp::unregister_monitor called with argument \"" << label <<
"\"" << TLOG_ENDL;
179 return Dispatcher_ptr_->unregister_monitor(label);
183 ExceptionHandler(ExceptionHandlerRethrow::no,
184 "Error in call to DispatcherCore's unregister_monitor function");
186 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";
191 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.