Skip to content

Commit

Permalink
Merge pull request #63 from DUNE-DAQ/eflumerf/IOManager_Issue70_idea
Browse files Browse the repository at this point in the history
Using iomanager:eflumerf/Issue70_idea, have a test configuration with
  • Loading branch information
eflumerf authored Nov 19, 2024
2 parents bb4d290 + 8fe314e commit 3b60b18
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 6 deletions.
196 changes: 196 additions & 0 deletions config/lrSession-gg.data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<?xml version="1.0" encoding="ASCII"?>

<!-- oks-data version 2.2 -->


<!DOCTYPE oks-data [
<!ELEMENT oks-data (info, (include)?, (comments)?, (obj)+)>
<!ELEMENT info EMPTY>
<!ATTLIST info
name CDATA #IMPLIED
type CDATA #IMPLIED
num-of-items CDATA #REQUIRED
oks-format CDATA #FIXED "data"
oks-version CDATA #REQUIRED
created-by CDATA #IMPLIED
created-on CDATA #IMPLIED
creation-time CDATA #IMPLIED
last-modified-by CDATA #IMPLIED
last-modified-on CDATA #IMPLIED
last-modification-time CDATA #IMPLIED
>
<!ELEMENT include (file)*>
<!ELEMENT file EMPTY>
<!ATTLIST file
path CDATA #REQUIRED
>
<!ELEMENT comments (comment)*>
<!ELEMENT comment EMPTY>
<!ATTLIST comment
creation-time CDATA #REQUIRED
created-by CDATA #REQUIRED
created-on CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT obj (attr | rel)*>
<!ATTLIST obj
class CDATA #REQUIRED
id CDATA #REQUIRED
>
<!ELEMENT attr (data)*>
<!ATTLIST attr
name CDATA #REQUIRED
type (bool|s8|u8|s16|u16|s32|u32|s64|u64|float|double|date|time|string|uid|enum|class|-) "-"
val CDATA ""
>
<!ELEMENT data EMPTY>
<!ATTLIST data
val CDATA #REQUIRED
>
<!ELEMENT rel (ref)*>
<!ATTLIST rel
name CDATA #REQUIRED
class CDATA ""
id CDATA ""
>
<!ELEMENT ref EMPTY>
<!ATTLIST ref
class CDATA #REQUIRED
id CDATA #REQUIRED
>
]>

<oks-data>

<info name="" type="" num-of-items="9" oks-format="data" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20231116T105446" last-modified-by="eflumerf" last-modified-on="ironvirt9.mshome.net" last-modification-time="20241118T162311"/>

<include>
<file path="config/listrev-objects.data.xml"/>
</include>

<comments>
<comment creation-time="20231116T122331" created-by="gjc" created-on="thinkpad" author="gjc" text="k"/>
<comment creation-time="20231117T105205" created-by="gjc" created-on="thinkpad" author="gjc" text="ff"/>
<comment creation-time="20231117T120703" created-by="gjc" created-on="thinkpad" author="gjc" text="n"/>
<comment creation-time="20231117T121356" created-by="gjc" created-on="thinkpad" author="gjc" text="rename"/>
<comment creation-time="20240516T142257" created-by="eflumerf" created-on="ironvirt9.mshome.net" author="eflumerf" text="Remove extra modules"/>
<comment creation-time="20240516T142536" created-by="eflumerf" created-on="ironvirt9.mshome.net" author="eflumerf" text="Update network connections"/>
<comment creation-time="20240516T142824" created-by="eflumerf" created-on="ironvirt9.mshome.net" author="eflumerf" text="Extend timeouts"/>
</comments>


<obj class="DaqApplication" id="listrev-g">
<attr name="application_name" type="string" val="daq_application"/>
<rel name="runs_on" class="VirtualHost" id="vlocalhost"/>
<rel name="exposes_service">
<ref class="Service" id="listrev-g_control"/>
</rel>
<rel name="opmon_conf" class="OpMonConf" id="all-monitoring"/>
<rel name="modules">
<ref class="RandomDataListGenerator" id="rdlg0"/>
<ref class="RandomDataListGenerator" id="rdlg1"/>
</rel>
</obj>

