1 #ifndef artdaq_Application_MPI2_AggregatorCore_hh
2 #define artdaq_Application_MPI2_AggregatorCore_hh
9 #include "fhiclcpp/ParameterSet.h"
10 #include "canvas/Persistency/Provenance/RunID.h"
12 #include "artdaq-core/Core/GlobalQueue.hh"
13 #include "artdaq-utilities/Plugins/MetricManager.hh"
15 #include "artdaq/DAQrate/DataSenderManager.hh"
16 #include "artdaq/DAQrate/DataReceiverManager.hh"
17 #include "artdaq/DAQrate/EventStore.hh"
18 #include "artdaq/Application/StatisticsHelper.hh"
19 #include "artdaq/TransferPlugins/TransferInterface.hh"
96 bool initialize(fhicl::ParameterSet
const& pset);
103 bool start(art::RunID
id);
171 std::string
report(std::string
const& which)
const;
192 bool art_initialized_;
194 fhicl::ParameterSet data_pset_;
195 std::string init_string_;
196 size_t expected_events_per_bunch_;
197 size_t inrun_recv_timeout_usec_;
198 size_t endrun_recv_timeout_usec_;
199 size_t pause_recv_timeout_usec_;
200 size_t onmon_event_prescale_;
201 int32_t filesize_check_interval_seconds_;
202 int32_t filesize_check_interval_events_;
203 bool is_data_logger_;
204 bool is_online_monitor_;
206 artdaq::detail::seconds enq_timeout_;
208 std::unique_ptr<artdaq::DataReceiverManager> receiver_ptr_;
209 std::unique_ptr<artdaq::DataSenderManager> sender_ptr_;
210 std::unique_ptr<artdaq::EventStore> event_store_ptr_;
211 artdaq::RawEventQueue& event_queue_;
212 fhicl::ParameterSet previous_pset_;
213 std::atomic<bool> stop_requested_;
214 std::atomic<bool> local_pause_requested_;
215 std::atomic<bool> processing_fragments_;
217 size_t event_count_in_run_;
218 size_t event_count_in_subrun_;
219 time_t subrun_start_time_;
220 std::string disk_writing_directory_;
222 size_t getLatestFileSize_()
const;
224 std::vector<std::vector<std::string>> xmlrpc_client_lists_;
225 size_t file_close_threshold_bytes_;
226 time_t file_close_timeout_secs_;
227 size_t file_close_event_count_;
229 bool sendPauseAndResume_();
231 std::atomic<bool> system_pause_requested_;
232 std::shared_ptr<std::thread> pause_thread_;
234 void logMessage_(std::string
const& text);
238 std::string buildStatisticsString_();
240 double previous_run_duration_;
241 artdaq::MetricManager metricMan_;
245 std::unique_ptr<Fragment> init_fragment_ptr_;
247 std::mutex dispatcher_transfers_mutex_;
248 std::deque<std::unique_ptr<TransferInterface>> dispatcher_transfers_;
249 size_t new_transfers_;
This class manages MonitoredQuantity instances for the *Core classes.
static const std::string INPUT_EVENTS_STAT_KEY
Key for the Input Events MonitoredQuantity.
static const std::string SHM_COPY_TIME_STAT_KEY
Key for the Shared Memory Copy Time MonitoredQuantity.
bool reinitialize(fhicl::ParameterSet const &pset)
Reinitializes the AggregatorCore. No-Op.
bool stop()
Stops the AggregatorCore.
AggregatorCore & operator=(AggregatorCore const &)=delete
Copy Assignment operator is deleted.
bool shutdown()
Shuts Down the AggregatorCore.
bool start(art::RunID id)
Start the AggregatorCore.
std::string unregister_monitor(std::string const &label)
Delete the TransferInterface having the given unique label.
AggregatorCore(int rank, std::string name)
AggregatorCore Constructor.
static const std::string INPUT_WAIT_STAT_KEY
Key for the Input Wait MonitoredQuantity.
bool soft_initialize(fhicl::ParameterSet const &pset)
Soft-Initializes the AggregatorCore. No-Op.
bool resume()
Resumes the AggregatorCore.
std::string register_monitor(fhicl::ParameterSet const &pset)
Create a new TransferInterface instance using the given configuration.
static const std::string FILE_CHECK_TIME_STAT_KEY
Key for the File Check Time MonitoredQuantity.
AggregatorCore implements the state machine for the Aggregator artdaq application. AggregatorCore processes incoming events in one of three roles: Data Logger, Online Monitor, or Dispatcher.
std::string report(std::string const &which) const
Send a report on a given run-time quantity.
bool initialize(fhicl::ParameterSet const &pset)
Processes the initialize request.
bool pause()
Pauses the AggregatorCore.
static const std::string STORE_EVENT_WAIT_STAT_KEY
Key for the EventStore Event Wait MonitoredQuantity.
size_t process_fragments()
The main working loop of the AggregatorCore. Receives events from DataReceiverManager and processes t...