Skip to content

artdaq system variables - #426

Open
corrodis wants to merge 12 commits into
developfrom
sc/ArtdaqSystemVariables
Open

artdaq system variables#426
corrodis wants to merge 12 commits into
developfrom
sc/ArtdaqSystemVariables

Conversation

@corrodis

Copy link
Copy Markdown
Contributor

Adding the concept of (artdaq) system variables. The idea is to use this for the trigger menu. Tagging @giro94 for awareness.

jicampos and others added 9 commits June 1, 2026 22:55
…og entry; allow for consolidated ECL logs at run-stop
Move the ArtdaqSystemVariables.dat load into
StringMacros::loadPersistentSystemVariables() and call it from
CorePropertySupervisorBase and ConfigurationManager::initPrereqsForARTDAQ
so ${OTS.artdaq.*} references (set e.g. via the Trigger Menu Editor)
resolve outside the ARTDAQ Supervisor as well. Guard the load with a
mutex: parallel table-init threads corrupted the heap inserting into the
static systemVariables_ map.
…iables

Resolve whitespace-only conflict in GatewaySupervisor.cc (config_dump
bugfix reached develop via PR #425 with different formatting).

@rrivera747 rrivera747 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - thanks!

Copilot AI review requested due to automatic review settings August 2, 2026 23:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces persisted artdaq system variables so ${OTS.artdaq.*} macro references can resolve consistently across processes (not just within the ARTDAQ Supervisor), and extends run bookkeeping/logging around STOP/HALT transitions (including consolidated end-of-run ECL entries). It also adds a CodeEditor endpoint to fetch FHICL files via $FHICL_FILE_PATH.

Changes:

  • Add persistence/load mechanism for StringMacros::systemVariables_["artdaq"] and refresh it during supervisor init + configure-time prereqs.
  • Extend Run Info transition recording (including new STOP_COMPLETE/HALT_COMPLETE transition types) and add consolidated end-of-run ECL logging.
  • Add getFhiclFileContent to read .fcl content via $FHICL_FILE_PATH.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
otsdaq/Macros/StringMacros.h Declares new helpers for persisted system variables.
otsdaq/Macros/StringMacros.cc Implements persisted artdaq sysvar file path + load routine (thread-serialized).
otsdaq/CoreSupervisors/CorePropertySupervisorBase.cc Loads persisted artdaq sysvars during supervisor construction so ${OTS.artdaq.*} resolves broadly.
otsdaq/ConfigurationInterface/ConfigurationManager.cc Refreshes persisted artdaq sysvars during configure-time prereqs for table/plugin resolution.
otsdaq/FiniteStateMachine/RunInfoVInterface.h Extends transition enum with STOP_COMPLETE/HALT_COMPLETE.
otsdaq/GatewaySupervisor/GatewaySupervisor.h Adds run-info transition helper and new cached fields for consolidated run logging.
otsdaq/GatewaySupervisor/GatewaySupervisor.cc Writes STOP early + STOP_COMPLETE later; adds consolidated end-of-run ECL entry support and SkipFooter SOAP param.
otsdaq/CodeEditor/CodeEditor.h Declares getFhiclFileContent.
otsdaq/CodeEditor/CodeEditor.cc Implements FHICL lookup/reading via $FHICL_FILE_PATH.
otsdaq/ARTDAQSupervisor/ARTDAQSupervisor.hh Adds request override + helpers for initializing/saving/loading artdaq sysvars.
otsdaq/ARTDAQSupervisor/ARTDAQSupervisor.cc Implements persistence-backed sysvar init/load/save and request handlers for get/set sysvars.

Comment on lines +39 to +42
std::string StringMacros::getPersistentSystemVariablesFilePath(void)
{
return std::string(__ENV__("USER_DATA")) + "/ServiceData/ArtdaqSystemVariables.dat";
} // end getPersistentSystemVariablesFilePath()
Comment on lines +62 to +70
auto& ns = systemVariables_["artdaq"];
std::string line;
while(std::getline(file, line))
{
size_t eqPos = line.find('=');
if(eqPos == std::string::npos)
continue;
ns[line.substr(0, eqPos)] = line.substr(eqPos + 1);
}
Comment on lines +6249 to +6253
// Write consolidated end-of-run summary to ECL if enabled via env var and user didn't opt out
bool doLogConsolidated = true; //default to logging consolidated run summary
try
{
ConfigurationTree configLinkNode =
CorePropertySupervisorBase::theConfigurationManager_
->getSupervisorTableNode(supervisorContextUID_,
supervisorApplicationUID_);
if(!configLinkNode.isDisconnected())
doLogConsolidated = __ENV__("OTS_LOG_CONSOLIDATED_RUN") == std::string("1");
Comment on lines +2174 to +2182
void ARTDAQSupervisor::loadArtdaqSystemVariables()
{
if(StringMacros::loadPersistentSystemVariables())
__SUP_COUT__ << "Loaded artdaq system variables from " << getServiceDataFilePath()
<< __E__;
else
__SUP_COUT__ << "No persisted artdaq system variables file found at "
<< getServiceDataFilePath() << __E__;
} // end loadArtdaqSystemVariables()
Comment on lines +2226 to +2242
std::string key = CgiDataUtilities::postData(cgiIn, "key");
std::string value = CgiDataUtilities::postData(cgiIn, "value");

if(key.empty())
{
xmlOut.addTextElementToData("Error", "Variable key must not be empty.");
return;
}
for(char c : key)
if(!std::isalnum(c) && c != '_')
{
xmlOut.addTextElementToData(
"Error",
"Variable key must contain only alphanumeric characters and "
"underscores.");
return;
}
Comment on lines +500 to +512
std::string relativePath = CgiDataUtilities::getData(cgiIn, "path");
relativePath = safePathString(StringMacros::decodeURIComponent(relativePath));
// leading slashes are not meaningful for a $FHICL_FILE_PATH-relative lookup
while(relativePath.size() && relativePath[0] == '/')
relativePath = relativePath.substr(1);
xmlOut->addTextElementToData("path", relativePath);

if(relativePath.find("..") != std::string::npos)
{
__SS__ << "Illegal '..' found in requested fcl path '" << relativePath << ".'"
<< __E__;
__SS_THROW__;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 Triage

Development

Successfully merging this pull request may close these issues.

6 participants