<obj class="DaqApplication" id="listrev-rv">
<attr name="application_name" type="string" val="daq_application"/>
<rel name="runs_on" class="VirtualHost" id="vlocalhost"/>
<rel name="exposes_service">
<ref class="Service" id="listrev-rv_control"/>
</rel>
<rel name="opmon_conf" class="OpMonConf" id="all-monitoring"/>
<rel name="modules">
<ref class="ListReverser" id="lr0"/>
<ref class="ReversedListValidator" id="lrv"/>
</rel>
</obj>

<obj class="ListReverser" id="lr0">
<attr name="request_timeout_ms" type="u32" val="1000"/>
<attr name="send_timeout_ms" type="u32" val="1000"/>
<rel name="inputs">
<ref class="Queue" id="lr0_request_queue"/>
<ref class="NetworkConnection" id="lr0_list_connection"/>
</rel>
<rel name="outputs">
<ref class="NetworkConnection" id="rdlg0_request_connection"/>
<ref class="NetworkConnection" id="rdlg1_request_connection"/>
<ref class="Queue" id="validator_list_queue"/>
</rel>
</obj>

<obj class="RandomDataListGenerator" id="rdlg0">
<attr name="request_timeout_ms" type="u32" val="10000"/>
<attr name="send_timeout_ms" type="u32" val="1000"/>
<rel name="inputs">
<ref class="NetworkConnection" id="rdlg0_request_connection"/>
<ref class="NetworkConnection" id="creates"/>
</rel>
<rel name="outputs">
<ref class="NetworkConnection" id="lr0_list_connection"/>
</rel>
</obj>

<obj class="RandomDataListGenerator" id="rdlg1">
<attr name="request_timeout_ms" type="u32" val="10000"/>
<attr name="send_timeout_ms" type="u32" val="1000"/>
<attr name="generator_id" type="u32" val="1"/>
<rel name="inputs">
<ref class="NetworkConnection" id="rdlg1_request_connection"/>
<ref class="NetworkConnection" id="creates"/>
</rel>
<rel name="outputs">
<ref class="NetworkConnection" id="lr0_list_connection"/>
</rel>
</obj>

<obj class="RandomListGeneratorSet" id="genset">
<rel name="generators">
<ref class="RandomDataListGenerator" id="rdlg0"/>
<ref class="RandomDataListGenerator" id="rdlg1"/>
</rel>
</obj>

<obj class="ReversedListValidator" id="lrv">
<attr name="request_timeout_ms" type="u32" val="100000"/>
<attr name="send_timeout_ms" type="u32" val="1000"/>
<attr name="min_list_size" type="u32" val="5"/>
<attr name="max_list_size" type="u32" val="20"/>
<attr name="max_outstanding_requests" type="u32" val="100"/>
<attr name="request_rate_hz" type="u32" val="1"/>
<rel name="inputs">
<ref class="Queue" id="validator_list_queue"/>
</rel>
<rel name="outputs">
<ref class="NetworkConnection" id="creates"/>
<ref class="Queue" id="lr0_request_queue"/>
</rel>
<rel name="generatorSet" class="RandomListGeneratorSet" id="genset"/>
</obj>

<obj class="Segment" id="root-segment">
<rel name="applications">
<ref class="DaqApplication" id="listrev-rv"/>
<ref class="DaqApplication" id="listrev-g"/>
</rel>
<rel name="controller" class="RCApplication" id="root-controller"/>
</obj>

