From c9f58adb0cdc63213430bd5631a2dfede0e569f2 Mon Sep 17 00:00:00 2001 From: Jose Guillermo Panduro Vazquez Date: Wed, 14 Jul 2021 19:31:41 +0200 Subject: [PATCH] fix PACMAN max message size, remove unneeded variables and properly link ZMQ timeout to configuration --- plugins/PacmanCardReader.cpp | 4 +--- plugins/PacmanCardReader.hpp | 3 +-- python/lbrulibs/app_confgen.py | 7 ++++--- python/lbrulibs/fake_NDreadout.json | 4 ++-- schema/lbrulibs/pacmancardreader.jsonnet | 6 +++--- src/ZMQLinkConcept.hpp | 21 ++++----------------- src/ZMQLinkModel.hpp | 10 +++++++--- 7 files changed, 22 insertions(+), 33 deletions(-) diff --git a/plugins/PacmanCardReader.cpp b/plugins/PacmanCardReader.cpp index c09501e..2e3756a 100644 --- a/plugins/PacmanCardReader.cpp +++ b/plugins/PacmanCardReader.cpp @@ -41,7 +41,6 @@ PacmanCardReader::PacmanCardReader(const std::string& name) : DAQModule(name) , m_configured(false) , m_card_id(0) - , m_logical_unit(0) { register_command("conf", &PacmanCardReader::do_configure); @@ -90,7 +89,6 @@ PacmanCardReader::do_configure(const data_t& args) { m_cfg = args.get(); m_card_id = m_cfg.card_id; - m_logical_unit = m_cfg.logical_unit; // Config checks - make some if config values needed, felix example below /* @@ -101,7 +99,7 @@ PacmanCardReader::do_configure(const data_t& args) // Configure components TLOG(TLVL_WORK_STEPS) << "Configuring ZMQLinkHandler"; - m_zmqlink[0]->set_ids(m_card_id, m_logical_unit); + m_zmqlink[0]->set_ids(m_card_id, 0); m_zmqlink[0]->conf(args); } diff --git a/plugins/PacmanCardReader.hpp b/plugins/PacmanCardReader.hpp index 81c978c..d7fba81 100644 --- a/plugins/PacmanCardReader.hpp +++ b/plugins/PacmanCardReader.hpp @@ -69,8 +69,7 @@ class PacmanCardReader : public dunedaq::appfwk::DAQModule module_conf_t m_cfg; int m_card_id; - int m_logical_unit; - + // ZMQLinkConcept std::map> m_zmqlink; diff --git a/python/lbrulibs/app_confgen.py b/python/lbrulibs/app_confgen.py index b15a7c4..298273c 100755 --- a/python/lbrulibs/app_confgen.py +++ b/python/lbrulibs/app_confgen.py @@ -106,13 +106,14 @@ def generate( confcmd = mrccmd("conf", "INITIAL", "CONFIGURED", [ ("fake_source",pcr.Conf( - pcr.GeoID(system="kNDLarTPC") + pcr.GeoID(system="kNDLarTPC"), + zmq_receiver_timeout = 10000 )), ] + [ (f"datahandler_{idx}", dlh.Conf( source_queue_timeout_ms= QUEUE_POP_WAIT_MS, fake_trigger_flag=1, - latency_buffer_size = 3*CLOCK_SPEED_HZ/(25*12*DATA_RATE_SLOWDOWN_FACTOR), + latency_buffer_size = 10,#3*CLOCK_SPEED_HZ/(25*12*DATA_RATE_SLOWDOWN_FACTOR), pop_limit_pct = 0.8, pop_size_pct = 0.1, apa_number = 0, @@ -121,7 +122,7 @@ def generate( ] + [ (f"data_recorder_{idx}", bfs.Conf( output_file = f"output_{idx}.out", - stream_buffer_size = 8388608 + stream_buffer_size = 100#8388608 )) for idx in range(NUMBER_OF_DATA_PRODUCERS) ]) diff --git a/python/lbrulibs/fake_NDreadout.json b/python/lbrulibs/fake_NDreadout.json index f10bf33..7d4dc9b 100644 --- a/python/lbrulibs/fake_NDreadout.json +++ b/python/lbrulibs/fake_NDreadout.json @@ -126,7 +126,7 @@ { "data": { "card_id": 0, - "logical_unit": 0 + "zmq_receiver_timeout": 10000 }, "match": "fake_source" }, @@ -140,7 +140,7 @@ "num_request_handling_threads": 1, "pop_limit_pct": 0.8, "pop_size_pct": 0.1, - "source_queue_timeout_ms": 10000 + "source_queue_timeout_ms": 100 }, "match": "datahandler_0" }, diff --git a/schema/lbrulibs/pacmancardreader.jsonnet b/schema/lbrulibs/pacmancardreader.jsonnet index 01e5af0..9cbf288 100644 --- a/schema/lbrulibs/pacmancardreader.jsonnet +++ b/schema/lbrulibs/pacmancardreader.jsonnet @@ -30,10 +30,10 @@ local pacmancardreader = { conf: s.record("Conf", [ s.field("card_id", self.id, 0, - doc="Physical card identifier (in the same host)"), + doc="FE card identifier"), - s.field("logical_unit", self.count, 0, - doc="Superlogic region of selected card"), + s.field("zmq_receiver_timeout", self.id, 0, + doc="ZMQ Receive Timeout value"), ], doc="Upstream Pacman CardReader DAQ Module Configuration"), diff --git a/src/ZMQLinkConcept.hpp b/src/ZMQLinkConcept.hpp index 968bbca..62de2f2 100644 --- a/src/ZMQLinkConcept.hpp +++ b/src/ZMQLinkConcept.hpp @@ -24,7 +24,6 @@ class ZMQLinkConcept { public: ZMQLinkConcept() : m_card_id(0) - , m_logical_unit(0) , m_link_tag(0) {} ~ZMQLinkConcept() {} @@ -44,28 +43,16 @@ class ZMQLinkConcept { virtual void start(const nlohmann::json& args) = 0; virtual void stop(const nlohmann::json& args) = 0; - - void set_ids(int card, int slr) { + void set_ids(int card, int tag) { m_card_id = card; - m_logical_unit = slr; - - std::ostringstream lidstrs; - lidstrs << "ZMQLink[" - << "cid:" << std::to_string(m_card_id) << "|" - << "slr:" << std::to_string(m_logical_unit) << "|"; - //m_ZMQLink_commandLink = lidstrs.str(); - - std::ostringstream tidstrs; - tidstrs << "ept-" << std::to_string(m_card_id) - << "-" << std::to_string(m_logical_unit); - //m_ZMQLink_sourceLink = tidstrs.str(); + m_link_tag = tag; } protected: + dunedaq::lbrulibs::pacmancardreader::Conf m_cfg; std::shared_ptr m_subscriber; - std::chrono::milliseconds m_queue_timeout{1000}; + std::chrono::milliseconds m_queue_timeout; int m_card_id; - int m_logical_unit; int m_link_tag; std::string m_ZMQLink_commandLink = "tcp://127.0.0.1:5555"; std::string m_ZMQLink_sourceLink = "tcp://127.0.0.1:5556"; diff --git a/src/ZMQLinkModel.hpp b/src/ZMQLinkModel.hpp index 62ab0a2..2267f7c 100644 --- a/src/ZMQLinkModel.hpp +++ b/src/ZMQLinkModel.hpp @@ -62,20 +62,24 @@ class ZMQLinkModel : public ZMQLinkConcept { } - void conf(const data_t& /*args*/) { + void conf(const data_t& args) { if (m_configured) { TLOG_DEBUG(5) << "ZMQLinkModel is already configured!"; } else { + m_cfg = args.get(); + + m_queue_timeout = std::chrono::milliseconds(m_cfg.zmq_receiver_timeout); + TLOG_DEBUG(5) << "ZMQLinkModel conf: initialising subscriber!"; m_subscriber = dunedaq::ipm::make_ipm_subscriber("ZmqSubscriber"); TLOG_DEBUG(5) << "ZMQLinkModel conf: connecting subscriber!"; - m_subscriber->connect_for_receives({ {"connection_string", ZMQLinkConcept::m_ZMQLink_sourceLink} }); + m_subscriber->connect_for_receives({ {"connection_string", m_ZMQLink_sourceLink} }); TLOG_DEBUG(5) << "ZMQLinkModel conf: enacting subscription!"; m_subscriber->subscribe(""); TLOG_DEBUG(5) << "Configuring ZMQLinkModel!"; - m_parser_thread.set_name(ZMQLinkConcept::m_ZMQLink_sourceLink, ZMQLinkConcept::m_link_tag); + m_parser_thread.set_name(m_ZMQLink_sourceLink, m_link_tag); m_configured=true; } }