artdaq system variables - #426
Open
corrodis wants to merge 12 commits into
Open
Conversation
…og entry; allow for consolidated ECL logs at run-stop
…n/start iterations
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).
michaelmackenzie
approved these changes
Jul 20, 2026
rrivera747
approved these changes
Aug 2, 2026
rrivera747
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me - thanks!
Contributor
There was a problem hiding this comment.
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_COMPLETEtransition types) and add consolidated end-of-run ECL logging. - Add
getFhiclFileContentto read.fclcontent 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__; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding the concept of (artdaq) system variables. The idea is to use this for the trigger menu. Tagging @giro94 for awareness.