1 #include "artdaq/Application/RoutingMasterApp.hh"
7 : rank_(rank), name_(name) {}
16 external_request_status_ =
true;
22 routing_master_ptr_.reset(
nullptr);
24 external_request_status_ = routing_master_ptr_->initialize(pset, timeout, timestamp);
25 if (!external_request_status_)
27 report_string_ =
"Error initializing ";
28 report_string_.append(name_ +
" ");
29 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
32 return external_request_status_;
38 external_request_status_ = routing_master_ptr_->start(
id, timeout, timestamp);
39 if (!external_request_status_)
41 report_string_ =
"Error starting ";
42 report_string_.append(name_ +
" ");
43 report_string_.append(
"for run number ");
44 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
45 report_string_.append(
", timeout ");
46 report_string_.append(boost::lexical_cast<std::string>(timeout));
47 report_string_.append(
", timestamp ");
48 report_string_.append(boost::lexical_cast<std::string>(timestamp));
49 report_string_.append(
".");
52 routing_master_future_ =
54 routing_master_ptr_.get());
56 return external_request_status_;
62 external_request_status_ = routing_master_ptr_->stop(timeout, timestamp);
63 if (!external_request_status_)
65 report_string_ =
"Error stopping ";
66 report_string_.append(name_ +
".");
70 if (routing_master_future_.valid())
72 int number_of_table_entries_sent = routing_master_future_.get();
73 TLOG_DEBUG(name_ +
"App") <<
"do_stop(uint64_t, uint64_t): "
74 <<
"Number of table entries sent = " << number_of_table_entries_sent
78 return external_request_status_;
84 external_request_status_ = routing_master_ptr_->pause(timeout, timestamp);
85 if (!external_request_status_)
87 report_string_ =
"Error pausing ";
88 report_string_.append(name_ +
".");
91 if (routing_master_future_.valid())
93 int number_of_table_entries_sent = routing_master_future_.get();
94 TLOG_DEBUG(name_ +
"App") <<
"do_pause(uint64_t, uint64_t): "
95 <<
"Number of table entries sent = " << number_of_table_entries_sent
99 return external_request_status_;
105 external_request_status_ = routing_master_ptr_->resume(timeout, timestamp);
106 if (!external_request_status_)
108 report_string_ =
"Error resuming ";
109 report_string_.append(name_ +
".");
112 routing_master_future_ =
114 routing_master_ptr_.get());
116 return external_request_status_;
122 external_request_status_ = routing_master_ptr_->shutdown(timeout);
123 if (!external_request_status_)
125 report_string_ =
"Error shutting down ";
126 report_string_.append(name_ +
".");
128 return external_request_status_;
134 external_request_status_ = routing_master_ptr_->soft_initialize(pset, timeout, timestamp);
135 if (!external_request_status_)
137 report_string_ =
"Error soft-initializing ";
138 report_string_.append(name_ +
" ");
139 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
141 return external_request_status_;
146 external_request_status_ = routing_master_ptr_->reinitialize(pset, timeout, timestamp);
147 if (!external_request_status_)
149 report_string_ =
"Error reinitializing ";
150 report_string_.append(name_ +
" ");
151 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
153 return external_request_status_;
158 TLOG_DEBUG(name_ +
"App") <<
"Booted state entry action called." << TLOG_ENDL;
164 routing_master_ptr_.reset(
nullptr);
169 std::string resultString;
172 if (which ==
"transition_status")
174 if (report_string_.length() > 0) {
return report_string_; }
175 else {
return "Success"; }
187 if (routing_master_ptr_.get() != 0)
189 resultString.append(routing_master_ptr_->report(which));
193 resultString.append(
"This RoutingMaster has not yet been initialized and ");
194 resultString.append(
"therefore can not provide reporting.");
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp) override
Initialize the RoutingMasterCore.
bool do_pause(uint64_t timeout, uint64_t timestamp) override
Pause the RoutingMasterCore.
size_t process_event_table()
Main loop of the RoutingMasterCore. Determines when to send the next table update, asks the RoutingMasterPolicy for the table to send, and sends it.
bool do_resume(uint64_t timeout, uint64_t timestamp) override
Resume the RoutingMasterCore.
RoutingMasterApp(int rank, std::string name)
RoutingMasterApp Constructor.
bool do_stop(uint64_t timeout, uint64_t timestamp) override
Stop the RoutingMasterCore.
std::string report(std::string const &) const override
If which is "transition_status", report the status of the last transition. Otherwise pass through to ...
bool do_shutdown(uint64_t timeout) override
Shutdown the RoutingMasterCore.
bool do_soft_initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp) override
Soft-Initialize the RoutingMasterCore.
bool do_reinitialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp) override
Reinitialize the RoutingMasterCore.
bool do_start(art::RunID id, uint64_t timeout, uint64_t timestamp) override
Start the RoutingMasterCore.
void BootedEnter() override
Action taken upon entering the "Booted" state.
RoutingMasterCore implements the state machine for the RoutingMaster artdaq application. RoutingMasterCore collects tokens from receivers, and at regular intervals uses these tokens to build Routing Tables that are sent to the senders.