9#include "pybind11/operators.h"
10#include "pybind11/pybind11.h"
11#include "pybind11/stl.h"
25namespace py = pybind11;
32 ObjectLocator(
const std::string& id_arg,
const std::string& class_name_arg)
41std::vector<ObjectLocator>
45 std::vector<ObjectLocator> apps;
46 for (
auto app :
session->all_applications()) {
47 apps.push_back({ app->UID(), app->class_name() });
52std::vector<ObjectLocator>
56 std::vector<ObjectLocator> apps;
57 for (
auto app :
session->included_applications()) {
58 apps.push_back({ app->UID(), app->class_name() });
68 if (session_ptr ==
nullptr) {
69 throw(std::runtime_error(std::format(
"Session {} not found", session_id)));
71 if (component_ptr ==
nullptr) {
72 throw(std::runtime_error(std::format(
"Component {} not found", component_id)));
74 session_ptr->exclude(component_ptr);
81 if (session_ptr ==
nullptr) {
82 throw(std::runtime_error(std::format(
"Session {} not found", session_id)));
84 if (component_ptr ==
nullptr) {
85 throw(std::runtime_error(std::format(
"Component {} not found", component_id)));
87 session_ptr->include(component_ptr);
96 if (component_ptr ==
nullptr) {
102std::vector<std::vector<ObjectLocator>>
109 std::list<std::vector<const dunedaq::confmodel::ExcludableEntity*>> parents;
110 std::vector<std::vector<ObjectLocator>> parent_ids;
112 component_ptr->
parents(*session_ptr, parents);
114 for (
const auto& parent : parents) {
115 std::vector<ObjectLocator> parents_components;
116 for (
const auto& ancestor_component_ptr : parent) {
117 parents_components.emplace_back(
118 ObjectLocator(ancestor_component_ptr->UID(), ancestor_component_ptr->class_name()));
120 parent_ids.emplace_back(parents_components);
125std::vector<std::string>
129 std::vector<std::string> resources;
130 for (
auto res : app->get_used_host_components()) {
131 resources.push_back(res->UID());
136std::vector<std::string>
138 const std::string& session_id,
139 const std::string& app_id)
143 return app->construct_commandline_parameters(db,
session);
146std::vector<std::string>
148 const std::string& session_id,
149 const std::string& app_id)
153 return app->construct_commandline_parameters(db,
session);
160 if (d2d ==
nullptr) {
166std::vector<std::string>
169 std::vector<std::string> senders;
171 if (d2d !=
nullptr) {
172 for (
auto sender : d2d->senders()) {
173 senders.push_back(sender->UID());
179std::vector<std::string>
182 std::vector<std::string> streams;
184 if (d2d !=
nullptr) {
185 for (
auto stream : d2d->streams()) {
186 streams.push_back(stream->UID());
192std::vector<std::string>
195 std::vector<std::string> resources;
197 if (res_set !=
nullptr) {
198 for (
auto res : res_set->contained_excludable_entities()) {
199 resources.push_back(res->UID());
208 py::class_<ObjectLocator>(m,
"ObjectLocator")
209 .def(py::init<const std::string&, const std::string&>())
213 m.def(
"session_get_all_applications",
215 "Get list of ALL applications (regardless of included/excluded state) in the requested session");
216 m.def(
"session_get_included_applications",
218 "Get list of included applications in the requested session");
220 m.def(
"exclude_entity", &
exclude_entity,
"Exclude a ExcludableEntity-derived object (e.g. a Segment)");
221 m.def(
"include_entity", &
include_entity,
"Include a ExcludableEntity-derived object (e.g. a Segment)");
223 m.def(
"entity_excluded",
225 "Determine if a ExcludableEntity-derived object (e.g. a Segment) has been excluded");
226 m.def(
"entity_get_parents",
228 "Get the ExcludableEntity-derived class instances of the parent(s) of the ExcludableEntity-derived object in "
230 m.def(
"daqapp_get_used_host_components",
232 "Get list of HostExcludableEntitys used by DAQApplication");
233 m.def(
"daq_application_construct_commandline_parameters",
235 "Get a version of the command line agruments parsed");
236 m.def(
"rc_application_construct_commandline_parameters",
238 "Get a version of the command line agruments parsed");
240 m.def(
"d2d_receiver", &
d2d_receiver,
"Get receiver associated with DetectorToDaqConnection");
241 m.def(
"d2d_senders", &
d2d_senders,
"Get senders associated with DetectorToDaqConnection");
242 m.def(
"d2d_streams", &
d2d_streams,
"Get streams associated with DetectorToDaqConnection");
243 m.def(
"exclude_entity_set_contains",
245 "Get contained ExcludableEntitys from ExcludableEntitySet");
Defines base class for cache of template objects.
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 & UID() const noexcept
virtual const DetDataReceiver * receiver() const =0
bool is_excluded(const dunedaq::confmodel::ExcludableEntityTree &session) const
void parents(const dunedaq::confmodel::Session &session, std::list< std::vector< const dunedaq::confmodel::ExcludableEntity * > > &parents) const
bool entity_excluded(Configuration &db, const std::string &session_id, const std::string &component_id)
std::vector< std::string > rc_application_construct_commandline_parameters(Configuration &db, const std::string &session_id, const std::string &app_id)
std::vector< std::string > d2d_senders(Configuration &db, const std::string &d2d_id)
std::vector< std::string > d2d_streams(Configuration &db, const std::string &d2d_id)
std::vector< ObjectLocator > session_get_included_applications(Configuration &db, const std::string &session_name)
std::vector< std::string > daq_application_construct_commandline_parameters(Configuration &db, const std::string &session_id, const std::string &app_id)
std::vector< std::string > exclude_entity_set_contains(Configuration &db, const std::string &res_id)
std::vector< std::string > daq_application_get_used_host_components(Configuration &db, const std::string &app_id)
void exclude_entity(Configuration &db, const std::string &session_id, const std::string &component_id)
std::vector< ObjectLocator > session_get_all_applications(Configuration &db, const std::string &session_name)
void register_dal_methods(py::module &m)
std::vector< std::vector< ObjectLocator > > entity_get_parents(Configuration &db, const std::string &session_id, const std::string &component_id)
std::string d2d_receiver(Configuration &db, const std::string &d2d_id)
void include_entity(Configuration &db, const std::string &session_id, const std::string &component_id)
const std::string class_name
ObjectLocator(const std::string &id_arg, const std::string &class_name_arg)