9#ifndef APPFWK_SRC_DAQMODULEMANAGER_HPP_
10#define APPFWK_SRC_DAQMODULEMANAGER_HPP_
13#include "nlohmann/json.hpp"
34 DAQModuleManagerNotInitialized,
35 "Command " << cmdid <<
" received before initialization",
40 "\"init\" Command received when already initialized",
44 CommandDispatchingFailed,
45 "Command " << cmdid << " was not executed correctly by: " << modules,
46 ((
std::
string)cmdid)((
std::
string)modules))
50 "Command " << cmdid << " matches multiple times modules: " << modules,
51 ((
std::
string)cmdid)((
std::
string)modules))
56 ExceptionWhileInfoGathering,
58 module << " threw
exception while info gathering: " << message,
59 ((
std::
string)module),
60 ((
std::
string)message))
64 "No action plan found for command " << cmd << ", taking the following action: " << message,
65 ((
std::
string)cmd)((
std::
string)message))
71constexpr int ACTION_PLANS_REQUIRED = 0;
72constexpr int ACTION_PLANS_REQUIRED_WARNING = 0;
77 explicit DAQModuleManager(
const std::string& session_name);
84 void execute(
const std::string& cmd,
const DAQModule::CommandData_t& cmd_data);
87 void set_config_mgr(std::shared_ptr<ConfigurationManager> mgr) { m_configuration_mgr = mgr; }
88 void construct_modules(
const std::vector<const dunedaq::confmodel::DaqModule*>& modules);
89 std::vector<ValidationReport> validate_action_plans(
bool throw_on_fatal =
true);
92 typedef std::map<std::string, std::shared_ptr<DAQModule>> DAQModuleMap_t;
94 void init_modules(
const std::vector<const dunedaq::confmodel::DaqModule*>& modules,
opmonlib::OpMonManager&);
96 void check_command_data(
const std::string&
id,
const DAQModule::CommandData_t& cmd_data);
97 DAQModule::CommandData_t get_command_data_for_module(
const std::string& mod_name,
98 const DAQModule::CommandData_t& cmd_data);
99 bool execute_action(
const std::string& mod_name,
const std::string& action,
const DAQModule::CommandData_t& data_obj);
100 void execute_action_plan_step(
const std::string& cmd,
102 const DAQModule::CommandData_t& cmd_data,
103 bool execution_mode_is_serial);
105 std::optional<ValidationReport> check_mod_has_cmd(
const std::string& cmd,
106 const std::string& mod_class,
108 const std::string& mod_id,
109 bool throw_on_fatal);
112 std::shared_ptr<ConfigurationManager> m_configuration_mgr;
114 std::string m_session_name;
117 DAQModuleMap_t m_module_map;
118 std::map<std::string, std::vector<std::string>> m_modules_by_type;
#define ERS_DECLARE_ISSUE_BASE(namespace_name, class_name, base_class_name, message, base_attributes, attributes)
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
caught dunedaq::conffwk::Exception exception
Unsupported std::string uri Execution of command failed
init Command received when already initialized
LED calibration failed to initialize
DAQModuleManagerAlreadyInitialized
init Command received when already ERS_EMPTY ConflictingCommandMatching