<obj class="Session" id="lr-session">
<attr name="data_request_timeout_ms" type="u32" val="1000"/>
<attr name="data_rate_slowdown_factor" type="u32" val="1"/>
<attr name="controller_log_level" type="enum" val="INFO"/>
<rel name="connectivity_service" class="ConnectivityService" id="connectivity-service-config"/>
<rel name="environment">
<ref class="VariableSet" id="common-env"/>
</rel>
<rel name="segment" class="Segment" id="root-segment"/>
<rel name="infrastructure_applications">
<ref class="ConnectionService" id="local-connection-server"/>
</rel>
<rel name="detector_configuration" class="DetectorConfig" id="dummy-detector"/>
<rel name="opmon_uri" class="OpMonURI" id="local-opmon-uri"/>
</obj>

</oks-data>
6 changes: 5 additions & 1 deletion integtest/listrev_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
os.path.dirname(__file__) + "/../config/lrSession-separate.data.xml"
)
multigen_conf = copy.deepcopy(common_config_obj)
multigen_conf.config_db = os.path.dirname(__file__) + "/../config/lrSession.data.xml"
multigen_conf.config_db = os.path.dirname(__file__) + "/../config/lrSession-gg.data.xml"

large_conf = copy.deepcopy(common_config_obj)
large_conf.config_db = os.path.dirname(__file__) + "/../config/lrSession.data.xml"

confgen_arguments = {
"Single App": single_app_conf,
Expand All @@ -60,6 +63,7 @@
"Separate Reverser": r_conf,
"Independent Apps": separate_conf,
"Multiple Generators": multigen_conf,
"Large System": large_conf,
}
# The commands to run in nanorc, as a list
nanorc_command_list = (
Expand Down
9 changes: 4 additions & 5 deletions plugins/RandomDataListGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ void
RandomDataListGenerator::init(std::shared_ptr<appfwk::ModuleConfiguration> mcfg)
{
TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Entering init() method";
auto mdal = mcfg
->module<dal::RandomDataListGenerator>(get_name());
auto mdal = mcfg->module<dal::RandomDataListGenerator>(get_name());

if (mdal == nullptr) {
throw appfwk::CommandFailed(ERS_HERE, get_name(), "init", "Unable to load module configuration");
Expand All @@ -70,7 +69,7 @@ RandomDataListGenerator::init(std::shared_ptr<appfwk::ModuleConfiguration> mcfg)
// these are just tests to check if the connections are ok
auto iom = iomanager::IOManager::get();
iom->get_receiver<RequestList>(m_request_connection);
iom->get_receiver<CreateList>(m_create_connection);
iom->get_receiver<CreateList>(m_create_connection, get_name());

m_send_timeout = std::chrono::milliseconds(mdal->get_send_timeout_ms());
m_request_timeout = std::chrono::milliseconds(mdal->get_request_timeout_ms());
Expand Down Expand Up @@ -101,13 +100,13 @@ RandomDataListGenerator::do_conf(const nlohmann::json& /*args*/)
auto iom = iomanager::IOManager::get();
// Add this callback early as this is a pub/sub connection
iom->add_callback<CreateList>(m_create_connection,
get_name(),
std::bind(&RandomDataListGenerator::process_create_list, this, std::placeholders::_1));

TLOG() << get_name() << " successfully configured";
TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Exiting do_conf() method";
}


void
RandomDataListGenerator::do_start(const nlohmann::json& /*args*/)
{
Expand All @@ -128,7 +127,7 @@ RandomDataListGenerator::do_stop(const nlohmann::json& /*args*/)

auto iom = iomanager::IOManager::get();
iom->remove_callback<RequestList>(m_request_connection);
iom->remove_callback<CreateList>(m_create_connection);
iom->remove_callback<CreateList>(m_create_connection, get_name());
m_storage.flush();

TLOG() << get_name() << " successfully stopped";
Expand Down
2 changes: 2 additions & 0 deletions src/ListCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ dunedaq::listrev::ListCreator::ListCreator(std::string conn,
max_list_size = min_list_size;
}
m_size_dist = std::uniform_int_distribution<>{ min_list_size, max_list_size };

get_iomanager()->get_sender<CreateList>(m_create_connection);
}

void
Expand Down

0 comments on commit 3b60b18

Please sign in to comment.