29#include "nlohmann/json.hpp"
56 std::vector<const dunedaq::confmodel::Component *> & p_list,
57 std::list< std::vector<const dunedaq::confmodel::Component *> >&
out,
63 p_list.push_back(resource_set);
67 if (i->config_object().implementation() == child) {
68 out.push_back(p_list);
83 std::vector<const dunedaq::confmodel::Component *> & p_list,
84 std::list<std::vector<const dunedaq::confmodel::Component *> >&
out,
91 p_list.push_back(segment);
95 if (seg->config_object().implementation() == child)
96 out.push_back(p_list);
102 if (app->config_object().implementation() == child)
103 out.push_back(p_list);
117 std::list< std::vector<const dunedaq::confmodel::Component *> >&
out,
125 std::vector<const dunedaq::confmodel::Component *> compList;
128 out.push_back(compList);
136 std::list<std::vector<const dunedaq::confmodel::Component *>>& parents)
const
150 if (parents.empty()) {
151 TLOG_DEBUG(1) <<
"cannot find segment/resource path(s) between Component " <<
this <<
" and session " << &
session <<
" objects (check this object is linked with the session as a segment or a resource)" ;
164 std::vector<const Application*> apps;
167 for (
auto app : segapps) {
169 if (comp ==
nullptr || !comp->disabled(*
session)) {
170 apps.insert(apps.end(), app);
178 if (!enabled_only || !seg->disabled(*
session)) {
180 apps.insert(apps.end(), segapps.begin(),segapps.end());
186std::vector<const Application*>
188 std::vector<const Application*> apps;
190 apps.insert(apps.end(), segapps.begin(),segapps.end());
194std::vector<const Application*>
196 std::vector<const Application*> apps;
198 apps.insert(apps.end(), segapps.begin(),segapps.end());
204std::set<const HostComponent*>
206 std::set<const HostComponent*> res;
208 for (
auto hostresource : module->get_used_resources()) {
209 res.insert(hostresource);
217 const std::string& class_name,
218 const std::string& uid,
220 bool skip_object_name) {
221 using nlohmann::json;
223 TLOG_DBG(9) <<
"Getting attributes for " << uid <<
" of class " << class_name;
227 confdb.
get(class_name, uid, obj);
228 for (
auto attr : class_info.p_attributes) {
229 if (attr.p_type == type_t::u8_type) {
232 else if (attr.p_type == type_t::u16_type) {
235 else if (attr.p_type == type_t::u32_type) {
238 else if (attr.p_type == type_t::u64_type) {
241 else if (attr.p_type == type_t::s8_type) {
244 else if (attr.p_type == type_t::s16_type) {
247 else if (attr.p_type == type_t::s32_type ||
248 attr.p_type == type_t::s16_type) {
251 else if (attr.p_type == type_t::s64_type) {
254 else if (attr.p_type == type_t::float_type) {
257 else if (attr.p_type == type_t::double_type) {
260 else if (attr.p_type == type_t::bool_type) {
263 else if ((attr.p_type == type_t::string_type) ||
264 (attr.p_type == type_t::enum_type) ||
265 (attr.p_type == type_t::date_type) ||
266 (attr.p_type == type_t::time_type)) {
271 TLOG_DBG(9) <<
"Processing relationships";
272 for (
auto iter: class_info.p_relationships) {
273 std::string rel_name = iter.p_name;
274 if (iter.p_cardinality == cardinality_t::zero_or_one ||
275 iter.p_cardinality == cardinality_t::only_one) {
277 obj.get(rel_name, rel_obj);
279 TLOG_DBG(9) <<
"Getting attibute of relationship " << rel_name;
286 TLOG_DBG(9) <<
"Relationship " << rel_name <<
" not set";
290 TLOG_DBG(9) <<
"Relationship " << rel_name <<
" is multi value. "
291 <<
"Getting attibutes for relationship.";
292 std::vector<ConfigObject> rel_vec;
293 obj.get(rel_name, rel_vec);
294 std::vector<json> configs;
295 for (
auto rel_obj : rel_vec) {
296 TLOG_DBG(9) <<
"Getting attibute of relationship " << rel_obj.
UID();
297 auto rel_conf = get_json_config(confdb, rel_obj.
class_name(), rel_obj.
UID(),
298 direct_only, skip_object_name);
299 configs.push_back(rel_conf);
306 if (skip_object_name) {
316 bool skip_object_name)
const {
332 const std::string configuration_uri = confdb.
get_impl_spec();
335 const std::string controller_log_level =
session->get_controller_log_level();
338 if (as->UID().ends_with(
"_control")) {
341 control_service = as;
345 if (control_service ==
nullptr)
348 const std::string control_uri =
353 + std::to_string(control_service->
get_port());
355 std::vector<std::string> ret = {
"-l", controller_log_level };
356 ret.push_back(configuration_uri);
357 ret.push_back(control_uri);
358 ret.push_back(
UID());
365 std::vector<const confmodel::DetDataSender*> senders;
370 if ( sender !=
nullptr ) {
371 senders.push_back(sender);
378 for (
auto res : rs->get_contains()) {
380 if ( sender !=
nullptr ) {
381 senders.push_back(sender);
394 std::vector<const confmodel::DetDataReceiver*> receivers;
401 receivers.push_back(r);
404 if (receivers.size() != 1) {
405 throw(
ConfigurationError(
ERS_HERE,
"DetectorToDaqConnection : expected 1 receiver in D2d conection {name of connection}, found {number found}"));
409 return receivers.at(0);
416 std::vector<const confmodel::DetectorStream*> streams;
420 for (
auto stream_res : sender->get_contains()) {
423 throw(
ConfigurationError(
ERS_HERE,
"DetectorToDaqConnection : Non-stream object '"+stream_res->UID()+
"' found in DetDataSender '"+stream_res->UID()+
"'"));
436 if ( type ==
"file" ) {
440 if ( type ==
"stream" ) {
Implements database objects.
Represents database objects.
const std::string & UID() const noexcept
Return object identity.
bool is_null() const noexcept
Check if object's implementation points to null.
const ConfigObjectImpl * implementation() const noexcept
Returns pointer on implementation.
const std::string & class_name() const noexcept
Return object's class name.
void get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
Get object by class name and object id (multi-thread safe).
const std::string & get_impl_spec() const noexcept
const dunedaq::conffwk::class_t & get_class_info(const std::string &class_name, bool direct_only=false)
The method provides access to description of class.
const TARGET * cast() const noexcept
Casts object to different class.
const std::string & class_name() const noexcept
const ConfigObject & config_object() const
const std::string & UID() const noexcept
DalRegistry & p_registry
Configuration object.
Configuration & configuration()
const std::vector< const dunedaq::confmodel::Service * > & get_exposes_service() const
Get "exposes_service" relationship value. Services exposed i.e. provided by this application.
const dunedaq::confmodel::VirtualHost * get_runs_on() const
Get "runs_on" relationship value. VirtualHost to run this application on.
void get_parents(const dunedaq::confmodel::Session &session, std::list< std::vector< const dunedaq::confmodel::Component * > > &parents) const
const std::vector< const dunedaq::confmodel::DaqModule * > & get_modules() const
Get "modules" relationship value.
const std::vector< std::string > construct_commandline_parameters(const conffwk::Configuration &confdb, const dunedaq::confmodel::Session *session) const
std::set< const dunedaq::confmodel::HostComponent * > get_used_hostresources() const
std::vector< const confmodel::DetDataSender * > get_senders() const
const confmodel::DetDataReceiver * get_receiver() const
std::vector< const confmodel::DetectorStream * > get_streams() const
nlohmann::json to_json(bool direct=false, bool skip_name=false) const
std::string get_URI(const std::string &app) const
const std::string & get_type() const
Get "type" attribute value. type of the OpMonFacility.
const std::string & get_path() const
Get "path" attribute value. property used to generate the final URI.
const std::vector< std::string > construct_commandline_parameters(const conffwk::Configuration &confdb, const dunedaq::confmodel::Session *session) const
const std::vector< const dunedaq::confmodel::ResourceBase * > & get_contains() const
Get "contains" relationship value. A resource set is a container of resources to easily implement gro...
const std::vector< const dunedaq::confmodel::Segment * > & get_segments() const
Get "segments" relationship value. Nested list of Segments that form part of this Segment.
const std::vector< const dunedaq::confmodel::Application * > & get_applications() const
Get "applications" relationship value. List of Applications that run in this Segment.
static const std::string & s_class_name
const std::string & get_protocol() const
Get "protocol" attribute value.
uint16_t get_port() const
Get "port" attribute value.
std::vector< const dunedaq::confmodel::Application * > get_all_applications() const
std::vector< const dunedaq::confmodel::Application * > get_enabled_applications() const
const dunedaq::confmodel::Segment * m_segment
const dunedaq::confmodel::PhysicalHost * get_runs_on() const
Get "runs_on" relationship value. The physical host that this virtual host runs on.
Base class for any user define issue.
#define TLOG_DEBUG(lvl,...)
std::vector< T > attributes(tref const &item)
const std::vector< std::string > construct_commandline_parameters_appfwk(const T *app, const conffwk::Configuration &confdb, const dunedaq::confmodel::Session *session)
static void check_segment(std::list< std::vector< const dunedaq::confmodel::Component * > > &out, const dunedaq::confmodel::Segment *segment, const ConfigObjectImpl *child, bool is_segment, dunedaq::confmodel::TestCircularDependency &cd_fuse)
void add_json_value(conffwk::ConfigObject &obj, std::string &name, bool multi_value, nlohmann::json &attributes)
static void make_parents_list(const ConfigObjectImpl *child, const dunedaq::confmodel::ResourceSet *resource_set, std::vector< const dunedaq::confmodel::Component * > &p_list, std::list< std::vector< const dunedaq::confmodel::Component * > > &out, dunedaq::confmodel::TestCircularDependency &cd_fuse)
static std::vector< const Application * > getSegmentApps(const Segment *segment, const Session *session, bool enabled_only)
FELIX Initialization std::string initerror FELIX queue timed out
The opmon infrastructure has not been set up in the DuplicatedControlService
void error(const Issue &issue)