Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opmon configuration object to schema #43

Merged
merged 6 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions include/confmodel/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,15 @@ const std::vector<std::string> construct_commandline_parameters_appfwk(
if (opmon_app == nullptr)
throw NoOpmonInfrastructure(ERS_HERE, session->UID());

const dunedaq::confmodel::Service *opmon_service =
opmon_app->get_exposes_service()[0];
std::string opmon_uri = opmon_service->get_protocol() + "://" +
opmon_app->get_runs_on()->get_runs_on()->UID() + ":" +
std::to_string(opmon_service->get_port()) +
opmon_service->get_path();

if (opmon_service->get_protocol() == "file") {
auto file_name = opmon_service->get_path();
auto dot_pos = file_name.find('.');
if (dot_pos == std::string::npos)
throw InvalidOpMonFile(ERS_HERE, file_name);
file_name.insert(dot_pos, '_' + app->UID());
opmon_uri = opmon_service->get_protocol() + "://" + file_name;
}

const std::string configuration_uri = confdb.get_impl_spec();

return {
"-s",
session->UID(),
"--name",
app->UID(),
"-c",
control_uri,
"-i",
opmon_uri,
"--configurationService",
configuration_uri,
};
Expand Down
22 changes: 20 additions & 2 deletions schema/confmodel/dunedaq.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@

<oks-schema>

<info name="" type="" num-of-items="48" oks-format="schema" oks-version="862f2957270" created-by="jcfree" created-on="mu2edaq13.fnal.gov" creation-time="20230123T223700" last-modified-by="eflumerf" last-modified-on="ironvirt9.mshome.net" last-modification-time="20240829T165707"/>
<info name="" type="" num-of-items="49" oks-format="schema" oks-version="862f2957270" created-by="jcfree" created-on="mu2edaq13.fnal.gov" creation-time="20230123T223700" last-modified-by="maroda" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20240911T153344"/>

<class name="ActionPlan" description="A set of parallel steps for an application to carry out a command">
<attribute name="execution_policy" type="enum" description="How the application should execute steps of the action plan" range="modules-in-parallel,modules-in-series" init-value="modules-in-parallel"/>
<attribute name="execution_policy" description="How the application should execute steps of the action plan" type="enum" range="modules-in-parallel,modules-in-series" init-value="modules-in-parallel"/>
<relationship name="command" class-type="FSMCommand" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="steps" class-type="DaqModulesGroup" low-cc="zero" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
</class>
Expand All @@ -94,6 +94,7 @@
<relationship name="application_environment" description="Define process environment for this application." class-type="VariableBase" low-cc="zero" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="runs_on" description="VirtualHost to run this application on" class-type="VirtualHost" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="no" is-dependent="yes"/>
<relationship name="exposes_service" description="Services exposed i.e. provided by this application" class-type="Service" low-cc="zero" high-cc="many" is-composite="yes" is-exclusive="no" is-dependent="yes"/>
<relationship name="opmon_conf" description="description of the monitoring behaviour in the application" class-type="OpMonConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<method name="parse_commandline_parameters" description="Get the CLA for the application">
<method-implementation language="c++" prototype=" const std::vector&lt;std::string&gt; parse_commandline_parameters() const" body=""/>
</method>
Expand Down Expand Up @@ -258,10 +259,26 @@
<attribute name="network_name" description="Name of network on this interface Control or Data" type="enum" range="Control,Data" init-value="Control" is-not-null="yes"/>
</class>

<class name="OpMonConf">
<attribute name="level" description="SystemOpMonLevel" type="u32" init-value="4294967295" is-not-null="yes"/>
<attribute name="interval_s" description="interval in seconds between the collection of monitoring data in an application" type="u32" range="0..100" init-value="5" is-not-null="yes"/>
<method name="get_interval" description="obtain the interval casted in seconds">
<method-implementation language="C++" prototype="std::chrono::seconds get_interval() const " body="BEGIN_HEADER_PROLOGUE&#xA;#include &lt;chrono&gt;&#xA;END_HEADER_PROLOGUE&#xA;&#xA;return std::chrono::seconds(get_interval_s());"/>
</method>
</class>

<class name="OpMonService">
<superclass name="Application"/>
</class>

<class name="OpMonURI">
<attribute name="path" description="property used to generate the final URI" type="string"/>
<attribute name="type" description="type of the OpMonFacility" type="enum" range="stdout,file,stream" init-value="stdout" is-not-null="yes"/>
<method name="get_URI" description="generate the opmon facility URI for the specified application">
<method-implementation language="C++" prototype="std::string get_URI( const std::string &amp; app ) const" body=""/>
</method>
</class>

<class name="PhysicalHost">
<relationship name="contains" description="List of hardware components on this host" class-type="HostComponent" low-cc="one" high-cc="many" is-composite="yes" is-exclusive="no" is-dependent="yes"/>
</class>
Expand Down Expand Up @@ -345,6 +362,7 @@
<relationship name="segment" description="List of configuration Segments that form this Session" class-type="Segment" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="no" is-dependent="yes"/>
<relationship name="infrastructure_applications" class-type="Application" low-cc="zero" high-cc="many" is-composite="yes" is-exclusive="no" is-dependent="yes"/>
<relationship name="detector_configuration" class-type="DetectorConfig" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="opmon_uri" description="Configuration for the OpMon facilities used across the session" class-type="OpMonURI" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="no" is-dependent="yes"/>
<method name="get_all_applications" description="Returns applications defined in the Session and all of its Segments.">
<method-implementation language="c++" prototype="std::vector&lt;const dunedaq::confmodel::Application *&gt; get_all_applications() const" body=""/>
</method>
Expand Down
17 changes: 17 additions & 0 deletions src/dalMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "confmodel/DaqApplication.hpp"
#include "confmodel/DaqModule.hpp"
#include "confmodel/Jsonable.hpp"
#include "confmodel/OpMonURI.hpp"
#include "confmodel/PhysicalHost.hpp"
#include "confmodel/RCApplication.hpp"
#include "confmodel/Resource.hpp"
Expand Down Expand Up @@ -389,4 +390,20 @@ std::vector<const confmodel::DetectorStream*> DetectorToDaqConnection::get_strea

return streams;
}

std::string OpMonURI::get_URI( const std::string & app ) const {

auto type = get_type();
if ( type == "file" ) {
return type + "://" + get_path();
}

if ( type == "stream" ) {
return type + "://" + get_path();
}

return "stdout://";
}

}

Loading