1 #define TRACE_NAME "DispatcherApp"
3 #include "artdaq/Application/DispatcherApp.hh"
4 #include "artdaq-core/Utilities/ExceptionHandler.hh"
5 #include "artdaq/Application/DispatcherCore.hh"
21 if (Dispatcher_ptr_ ==
nullptr)
23 Dispatcher_ptr_ = std::make_unique<DispatcherCore>();
30 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
39 external_request_status_ = Dispatcher_ptr_->start(
id);
40 if (!external_request_status_)
42 report_string_ =
"Error starting ";
43 report_string_.append(app_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(app_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(app_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(app_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(app_name +
".");
100 return external_request_status_;
115 std::string resultString;
118 if (which ==
"transition_status")
120 if (report_string_.length() > 0) {
return report_string_; }
134 if (Dispatcher_ptr_ !=
nullptr)
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(TLVL_DEBUG) <<
"DispatcherApp::register_monitor called with argument \"" << info.to_string() <<
"\"";
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";
173 TLOG(TLVL_DEBUG) <<
"DispatcherApp::unregister_monitor called with argument \"" << label <<
"\"";
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.
bool external_request_status_
Whether the last command succeeded.
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()
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 report_string_
Status information about the last command.
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.