1 #include "otsdaq/TablePlugins/ARTDAQTableBase/ARTDAQTableBase.h"
8 #include "otsdaq/Macros/CoutMacros.h"
9 #define TRACE_NAME "ARTDAQTableBase"
11 #include <fhiclcpp/ParameterSet.h>
12 #include <fhiclcpp/detail/print_mode.h>
13 #include <fhiclcpp/intermediate_table.h>
14 #include <fhiclcpp/parse.h>
16 #include "otsdaq/ProgressBar/ProgressBar.h"
17 #include "otsdaq/TablePlugins/XDAQContextTable/XDAQContextTable.h"
22 #define __MF_SUBJECT__ "ARTDAQTableBase"
26 #define FCL_COMMENT_POSITION 65
30 #define OUTCF(X,C,F) { std::stringstream outSs; outSs << X; addCommentWhitespace(outSs, tabStr.size()*TABSZ + commentStr.size() + outSs.str().size()); outSs << (C) << (std::string(C).size()?" - ":"") << "from config-tree: " << parentPath << (std::string(F).size()?(std::string("/") + std::string(F)):std::string("")) << "\n"; OUT << outSs.str();}
32 #define OUTC(X,C) OUTCF(X,C,"")
34 #define OUTCLF(X,C,F) { std::stringstream outSs; outSs << X; addCommentWhitespace(outSs, tabStr.size()*TABSZ + commentStr.size() + outSs.str().size()); outSs << (C) << (std::string(C).size()?" - ":"") << "from config-tree: " << localParentPath << std::string(std::string(F).size()?("/" + std::string(F)):std::string("")) << "\n"; OUT << outSs.str();}
36 #define OUTCL(X,C) OUTCLF(X,C,"")
38 #define OUTCL2F(X,C,F) { std::stringstream outSs; outSs << X; addCommentWhitespace(outSs, tabStr.size()*TABSZ + commentStr.size() + outSs.str().size()); outSs << (C) << (std::string(C).size()?" - ":"") << "from config-tree: " << localParentPath2 << (std::string(F).size()?(std::string("/") + std::string(F)):std::string("")) << "\n"; OUT << outSs.str();}
40 #define OUTCL2(X,C) OUTCL2F(X,C,"")
45 const std::string ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH = std::string(__ENV__(
"SERVICE_DATA_PATH")) +
"/ConfigurationGUI_artdaqLayouts/";
46 const bool ARTDAQTableBase::ARTDAQ_DONOTWRITE_FCL = ((getenv(
"OTS_FCL_DONOTWRITE") == NULL) ?
false :
true);
48 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_CLASS =
"ots::ARTDAQSupervisor";
49 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_TABLE =
"ARTDAQSupervisorTable";
51 const std::string ARTDAQTableBase::ARTDAQ_READER_TABLE =
"ARTDAQBoardReaderTable";
52 const std::string ARTDAQTableBase::ARTDAQ_BUILDER_TABLE =
"ARTDAQEventBuilderTable";
53 const std::string ARTDAQTableBase::ARTDAQ_LOGGER_TABLE =
"ARTDAQDataLoggerTable";
54 const std::string ARTDAQTableBase::ARTDAQ_DISPATCHER_TABLE =
"ARTDAQDispatcherTable";
55 const std::string ARTDAQTableBase::ARTDAQ_MONITOR_TABLE =
"ARTDAQMonitorTable";
56 const std::string ARTDAQTableBase::ARTDAQ_ROUTER_TABLE =
"ARTDAQRoutingManagerTable";
58 const std::string ARTDAQTableBase::ARTDAQ_SUBSYSTEM_TABLE =
"ARTDAQSubsystemTable";
59 const std::string ARTDAQTableBase::ARTDAQ_DAQ_TABLE =
"ARTDAQDaqTable";
60 const std::string ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE =
"ARTDAQDaqParameterTable";
61 const std::string ARTDAQTableBase::ARTDAQ_ART_TABLE =
"ARTDAQArtTable";
63 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME =
"ExecutionHostname";
64 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS =
"AllowedProcessors";
65 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK =
"SubsystemLink";
66 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID =
"SubsystemLinkUID";
69 const int ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION = 0;
70 const std::string ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION_LABEL =
"nullDestinationSubsystem";
94 std::string* accumulatedExceptions )
95 :
TableBase(tableName, accumulatedExceptions)
107 std::cout <<
"ARTDAQTableBase Before traceTID=" << traceTID << __E__;
109 traceInit(trace_name(TRACE_NAME, __TRACE_FILE__, buf,
sizeof(buf)), 0);
110 std::cout <<
"ARTDAQTableBase After traceTID=" << traceTID << __E__;
111 __COUT__ <<
"ARTDAQTableBase TRACE reinit and Constructed." << __E__;
121 __SS__ <<
"Should not call void constructor, table type is lost!" << __E__;
126 ARTDAQTableBase::~ARTDAQTableBase(
void) {}
129 const std::string& ARTDAQTableBase::getTypeString(ARTDAQAppType type)
133 case ARTDAQAppType::EventBuilder:
135 case ARTDAQAppType::DataLogger:
137 case ARTDAQAppType::Dispatcher:
139 case ARTDAQAppType::BoardReader:
141 case ARTDAQAppType::Monitor:
143 case ARTDAQAppType::RoutingManager:
147 __SS__ <<
"Illegal translation attempt for type '" << (
unsigned int)type <<
"'"
153 std::string ARTDAQTableBase::getFHICLFilename(ARTDAQAppType type,
const std::string& name)
158 std::string uid = name;
159 for(
unsigned int i = 0; i < uid.size(); ++i)
160 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
161 (uid[i] >=
'0' && uid[i] <=
'9'))
172 std::string ARTDAQTableBase::getFlatFHICLFilename(ARTDAQAppType type,
173 const std::string& name)
178 std::string uid = name;
179 for(
unsigned int i = 0; i < uid.size(); ++i)
180 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
181 (uid[i] >=
'0' && uid[i] <=
'9'))
184 filename +=
"_flattened.fcl";
192 void ARTDAQTableBase::flattenFHICL(ARTDAQAppType type,
193 const std::string& name,
194 std::string* returnFcl )
196 std::chrono::steady_clock::time_point startClock = std::chrono::steady_clock::now();
197 __COUTS__(3) <<
"flattenFHICL()" << __ENV__(
"FHICL_FILE_PATH") << __E__;
200 std::string inFile = getFHICLFilename(type, name);
201 std::string outFile = getFlatFHICLFilename(type, name);
203 __COUTVS__(3, inFile);
204 __COUTVS__(3, outFile);
206 cet::filepath_lookup_nonabsolute policy(
"FHICL_FILE_PATH");
207 fhicl::ParameterSet pset;
211 __COUT_INFO__ <<
"parsing document: " << inFile;
214 pset = fhicl::ParameterSet::make(inFile, policy);
215 __COUTT__ <<
"document: " << inFile <<
" parsed";
216 __COUTT__ <<
"got pset from table:";
218 std::ofstream ofs{outFile};
221 __SS__ <<
"Failed to open fhicl output file '" << outFile <<
"!'" << __E__;
224 std::ostringstream out;
225 out << pset.to_indented_string(
229 *returnFcl = out.str();
230 __COUTVS__(21, returnFcl);
234 catch(cet::exception
const& e)
236 __SS__ <<
"Failed to parse fhicl into output file '" << outFile
237 <<
"' - here is the error: " << e.what() << __E__;
240 if(std::string(e.what()).find(
"TriggerEpilogs") != std::string::npos)
242 <<
"The Trigger Epilogs are located at "
243 "$USER_DATA/TriggerConfigurations/TriggerEpilogs. "
244 <<
"Please check that the Trigger Epilogs were properly generated, or "
245 "copy them from a previously working area."
251 <<
" Flatten Clock time = " << artdaq::TimeUtils::GetElapsedTime(startClock)
264 std::string& commentStr,
265 const std::string& parentPath,
267 const std::string& parameterPreamble,
268 bool onlyInsertAtTableParameters ,
269 bool includeAtTableParameters )
275 auto otherParameters = parameterGroupLink.
getChildren();
280 __COUTVS__(3, otherParameters.size());
281 __COUTVS__(3, onlyInsertAtTableParameters);
282 __COUTVS__(3, includeAtTableParameters);
284 size_t paramCount = 0;
285 for(
auto& parameter : otherParameters)
287 key = parameter.second.getNode(parameterPreamble +
"Key").getValue();
289 std::string localParentPath =
291 parameter.second.getTableName() +
":" +
293 parameterGroupLink.
getParentLinkID() +
"/" + parameter.second.getValue();
297 if(key.find(
"@table::") != std::string::npos)
300 if(onlyInsertAtTableParameters || includeAtTableParameters)
303 if(!parameter.second.status())
306 __COUTT__ <<
"Inserting parameter... " << localParentPath << __E__;
309 OUTCL(key << parameter.second.getNode(parameterPreamble +
"Value")
311 parameter.second.hasComment() ? parameter.second.getComment()
314 if(!parameter.second.status())
323 if(onlyInsertAtTableParameters)
327 if(!parameter.second.status())
330 __COUTT__ <<
"Inserting parameter... " << localParentPath << __E__;
333 if(key.find(
"#include") == std::string::npos)
336 << parameter.second.getNode(parameterPreamble +
"Value")
338 parameter.second.hasComment() ? parameter.second.getComment() :
"");
342 OUTCL(
"# comment for #include below:",
343 parameter.second.hasComment() ? parameter.second.getComment() :
"");
345 << parameter.second.getNode(parameterPreamble +
"Value").getValue()
349 if(!parameter.second.status())
355 __COUTS__(3) <<
"Empty parameter set found onlyInsertAtTableParameters="
356 << onlyInsertAtTableParameters << __E__;
357 std::string localParentPath =
360 if(onlyInsertAtTableParameters)
362 OUTCL(
"# no @table parameters found",
"" );
366 OUTCL(
"# empty parameter set found",
"" );
372 __COUTS__(3) <<
"No parameters found" << __E__;
373 std::string localParentPath =
375 OUTCL(
"# no parameters inserted",
"" );
385 std::string& commentStr,
386 const std::string& parentPath,
389 std::string value = moduleTypeNode.
getValue();
390 __COUTTV__(parentPath);
391 OUTCF((value.find(
"@table::") == std::string::npos ?
"module_type: " :
"") << value,
401 std::string& commentStr,
402 const std::string& parentPath,
405 auto metricsGroup = daqNode.
getNode(
"daqMetricsLink");
408 OUTCF(
"metrics: {",
"", metricsGroup.getParentLinkColumnName());
410 if(!metricsGroup.isDisconnected())
412 auto metrics = metricsGroup.getChildren();
413 bool sendSystemMetrics(
false), sendProcessMetrics(
false);
414 for(
auto& metric : metrics)
416 if(!metric.second.status())
419 __COUTT__ <<
"Inserting metric... " << parentPath << __E__;
420 std::string localParentPath =
421 parentPath +
"/" + metricsGroup.getParentLinkColumnName() +
":" +
422 metric.second.getTableName() +
":" + metricsGroup.getParentLinkIndex() +
423 ":" + metricsGroup.getParentLinkID() +
"/" + metric.second.getValue();
424 __COUTT__ <<
"Inserting metric... " << localParentPath << __E__;
426 OUTCL(metric.second.getNode(
"metricKey").getValue() <<
": {",
427 metric.second.hasComment() ? metric.second.getComment() :
"");
430 if(metric.second.getNode(
"sendSystemMetrics").getValue<
bool>())
432 sendSystemMetrics =
true;
434 if(metric.second.getNode(
"sendProcessMetrics").getValue<
bool>())
436 sendProcessMetrics =
true;
439 OUTCLF(
"metricPluginType: "
440 << metric.second.getNode(
"metricPluginType").getValue(),
444 "level_string: " << metric.second.getNode(
"metricLevelString").getValue(),
446 "metricLevelString");
448 auto metricParametersGroup = metric.second.getNode(
"metricParametersLink");
449 if(!metricParametersGroup.isDisconnected())
451 auto metricParameters = metricParametersGroup.getChildren();
452 for(
auto& metricParameter : metricParameters)
454 if(!metricParameter.second.status())
457 __COUTT__ <<
"Inserting metric... " << localParentPath << __E__;
458 std::string localParentPath2 =
459 localParentPath +
"/" +
460 metricParametersGroup.getParentLinkColumnName() +
":" +
461 metricParameter.second.getTableName() +
":" +
462 metricParametersGroup.getParentLinkIndex() +
":" +
463 metricParametersGroup.getParentLinkID() +
"/" +
464 metricParameter.second.getValue();
465 __COUTT__ <<
"Inserting metric... " << localParentPath2 << __E__;
466 OUTCL2(metricParameter.second.getNode(
"metricParameterKey").getValue()
468 << metricParameter.second.getNode(
"metricParameterValue")
470 metricParameter.second.hasComment()
471 ? metricParameter.second.getComment()
474 if(!metricParameter.second.status())
479 OUT <<
"} # end " << metric.second.getNode(
"metricKey").getValue()
482 if(!metric.second.status())
486 __COUTT__ <<
"Inserting metric send... " << parentPath << __E__;
487 std::string localParentPath =
488 parentPath +
"/" + metricsGroup.getParentLinkColumnName() +
":" +
489 metricsGroup.getTableName() +
":" + metricsGroup.getParentLinkIndex() +
":" +
490 metricsGroup.getParentLinkID();
491 if(sendSystemMetrics)
493 __COUTT__ <<
"Inserting send_system_metrics... " << localParentPath << __E__;
494 OUTCLF(
"send_system_metrics: true ",
495 "true, if any children are true",
496 "*/sendSystemMetrics");
499 OUTCLF(
"# send_system_metrics: false ",
500 "true, if any children are true",
501 "*/sendSystemMetrics");
503 if(sendProcessMetrics)
505 __COUTT__ <<
"Inserting send_process_metrics... " << localParentPath << __E__;
506 OUTCLF(
"send_process_metrics: true ",
507 "true, if any children are true",
508 "*/sendProcessMetrics");
511 OUTCLF(
"# send_process_metrics: false ",
512 "true, if any children are true",
513 "*/sendProcessMetrics");
517 __COUTS__(3) <<
"No metrics found" << __E__;
518 std::string localParentPath =
519 parentPath +
"/" + metricsGroup.getParentLinkColumnName();
520 OUTCL(
"# no metrics found",
"" );
524 OUT <<
"} # end metrics\n\n";
528 void ARTDAQTableBase::outputBoardReaderFHICL(
531 size_t routingTimeoutMs ,
532 size_t routingRetryCount )
534 if(ARTDAQ_DONOTWRITE_FCL)
536 __COUT__ <<
"Skipping fcl generation." << __E__;
665 std::string filename =
666 getFHICLFilename(ARTDAQAppType::BoardReader, boardReaderNode.
getValue());
672 std::string tabStr =
"";
673 std::string commentStr =
"";
676 out.open(filename, std::fstream::out | std::fstream::trunc);
679 __SS__ <<
"Failed to open ARTDAQ BoardReader fcl file: " << filename << __E__;
687 OUT <<
"###########################################################" << __E__;
689 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::BoardReader)
690 <<
" fcl configuration file produced by otsdaq." << __E__;
693 OUT <<
"# Original filename: \t" << filename << __E__;
694 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(ARTDAQAppType::BoardReader)
695 <<
" UID:\t" << boardReaderNode.
getValue() << __E__;
697 OUT <<
"###########################################################" << __E__;
711 catch(
const std::runtime_error&)
713 __COUTT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
718 std::string parentPath =
721 OUTC(
"# start of " << getTypeString(ARTDAQAppType::BoardReader) <<
" '"
722 << boardReaderNode.
getValue() <<
"' fcl",
727 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::BoardReader)
728 <<
" preamble parameters... " << parentPath << __E__;
734 boardReaderNode.
getNode(
"preambleParametersLink"),
741 __COUTT__ <<
"Generating daq block..." << __E__;
748 OUT <<
"fragment_receiver: {\n";
755 "daq generator plug-in type" ,
756 "daqGeneratorPluginType" );
757 OUTCF(
"fragment_type"
760 "generator data fragment type" ,
761 "daqGeneratorFragmentType" );
763 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::BoardReader)
764 <<
" DAQ Parameters... " << parentPath << __E__;
770 boardReaderNode.
getNode(
"daqParametersLink"),
775 auto fragmentId = boardReaderNode.
getNode(
"daqFragmentIDs");
776 std::string value = fragmentId.
getValue();
777 if(value.size() < 2 || value[0] !=
'[' || value[value.size() - 1] !=
']')
779 __SS__ <<
"Invalid 'daqFragmentIDs' - the value must be a valid fcl "
780 "array with starting and ending square brackets: [ ]"
784 __COUTS__(20) <<
"fragment_ids: " << fragmentId.getValue() << __E__;
785 OUTCF(
"fragment_ids: " << fragmentId.getValue(),
792 <<
"Ignoring missing fragment_id column associated with Board Reader."
795 OUTCF(
"# fragment_ids not specified, but could be",
"",
"daqFragmentIDs");
801 OUT <<
"destinations: { # empty placeholder, '"
802 << getTypeString(ARTDAQAppType::BoardReader)
803 <<
"' destinations handled by artdaq interface\n";
806 OUT <<
"routing_table_config: {\n";
809 auto readerSubsystemID = 1;
810 auto readerSubsystemLink = boardReaderNode.
getNode(
"SubsystemLink");
811 if(!readerSubsystemLink.isDisconnected())
813 readerSubsystemID = getSubsytemId(readerSubsystemLink);
815 if(info_.subsystems[readerSubsystemID].hasRoutingManager)
817 std::string localParentPath =
818 parentPath +
"/" + readerSubsystemLink.getParentLinkColumnName() +
":" +
819 readerSubsystemLink.getTableName() +
"/" + readerSubsystemLink.getValue();
820 __COUTT__ <<
"Inserting routing manager... " << localParentPath << __E__;
821 OUTCL(
"use_routing_manager: true",
822 "auto-generated because subsystem '" +
823 std::to_string(readerSubsystemID) +
"' has Routing Manager added");
825 OUTCLF(
"routing_manager_hostname: \""
826 << info_.subsystems[readerSubsystemID].routingManagerHost <<
"\"",
828 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME);
829 OUT <<
"table_update_port: 0\n";
830 OUT <<
"table_update_address: \"0.0.0.0\"\n";
831 OUT <<
"table_update_multicast_interface: \"0.0.0.0\"\n";
832 OUT <<
"table_acknowledge_port : 0\n";
833 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
834 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
838 OUTCF(
"use_routing_manager: false",
839 "auto-generated if subsystem '" + std::to_string(readerSubsystemID) +
840 "' has Routing Manager added",
841 readerSubsystemLink.getParentLinkColumnName());
848 OUT <<
"} # end fragment_receiver\n";
853 OUT <<
"} # end daq\n\n";
858 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::BoardReader)
859 <<
" add-on parameters... " << parentPath << __E__;
864 boardReaderNode.
getNode(
"addOnParametersLink"),
869 OUTC(
"# end of " << getTypeString(ARTDAQAppType::BoardReader) <<
" '"
870 << boardReaderNode.
getValue() <<
"' fcl",
872 __COUTT__ <<
"outputBoardReaderFHICL DONE" << __E__;
876 __SS__ <<
"\n\nError while generating FHiCL for "
877 << getTypeString(ARTDAQAppType::BoardReader) <<
" node at filename '"
878 << filename <<
"'" << __E__;
883 catch(
const std::runtime_error& e)
885 ss <<
" Here is the error: " << e.what() << __E__;
887 catch(
const std::exception& e)
889 ss <<
" Here is the error: " << e.what() << __E__;
905 ARTDAQAppType appType,
907 size_t routingTimeoutMs ,
908 size_t routingRetryCount ,
909 std::string* returnFcl )
911 if(ARTDAQ_DONOTWRITE_FCL)
913 __COUT__ <<
"Skipping fcl generation." << __E__;
917 std::string filename = getFHICLFilename(appType, receiverNode.
getValue());
922 std::ostringstream out;
924 std::string tabStr =
"";
925 std::string commentStr =
"";
928 outf.open(filename, std::fstream::out | std::fstream::trunc);
931 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
939 OUT <<
"###########################################################" << __E__;
941 OUT <<
"# artdaq " << getTypeString(appType)
942 <<
" fcl configuration file produced by otsdaq." << __E__;
943 OUT <<
"# Creation time: \t"
945 OUT <<
"# Original filename: \t" << filename << __E__;
946 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(appType) <<
" UID:\t"
947 << receiverNode.
getValue() << __E__;
949 OUT <<
"###########################################################" << __E__;
961 *returnFcl = out.str();
962 __COUTVS__(21, *returnFcl);
969 catch(
const std::runtime_error&)
971 __COUTT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
976 std::string parentPath =
979 OUTC(
"# start of " << getTypeString(appType) <<
" '" << receiverNode.
getValue()
985 __COUTT__ <<
"Inserting " << getTypeString(appType) <<
" preamble parameters... "
986 << parentPath << __E__;
992 receiverNode.
getNode(
"preambleParametersLink"),
999 __COUTT__ <<
"Generating daq block..." << __E__;
1001 auto daq = receiverNode.
getNode(
"daqLink");
1002 if(!daq.isDisconnected())
1005 OUTCF(
"daq: {",
"" , daq.getParentLinkColumnName());
1008 if(appType == ARTDAQAppType::EventBuilder)
1009 OUT <<
"event_builder: {\n";
1011 OUT <<
"aggregator: {\n";
1016 std::stringstream outSs;
1017 if(appType == ARTDAQAppType::DataLogger)
1018 outSs <<
"is_datalogger: true";
1019 else if(appType == ARTDAQAppType::Dispatcher)
1020 outSs <<
"is_dispatcher: true";
1021 if(outSs.str().size())
1023 addCommentWhitespace(
1025 tabStr.size() * TABSZ + commentStr.size() + outSs.str().size());
1026 outSs <<
"auto-generated based on app type '"
1027 << getTypeString(appType) <<
"'\n";
1034 std::string parentPath = daq.getParentTableName() +
"/" +
1035 daq.getParentRecordName() +
"/" +
1036 daq.getParentLinkColumnName() +
":" +
1037 daq.getTableName() +
"/" + daq.getValue();
1038 __COUTT__ <<
"Inserting " << getTypeString(appType) <<
" DAQ Parameters... "
1039 << parentPath << __E__;
1044 daq.getNode(
"daqParametersLink"),
1049 if(appType == ARTDAQAppType::EventBuilder)
1052 OUT <<
"routing_token_config: {\n";
1055 auto builderSubsystemID = 1;
1056 auto builderSubsystemLink = receiverNode.
getNode(
"SubsystemLink");
1057 if(!builderSubsystemLink.isDisconnected())
1059 builderSubsystemID = getSubsytemId(builderSubsystemLink);
1061 if(info_.subsystems[builderSubsystemID].hasRoutingManager)
1063 std::string localParentPath =
1065 builderSubsystemLink.getParentLinkColumnName() +
":" +
1066 builderSubsystemLink.getTableName() +
"/" +
1067 builderSubsystemLink.getValue();
1068 __COUTT__ <<
"Inserting routing manager... " << localParentPath
1070 OUTCL(
"use_routing_manager: true",
1071 "auto-generated because subsystem '" +
1072 std::to_string(builderSubsystemID) +
1073 "' has Routing Manager added");
1075 OUTCLF(
"routing_manager_hostname: \""
1076 << info_.subsystems[builderSubsystemID].routingManagerHost
1079 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME);
1080 OUT <<
"routing_token_port: 0\n";
1084 OUTCF(
"use_routing_manager: false",
1085 "auto-generated if subsystem '" +
1086 std::to_string(builderSubsystemID) +
1087 "' has Routing Manager added",
1088 builderSubsystemLink.getParentLinkColumnName());
1094 __COUTT__ <<
"Adding sources placeholder" << __E__;
1096 OUT <<
"sources: { # empty placeholder, '" << getTypeString(appType)
1097 <<
"' sources handled by artdaq interface\n";
1102 if(appType == ARTDAQAppType::EventBuilder)
1103 OUT <<
"} # end event_builder\n";
1105 OUT <<
"} # end aggregator\n";
1110 OUT <<
"} # end daq\n\n";
1114 __COUTS__(3) <<
"No daq found" << __E__;
1115 std::string localParentPath =
1116 parentPath +
"/" + daq.getParentLinkColumnName();
1117 OUTCL(
"# no daq found",
"" );
1122 __COUTT__ <<
"Filling art block..." << __E__;
1125 receiverNode.
getNode(ARTDAQTableBase::colARTDAQNotReader_.colLinkToArt_);
1126 if(!art.isDisconnected())
1128 std::string localParentPath = parentPath +
"/" +
1130 art.getTableName() +
"/" + art.getValue();
1131 OUTCF(
"art: {",
"" , art.getParentLinkColumnName());
1140 receiverNode.
getNode(
"SubsystemLink"),
1145 OUT <<
"} # end art\n\n";
1149 __COUTS__(3) <<
"No art found" << __E__;
1150 std::string localParentPath =
1151 parentPath +
"/" + art.getParentLinkColumnName();
1152 OUTCL(
"# no art found",
"" );
1157 __COUTT__ <<
"Inserting " << getTypeString(appType) <<
" add-on parameters... "
1158 << parentPath << __E__;
1163 receiverNode.
getNode(
"addOnParametersLink"),
1169 OUTC(
"# end of " << getTypeString(appType) <<
" '" << receiverNode.
getValue()
1172 __COUTT__ <<
"outputDataReceiverFHICL DONE" << __E__;
1176 __SS__ <<
"\n\nError while generating FHiCL for " << getTypeString(appType)
1177 <<
" node at filename '" << filename <<
"'" << __E__;
1182 catch(
const std::runtime_error& e)
1184 ss <<
" Here is the error: " << e.what() << __E__;
1186 catch(
const std::exception& e)
1188 ss <<
" Here is the error: " << e.what() << __E__;
1193 *returnFcl = out.str();
1194 __COUTVS__(21, *returnFcl);
1203 *returnFcl = out.str();
1204 __COUTVS__(21, *returnFcl);
1215 if(ARTDAQ_DONOTWRITE_FCL)
1217 __COUT__ <<
"Skipping fcl generation." << __E__;
1221 std::string filename =
1222 getFHICLFilename(ARTDAQAppType::Monitor, monitorNode.
getValue());
1228 std::string tabStr =
"";
1229 std::string commentStr =
"";
1231 __COUTV__(filename);
1232 out.open(filename, std::fstream::out | std::fstream::trunc);
1235 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
1243 OUT <<
"###########################################################" << __E__;
1244 OUT <<
"#" << __E__;
1245 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::Monitor)
1246 <<
" fcl configuration file produced by otsdaq." << __E__;
1247 OUT <<
"# Creation time: \t"
1249 OUT <<
"# Original filename: \t" << filename << __E__;
1250 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(ARTDAQAppType::Monitor) <<
" UID:\t"
1251 << monitorNode.
getValue() << __E__;
1252 OUT <<
"#" << __E__;
1253 OUT <<
"###########################################################" << __E__;
1267 catch(
const std::runtime_error&)
1269 __COUTT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
1276 std::string parentPath =
1280 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::Monitor)
1281 <<
" preamble parameters... " << parentPath << __E__;
1286 monitorNode.
getNode(
"preambleParametersLink"),
1295 monitorNode.
getNode(ARTDAQTableBase::colARTDAQNotReader_.colLinkToArt_);
1296 if(!art.isDisconnected())
1299 OUT <<
"services.message: { "
1300 << artdaq::generateMessageFacilityConfiguration(
1301 mf::GetApplicationName().c_str(),
true,
false)
1303 OUT <<
"services.message.destinations.file: {type: \"GenFile\" threshold: "
1304 "\"INFO\" seperator: \"-\""
1305 <<
" pattern: \"" << monitorNode.
getValue() <<
"-%?H%t-%p.log"
1307 <<
" timestamp_pattern: \"%Y%m%d%H%M%S\""
1308 <<
" directory: \"" << __ENV__(
"OTSDAQ_LOG_ROOT") <<
"/"
1310 <<
" append : false }\n";
1313 auto dispatcherLink = monitorNode.
getNode(
"dispatcherLink");
1314 if(!dispatcherLink.isDisconnected())
1316 std::string monitorHost =
1317 monitorNode.
getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1319 std::string dispatcherHost =
1320 dispatcherLink.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1321 .getValueWithDefault(
"localhost");
1322 OUT <<
"source.dispatcherHost: \"" << dispatcherHost <<
"\"\n";
1323 int dispatcherPort = dispatcherLink.getNode(
"DispatcherPort").getValue<
int>();
1324 OUT <<
"source.dispatcherPort: " << dispatcherPort <<
"\n";
1325 OUT <<
"source.commanderPluginType: xmlrpc\n";
1328 int disp_fake_rank =
1329 dispatcherLink.getNode(
"DispatcherID").getValueWithDefault<
int>(200);
1331 size_t max_fragment_size = monitorNode.
getNode(
"max_fragment_size_words")
1333 std::string transfer_plugin_type = monitorNode.
getNode(
"transfer_plugin_type")
1336 OUT <<
"TransferPluginConfig: {\n";
1338 OUT <<
"transferPluginType: " << transfer_plugin_type <<
"\n";
1339 OUT <<
"host_map: [{ rank: " << disp_fake_rank <<
" host: \""
1340 << dispatcherHost <<
"\"}, { rank: " << om_rank <<
" host: \""
1341 << monitorHost <<
"\"}]\n";
1342 OUT <<
"max_fragment_size_words: " << max_fragment_size <<
"\n";
1343 OUT <<
"source_rank: " << disp_fake_rank <<
"\n";
1344 OUT <<
"destination_rank: " << om_rank <<
"\n";
1345 OUT <<
"unique_label: " << monitorNode.
getValue() <<
"_to_"
1346 << dispatcherLink.getValue() <<
"\n";
1349 OUT <<
"source.transfer_plugin: @local::TransferPluginConfig \n";
1350 auto dispatcherArt = monitorNode.
getNode(
"dispatcherArtLink");
1351 if(!dispatcherArt.isDisconnected())
1353 OUT <<
"source.dispatcher_config: {\n";
1359 OUT <<
"filter_paths: [\n";
1363 auto filterPathsLink = monitorNode.
getNode(
"filterPathsLink");
1364 if(!filterPathsLink.isDisconnected())
1371 for(
auto& filterPath : filterPaths)
1377 if(!filterPath.second.status())
1380 OUT <<
"name: " << filterPath.second.getNode(
"Name").getValue()
1382 OUT <<
"path: " << filterPath.second.getNode(
"Path").getValue()
1386 if(!filterPath.second.status())
1395 OUT <<
"unique_label: " << monitorNode.
getValue() <<
"\n";
1409 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::Monitor)
1410 <<
" add-on parameters... " << parentPath << __E__;
1415 monitorNode.
getNode(
"addOnParametersLink"),
1420 __COUTT__ <<
"outputOnlineMonitorFHICL DONE" << __E__;
1424 __SS__ <<
"\n\nError while generating FHiCL for "
1425 << getTypeString(ARTDAQAppType::Monitor) <<
" node at filename '"
1426 << filename <<
"'" << __E__;
1431 catch(
const std::runtime_error& e)
1433 ss <<
" Here is the error: " << e.what() << __E__;
1435 catch(
const std::exception& e)
1437 ss <<
" Here is the error: " << e.what() << __E__;
1451 std::string& tabStr,
1452 std::string& commentStr,
1453 const std::string& parentPath,
1456 size_t routingTimeoutMs,
1457 size_t routingRetryCount)
1461 __COUTT__ <<
"Filling art.services parentPath =" << parentPath << __E__;
1462 auto services = art.
getNode(
"servicesLink");
1463 if(!services.isDisconnected())
1465 std::string localParentPath =
1467 services.getTableName() +
"/" +
1468 services.getValue();
1469 __COUTT__ <<
"Inserting services... " << localParentPath << __E__;
1470 OUTCL(
"services: {", services.hasComment() ? services.getComment() :
"");
1475 __COUTT__ <<
"Inserting services parameters... " << localParentPath << __E__;
1480 services.getNode(
"ServicesParametersLink"),
1486 OUT <<
"ArtdaqSharedMemoryServiceInterface: {\n";
1488 OUT <<
"service_provider: "
1489 "ArtdaqSharedMemoryService \n";
1491 OUTCLF(
"waiting_time: " << services.getNode(
"sharedMemoryWaitingTime").getValue(),
1493 "sharedMemoryWaitingTime");
1494 OUTCLF(
"resume_after_timeout: "
1495 << (services.getNode(
"sharedMemoryResumeAfterTimeout").getValue<
bool>()
1499 "sharedMemoryResumeAfterTimeout");
1501 OUT <<
"} # end ArtdaqSharedMemoryServiceInterface\n\n";
1503 OUT <<
"ArtdaqFragmentNamingServiceInterface: {\n";
1505 OUT <<
"service_provider: "
1506 "ArtdaqFragmentNamingService \n";
1507 OUTCLF(
"helper_plugin: "
1508 << services.getNode(
"fragmentNamingServiceProvider").getValue(),
1510 "fragmentNamingServiceProvider");
1512 OUT <<
"} # end ArtdaqFragmentNamingServiceInterface\n\n";
1516 __COUTT__ <<
"Inserting services parameters... " << localParentPath << __E__;
1521 services.getNode(
"ServicesParametersLink"),
1527 OUT <<
"} # end services\n\n";
1531 __COUTS__(3) <<
"No services found" << __E__;
1532 std::string localParentPath =
1533 parentPath +
"/" + services.getParentLinkColumnName();
1534 OUTCL(
"# no services found",
"" );
1539 __COUTT__ <<
"Filling art.outputs parentPath =" << parentPath << __E__;
1540 auto outputs = art.
getNode(
"outputsLink");
1541 if(!outputs.isDisconnected())
1543 std::string localParentPath =
1546 __COUTT__ <<
"Inserting output... " << localParentPath << __E__;
1547 OUTCL(
"outputs: {",
"" );
1550 auto outputPlugins = outputs.getChildren();
1551 for(
auto& outputPlugin : outputPlugins)
1553 if(!outputPlugin.second.status())
1556 __COUTT__ <<
"Inserting output parameters... " << localParentPath << __E__;
1557 std::string localParentPath2 =
1558 localParentPath +
":" + outputPlugin.second.getTableName() +
":" +
1559 outputs.getParentLinkIndex() +
":" + outputs.getParentLinkID() +
"/" +
1560 outputPlugin.second.getValue();
1561 __COUTT__ <<
"Inserting output... " << localParentPath2 << __E__;
1563 outputPlugin.second.getNode(
"outputKey").getValue() <<
": {",
1564 outputPlugin.second.hasComment() ? outputPlugin.second.getComment() :
"",
1568 __COUTT__ <<
"insertModuleType... " << localParentPath2 << __E__;
1569 std::string moduleType =
1574 outputPlugin.second.getNode(
"outputModuleType"));
1578 __COUTT__ <<
"Inserting output parameters... " << localParentPath << __E__;
1583 outputPlugin.second.getNode(
"outputModuleParameterLink"),
1588 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1589 "BinaryNetOutput" ||
1590 outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1593 OUT <<
"destinations: { # empty placeholder, '"
1594 << outputPlugin.second.getNode(
"outputModuleType").getValue()
1595 <<
"' destinations handled by artdaq interface\n";
1598 OUT <<
"routing_table_config: {\n";
1601 auto mySubsystemID = 1;
1602 auto destinationSubsystemID = 1;
1605 mySubsystemID = getSubsytemId(subsystemLink);
1607 destinationSubsystemID = info_.subsystems[mySubsystemID].destination;
1608 if(info_.subsystems[destinationSubsystemID].hasRoutingManager)
1610 std::string localParentPath =
1613 __COUTT__ <<
"Inserting routing manager... " << localParentPath
1615 OUTCL(
"use_routing_manager: true",
1616 "auto-generated because subsystem '" +
1617 std::to_string(destinationSubsystemID) +
1618 "' has Routing Manager added");
1621 "routing_manager_hostname: \""
1622 << info_.subsystems[destinationSubsystemID].routingManagerHost
1625 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME);
1626 OUT <<
"table_update_port: 0\n";
1627 OUT <<
"table_update_address: \"0.0.0.0\"\n";
1628 OUT <<
"table_update_multicast_interface: \"0.0.0.0\"\n";
1629 OUT <<
"table_acknowledge_port : 0\n";
1630 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
1631 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
1635 OUTCF(
"use_routing_manager: false",
1636 "auto-generated if subsystem '" +
1637 std::to_string(destinationSubsystemID) +
1638 "' has Routing Manager added",
1642 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1645 info_.subsystems[mySubsystemID].eventMode =
true;
1651 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1653 outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1654 "TransferOutputReliable")
1656 OUT <<
"transfer_plugin: @local::TransferPluginConfig \n";
1660 OUT <<
"} # end " << outputPlugin.second.getNode(
"outputKey").getValue()
1663 if(!outputPlugin.second.status())
1668 OUT <<
"} # end outputs\n\n";
1672 __COUTS__(3) <<
"No outputs found" << __E__;
1673 std::string localParentPath =
1674 parentPath +
"/" + outputs.getParentLinkColumnName();
1675 OUTCL(
"# no outputs found",
"" );
1680 __COUTT__ <<
"Filling art.physics parentPath =" << parentPath << __E__;
1681 auto physics = art.
getNode(
"physicsLink");
1682 if(!physics.isDisconnected())
1684 __COUTT__ <<
"Inserting physics... " << parentPath << __E__;
1685 std::string localParentPath = parentPath +
"/" +
1686 physics.getParentLinkColumnName() +
":" +
1687 physics.getTableName() +
"/" +
1691 OUTCL(
"physics: {", physics.hasComment() ? services.getComment() :
"");
1697 __COUTT__ <<
"Inserting physics other parameters... " << localParentPath << __E__;
1702 physics.getNode(
"physicsOtherParametersLink"),
1703 "physicsParameter" ,
1707 auto analyzers = physics.getNode(
"analyzersLink");
1708 if(!analyzers.isDisconnected())
1710 __COUTT__ <<
"Inserting art.physics.analyzers... " << localParentPath
1712 std::string localParentPath2 =
1713 localParentPath +
"/" + analyzers.getParentLinkColumnName();
1714 __COUTT__ <<
"Inserting art.physics.analyzers... " << localParentPath2
1719 OUTCL2(
"analyzers: {",
"" );
1723 auto modules = analyzers.getChildren();
1724 for(
auto& module : modules)
1726 if(!module.second.status())
1733 auto analyzerNodeParameterLink =
1734 module.second.getNode(
"analyzerModuleParameterLink");
1737 __COUTT__ <<
"Inserting analyzer @table parameters... "
1738 << localParentPath2 << __E__;
1739 std::string localParentPath3 =
1740 localParentPath2 +
":" + module.second.getTableName() +
":" +
1741 analyzers.getParentLinkIndex() +
":" + analyzers.getParentLinkID() +
1742 "/" + module.second.getValue();
1743 __COUTT__ <<
"Inserting analyzer @table parameters... "
1744 << localParentPath3 << __E__;
1749 analyzerNodeParameterLink,
1750 "analyzerParameter" ,
1754 OUT << module.second.getNode(
"analyzerKey").getValue() <<
": {\n";
1760 module.second.getNode(
"analyzerModuleType"));
1764 __COUTT__ <<
"Inserting analayzer not @table parameters... "
1765 << localParentPath3 << __E__;
1770 analyzerNodeParameterLink,
1771 "analyzerParameter" ,
1778 if(!module.second.status())
1782 OUT <<
"} # end physics.analyzers\n\n";
1786 __COUTS__(3) <<
"No analyzers found" << __E__;
1787 std::string localParentPath2 =
1788 localParentPath +
"/" + analyzers.getParentLinkColumnName();
1789 OUTCL2(
"# no analyzers found",
"" );
1792 auto producers = physics.getNode(
"producersLink");
1793 if(!producers.isDisconnected())
1795 __COUTT__ <<
"Inserting art.physics.producers... " << localParentPath
1797 std::string localParentPath2 =
1798 localParentPath +
"/" + producers.getParentLinkColumnName();
1802 OUTCL2(
"producers: {",
"" );
1806 auto modules = producers.getChildren();
1807 for(
auto& module : modules)
1809 if(!module.second.status())
1816 auto producerNodeParameterLink =
1817 module.second.getNode(
"producerModuleParameterLink");
1820 __COUTT__ <<
"Inserting producer @table parameters... "
1821 << localParentPath2 << __E__;
1822 std::string localParentPath3 =
1823 localParentPath2 +
":" + module.second.getTableName() +
":" +
1824 producers.getParentLinkIndex() +
":" + producers.getParentLinkID() +
1825 "/" + module.second.getValue();
1826 __COUTT__ <<
"Inserting producer @table parameters... "
1827 << localParentPath3 << __E__;
1832 producerNodeParameterLink,
1833 "producerParameter" ,
1837 if(module.second.status() &&
1838 module.second.getNode(
"producerModuleType").getValue() ==
"")
1840 std::string tmp = localParentPath2;
1841 localParentPath2 = localParentPath3;
1842 OUTCL2F(
"# skipping '" << module.second.getValue()
1843 <<
"' with empty module type",
1845 "producerModuleType");
1846 localParentPath2 = tmp;
1850 OUT << module.second.getNode(
"producerKey").getValue() <<
": {\n";
1857 module.second.getNode(
"producerModuleType"));
1861 __COUTT__ <<
"Inserting producer not @table parameters... "
1862 << localParentPath3 << __E__;
1867 producerNodeParameterLink,
1868 "producerParameter" ,
1875 if(!module.second.status())
1879 OUT <<
"} # end physics.producers\n\n";
1883 __COUTS__(3) <<
"No producers found" << __E__;
1884 std::string localParentPath2 =
1885 localParentPath +
"/" + producers.getParentLinkColumnName();
1886 OUTCL2(
"# no producers found",
"" );
1889 auto filters = physics.getNode(
"filtersLink");
1890 if(!filters.isDisconnected())
1892 __COUTT__ <<
"Inserting art.physics.filters... " << localParentPath << __E__;
1893 std::string localParentPath2 =
1894 localParentPath +
"/" + filters.getParentLinkColumnName();
1898 OUTCL2(
"filters: {",
"" );
1902 auto modules = filters.getChildren();
1903 for(
auto& module : modules)
1905 if(!module.second.status())
1912 auto filterNodeParameterLink =
1913 module.second.getNode(
"filterModuleParameterLink");
1916 __COUTT__ <<
"Inserting filter @table parameters... " << localParentPath2
1918 std::string localParentPath3 =
1919 localParentPath2 +
":" + module.second.getTableName() +
":" +
1920 filters.getParentLinkIndex() +
":" + filters.getParentLinkID() +
"/" +
1921 module.second.getValue();
1922 __COUTT__ <<
"Inserting filter @table parameters... " << localParentPath3
1928 filterNodeParameterLink,
1932 if(module.second.status() &&
1933 module.second.getNode(
"filterModuleType").getValue() ==
"")
1935 std::string tmp = localParentPath2;
1936 localParentPath2 = localParentPath3;
1937 OUTCL2F(
"# skipping '" << module.second.getValue()
1938 <<
"' with empty module type",
1940 "filterModuleType");
1941 localParentPath2 = tmp;
1945 OUT << module.second.getNode(
"filterKey").getValue() <<
": {\n";
1952 module.second.getNode(
"filterModuleType"));
1956 __COUTT__ <<
"Inserting filter not @table parameters... "
1957 << localParentPath3 << __E__;
1962 filterNodeParameterLink,
1970 if(!module.second.status())
1974 OUT <<
"} # end physics.filters\n\n";
1978 __COUTS__(3) <<
"No filters found" << __E__;
1979 std::string localParentPath2 =
1980 localParentPath +
"/" + services.getParentLinkColumnName();
1981 OUTCL2(
"# no filters found",
"" );
1986 __COUTT__ <<
"Inserting art.physics not @table parameters... " << localParentPath
1992 physics.getNode(
"physicsOtherParametersLink"),
1993 "physicsParameter" ,
1998 OUT <<
"} # end physics\n\n";
2002 __COUTS__(3) <<
"No physics found" << __E__;
2003 std::string localParentPath =
2004 parentPath +
"/" + physics.getParentLinkColumnName();
2005 OUTCL(
"# no physics found",
"" );
2010 __COUTT__ <<
"Filling art.source" << __E__;
2011 auto source = art.
getNode(
"sourceLink");
2012 if(!source.isDisconnected())
2014 __COUTT__ <<
"Inserting source... " << parentPath << __E__;
2015 std::string localParentPath = parentPath +
"/" +
2016 source.getParentLinkColumnName() +
":" +
2017 source.getTableName() +
"/" +
2019 OUTCL(
"source: {", source.hasComment() ? source.getComment() :
"");
2022 out, tabStr, commentStr, parentPath, source.getNode(
"sourceModuleType"));
2028 std::string localParentPath = parentPath +
"/" + source.getParentLinkColumnName();
2029 OUTCL(
"source: { # auto-generated default, to change provide a source link",
2032 OUT <<
"module_type: ArtdaqInput";
2039 __COUTT__ <<
"Writing art.process_name" << __E__;
2040 OUTCF(
"process_name: " << art.
getNode(ARTDAQTableBase::colARTDAQArt_.colProcessName_),
2042 ARTDAQTableBase::colARTDAQArt_.colProcessName_);
2046 __COUTT__ <<
"Inserting art @table parameters... " << parentPath << __E__;
2051 art.
getNode(
"AddOnParametersLink"),
2059 void ARTDAQTableBase::outputRoutingManagerFHICL(
2061 size_t routingTimeoutMs ,
2062 size_t routingRetryCount )
2064 if(ARTDAQ_DONOTWRITE_FCL)
2066 __COUT__ <<
"Skipping fcl generation." << __E__;
2070 std::string filename =
2071 getFHICLFilename(ARTDAQAppType::RoutingManager, routingManagerNode.
getValue());
2077 std::string tabStr =
"";
2078 std::string commentStr =
"";
2080 __COUTV__(filename);
2081 out.open(filename, std::fstream::out | std::fstream::trunc);
2084 __SS__ <<
"Failed to open ARTDAQ RoutingManager fcl file: " << filename << __E__;
2092 OUT <<
"###########################################################" << __E__;
2093 OUT <<
"#" << __E__;
2094 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::RoutingManager)
2095 <<
" fcl configuration file produced by otsdaq." << __E__;
2096 OUT <<
"# Creation time: \t"
2098 OUT <<
"# Original filename: \t" << filename << __E__;
2099 OUT <<
"# otsdaq-ARTDAQ RoutingManager UID:\t" << routingManagerNode.
getValue()
2101 OUT <<
"#" << __E__;
2102 OUT <<
"###########################################################" << __E__;
2116 catch(
const std::runtime_error&)
2128 OUT <<
"policy: {\n";
2132 if(policyName ==
"DEFAULT")
2133 policyName =
"NoOp";
2134 OUT <<
"policy: " << policyName <<
"\n";
2135 OUT <<
"receiver_ranks: []\n";
2138 auto parametersLink = routingManagerNode.
getNode(
"routingPolicyParametersLink");
2139 if(!parametersLink.isDisconnected())
2142 for(
auto& parameter : parameters)
2144 if(!parameter.second.status())
2155 parameter.second.getNode(TableViewColumnInfo::COL_NAME_COMMENT);
2156 OUT << parameter.second.getNode(
"daqParameterKey").getValue() <<
": "
2157 << parameter.second.getNode(
"daqParameterValue").getValue()
2158 << (comment.isDefaultValue() ?
"" : (
"\t # " + comment.getValue()))
2161 if(!parameter.second.status())
2169 OUT <<
"use_routing_manager: true\n";
2171 auto routingManagerSubsystemID = 1;
2172 auto routingManagerSubsystemLink = routingManagerNode.
getNode(
"SubsystemLink");
2173 std::string rmHost =
"localhost";
2174 if(!routingManagerSubsystemLink.isDisconnected())
2176 routingManagerSubsystemID = getSubsytemId(routingManagerSubsystemLink);
2177 rmHost = info_.subsystems[routingManagerSubsystemID].routingManagerHost;
2179 if(rmHost ==
"localhost" || rmHost ==
"127.0.0.1")
2181 char hostbuf[HOST_NAME_MAX + 1];
2182 gethostname(hostbuf, HOST_NAME_MAX);
2183 rmHost = std::string(hostbuf);
2187 OUT <<
"routing_manager_hostname: \"" << rmHost <<
"\"\n";
2188 OUT <<
"sender_ranks: []\n";
2189 OUT <<
"table_update_port: 0\n";
2190 OUT <<
"table_update_address: \"0.0.0.0\"\n";
2191 OUT <<
"table_acknowledge_port: 0\n";
2192 OUT <<
"token_receiver: {\n";
2195 OUT <<
"routing_token_port: 0\n";
2201 auto tableUpdateIntervalMs =
2203 if(tableUpdateIntervalMs !=
"DEFAULT")
2205 OUT <<
"table_update_interval_ms: " << tableUpdateIntervalMs <<
"\n";
2207 auto tableAckRetryCount =
2209 if(tableAckRetryCount !=
"DEFAULT")
2211 OUT <<
"table_ack_retry_count: " << tableAckRetryCount <<
"\n";
2214 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
2215 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
2226 __COUTT__ <<
"outputReaderFHICL DONE" << __E__;
2230 __SS__ <<
"\n\nError while generating FHiCL for "
2231 << getTypeString(ARTDAQAppType::RoutingManager) <<
" node at filename '"
2232 << filename <<
"'" << __E__;
2237 catch(
const std::runtime_error& e)
2239 ss <<
" Here is the error: " << e.what() << __E__;
2241 catch(
const std::exception& e)
2243 ss <<
" Here is the error: " << e.what() << __E__;
2255 bool getStatusFalseNodes ,
2257 size_t maxFragmentSizeBytes ,
2258 size_t routingTimeoutMs ,
2259 size_t routingRetryCount ,
2263 progressBar->
step();
2266 info_.subsystems.clear();
2267 info_.processes.clear();
2270 progressBar->
step();
2272 info_.subsystems[NULL_SUBSYSTEM_DESTINATION].id = NULL_SUBSYSTEM_DESTINATION;
2273 info_.subsystems[NULL_SUBSYSTEM_DESTINATION].label = NULL_SUBSYSTEM_DESTINATION_LABEL;
2278 __COUT__ <<
"artdaqSupervisorNode is disconnected." << __E__;
2283 extractRoutingManagersInfo(artdaqSupervisorNode,
2284 getStatusFalseNodes,
2288 __COUT__ <<
"artdaqSupervisorNode RoutingManager size: "
2289 << info_.processes.at(ARTDAQAppType::RoutingManager).size() << __E__;
2292 progressBar->
step();
2294 extractBoardReadersInfo(artdaqSupervisorNode,
2295 getStatusFalseNodes,
2297 maxFragmentSizeBytes,
2300 __COUT__ <<
"artdaqSupervisorNode BoardReader size: "
2301 << info_.processes.at(ARTDAQAppType::BoardReader).size() << __E__;
2304 progressBar->
step();
2306 extractEventBuildersInfo(
2307 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
2308 __COUT__ <<
"artdaqSupervisorNode EventBuilder size: "
2309 << info_.processes.at(ARTDAQAppType::EventBuilder).size() << __E__;
2312 progressBar->
step();
2314 extractDataLoggersInfo(
2315 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
2316 __COUT__ <<
"artdaqSupervisorNode DataLogger size: "
2317 << info_.processes.at(ARTDAQAppType::DataLogger).size() << __E__;
2320 progressBar->
step();
2322 extractDispatchersInfo(
2323 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
2324 __COUT__ <<
"artdaqSupervisorNode Dispatcher size: "
2325 << info_.processes.at(ARTDAQAppType::Dispatcher).size() << __E__;
2328 progressBar->
step();
2334 void ARTDAQTableBase::extractRoutingManagersInfo(
ConfigurationTree artdaqSupervisorNode,
2335 bool getStatusFalseNodes,
2337 size_t routingTimeoutMs,
2338 size_t routingRetryCount)
2340 __COUT__ <<
"Checking for Routing Managers..." << __E__;
2341 info_.processes[ARTDAQAppType::RoutingManager].clear();
2344 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToRoutingManagers_);
2347 std::vector<std::pair<std::string, ConfigurationTree>> routingManagers =
2350 __COUT__ <<
"There are " << routingManagers.size()
2351 <<
" configured Routing Managers" << __E__;
2353 for(
auto& routingManager : routingManagers)
2355 const std::string& rmUID = routingManager.first;
2357 if(getStatusFalseNodes || routingManager.second.status())
2359 std::string rmHost =
2360 routingManager.second
2361 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2362 .getValueWithDefault(
"localhost");
2363 if(rmHost ==
"localhost" || rmHost ==
"127.0.0.1")
2365 char hostbuf[HOST_NAME_MAX + 1];
2366 gethostname(hostbuf, HOST_NAME_MAX);
2367 rmHost = std::string(hostbuf);
2371 routingManager.second
2372 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2373 .getValueWithDefault(
"");
2375 int routingManagerSubsystemID = 1;
2377 routingManager.second.
getNode(
2378 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2381 routingManagerSubsystemID =
2382 getSubsytemId(routingManagerSubsystemLink);
2385 info_.subsystems[routingManagerSubsystemID].id =
2386 routingManagerSubsystemID;
2388 const std::string& routingManagerSubsystemName =
2392 info_.subsystems[routingManagerSubsystemID].label =
2393 routingManagerSubsystemName;
2395 if(info_.subsystems[routingManagerSubsystemID].hasRoutingManager)
2397 __SS__ <<
"Error: You cannot have multiple Routing Managers in a "
2403 auto routingManagerSubsystemDestinationLink =
2404 routingManagerSubsystemLink.
getNode(
2405 colARTDAQSubsystem_.colLinkToDestination_);
2406 if(routingManagerSubsystemDestinationLink.isDisconnected())
2409 info_.subsystems[routingManagerSubsystemID].destination = 0;
2414 info_.subsystems[routingManagerSubsystemID].destination =
2415 getSubsytemId(routingManagerSubsystemDestinationLink);
2421 if(!info_.subsystems.count(
2422 info_.subsystems[routingManagerSubsystemID].destination) ||
2424 .subsystems[info_.subsystems[routingManagerSubsystemID]
2426 .sources.count(routingManagerSubsystemID))
2429 .subsystems[info_.subsystems[routingManagerSubsystemID]
2431 .sources.insert(routingManagerSubsystemID);
2436 __COUT__ <<
"Found Routing Manager with UID " << rmUID
2437 <<
", DAQInterface Hostname " << rmHost <<
", and Subsystem "
2438 << routingManagerSubsystemID << __E__;
2439 info_.processes[ARTDAQAppType::RoutingManager].emplace_back(
2443 routingManagerSubsystemID,
2444 ARTDAQAppType::RoutingManager,
2445 routingManager.second.status());
2447 info_.subsystems[routingManagerSubsystemID].hasRoutingManager =
true;
2448 info_.subsystems[routingManagerSubsystemID].routingManagerHost = rmHost;
2452 outputRoutingManagerFHICL(
2453 routingManager.second, routingTimeoutMs, routingRetryCount);
2455 flattenFHICL(ARTDAQAppType::RoutingManager,
2456 routingManager.second.getValue());
2461 __COUT__ <<
"Routing Manager " << rmUID <<
" is disabled." << __E__;
2468 void ARTDAQTableBase::extractBoardReadersInfo(
ConfigurationTree artdaqSupervisorNode,
2469 bool getStatusFalseNodes,
2471 size_t maxFragmentSizeBytes,
2472 size_t routingTimeoutMs,
2473 size_t routingRetryCount)
2475 __COUT__ <<
"Checking for Board Readers..." << __E__;
2476 info_.processes[ARTDAQAppType::BoardReader].clear();
2479 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToBoardReaders_);
2482 std::vector<std::pair<std::string, ConfigurationTree>> readers =
2484 __COUT__ <<
"There are " << readers.size() <<
" configured Board Readers."
2487 for(
auto& reader : readers)
2489 const std::string& readerUID = reader.first;
2491 if(getStatusFalseNodes || reader.second.status())
2493 std::string readerHost =
2494 reader.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2495 .getValueWithDefault(
"localhost");
2496 std::string readerAP =
2498 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2499 .getValueWithDefault(
"");
2501 int readerSubsystemID = 1;
2503 reader.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2506 readerSubsystemID = getSubsytemId(readerSubsystemLink);
2508 info_.subsystems[readerSubsystemID].id = readerSubsystemID;
2510 const std::string& readerSubsystemName =
2514 info_.subsystems[readerSubsystemID].label = readerSubsystemName;
2516 auto readerSubsystemDestinationLink = readerSubsystemLink.
getNode(
2517 colARTDAQSubsystem_.colLinkToDestination_);
2518 if(readerSubsystemDestinationLink.isDisconnected())
2521 info_.subsystems[readerSubsystemID].destination = 0;
2526 info_.subsystems[readerSubsystemID].destination =
2527 getSubsytemId(readerSubsystemDestinationLink);
2533 if(!info_.subsystems.count(
2534 info_.subsystems[readerSubsystemID].destination) ||
2535 !info_.subsystems[info_.subsystems[readerSubsystemID].destination]
2536 .sources.count(readerSubsystemID))
2538 info_.subsystems[info_.subsystems[readerSubsystemID].destination]
2539 .sources.insert(readerSubsystemID);
2544 __COUT__ <<
"Found Board Reader with UID " << readerUID
2545 <<
", DAQInterface Hostname " << readerHost <<
", and Subsystem "
2546 << readerSubsystemID << __E__;
2547 info_.processes[ARTDAQAppType::BoardReader].emplace_back(
2552 ARTDAQAppType::BoardReader,
2553 reader.second.status());
2557 outputBoardReaderFHICL(reader.second,
2558 maxFragmentSizeBytes,
2562 flattenFHICL(ARTDAQAppType::BoardReader, reader.second.getValue());
2567 __COUT__ <<
"Board Reader " << readerUID <<
" is disabled." << __E__;
2573 __COUT_WARN__ <<
"There should be at least one Board Reader!";
2580 void ARTDAQTableBase::extractEventBuildersInfo(
ConfigurationTree artdaqSupervisorNode,
2581 bool getStatusFalseNodes,
2583 size_t maxFragmentSizeBytes)
2585 __COUT__ <<
"Checking for Event Builders..." << __E__;
2586 info_.processes[ARTDAQAppType::EventBuilder].clear();
2589 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToEventBuilders_);
2592 std::vector<std::pair<std::string, ConfigurationTree>> builders =
2595 std::string lastBuilderFcl[2],
2596 flattenedLastFclParts
2598 for(
auto& builder : builders)
2600 const std::string& builderUID = builder.first;
2601 __COUTV__(builderUID);
2603 if(getStatusFalseNodes || builder.second.status())
2605 std::string builderHost =
2606 builder.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2607 .getValueWithDefault(
"localhost");
2608 std::string builderAP =
2610 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2611 .getValueWithDefault(
"");
2613 int builderSubsystemID = 1;
2615 builder.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2618 builderSubsystemID = getSubsytemId(builderSubsystemLink);
2621 info_.subsystems[builderSubsystemID].id = builderSubsystemID;
2623 const std::string& builderSubsystemName =
2627 info_.subsystems[builderSubsystemID].label = builderSubsystemName;
2629 auto builderSubsystemDestinationLink = builderSubsystemLink.
getNode(
2630 colARTDAQSubsystem_.colLinkToDestination_);
2631 if(builderSubsystemDestinationLink.isDisconnected())
2634 info_.subsystems[builderSubsystemID].destination = 0;
2639 info_.subsystems[builderSubsystemID].destination =
2640 getSubsytemId(builderSubsystemDestinationLink);
2646 if(!info_.subsystems.count(
2647 info_.subsystems[builderSubsystemID].destination) ||
2648 !info_.subsystems[info_.subsystems[builderSubsystemID].destination]
2649 .sources.count(builderSubsystemID))
2651 info_.subsystems[info_.subsystems[builderSubsystemID].destination]
2652 .sources.insert(builderSubsystemID);
2657 __COUT__ <<
"Found Event Builder with UID " << builderUID
2658 <<
", on Hostname " << builderHost <<
", in Subsystem "
2659 << builderSubsystemID << __E__;
2660 info_.processes[ARTDAQAppType::EventBuilder].emplace_back(
2665 ARTDAQAppType::EventBuilder,
2666 builder.second.status());
2670 std::string returnFcl, processName;
2671 bool needToFlatten =
true;
2672 bool captureAsLastFcl =
2675 (&builder != &builders.back());
2677 ARTDAQAppType::EventBuilder,
2678 maxFragmentSizeBytes,
2679 DEFAULT_ROUTING_TIMEOUT_MS,
2680 DEFAULT_ROUTING_RETRY_COUNT,
2681 captureAsLastFcl ? &returnFcl :
nullptr);
2688 auto cmi = returnFcl.find(
2689 "# otsdaq-ARTDAQ builder UID:");
2690 if(cmi != std::string::npos)
2691 cmi = returnFcl.find(
'\n', cmi);
2692 if(cmi != std::string::npos)
2694 size_t pnj = std::string::npos;
2696 returnFcl.find(
"\tprocess_name: ", cmi);
2697 if(pni != std::string::npos)
2699 pni += std::string(
"\tprocess_name: ")
2701 pnj = returnFcl.find(
'\n', pni);
2703 if(pnj != std::string::npos)
2705 processName = returnFcl.substr(pni, pnj - pni);
2706 __COUT__ <<
"Found process name = " << processName << __E__;
2708 bool sameFirst =
false;
2710 std::string newPiece = returnFcl.substr(cmi, pni - cmi);
2711 if(flattenedLastFclParts[0].size() &&
2712 lastBuilderFcl[0].size() && lastBuilderFcl[0] == newPiece)
2714 __COUT__ <<
"Same first fcl" << __E__;
2719 __COUTVS__(20, lastBuilderFcl[0]);
2720 __COUTVS__(20, newPiece);
2721 for(
size_t i = 0, j = 0;
2722 i < lastBuilderFcl[0].size() && j < newPiece.size();
2725 if(lastBuilderFcl[0][i] != newPiece[j])
2729 __COUTVS__(20, lastBuilderFcl[0].substr(i, 30));
2730 __COUTVS__(20, newPiece.substr(j, 30));
2735 if(captureAsLastFcl)
2736 lastBuilderFcl[0] = newPiece;
2739 newPiece = returnFcl.substr(pnj);
2740 if(lastBuilderFcl[0].size() && lastBuilderFcl[1] == newPiece)
2742 __COUT__ <<
"Same second fcl" << __E__;
2745 std::chrono::steady_clock::time_point startClock =
2746 std::chrono::steady_clock::now();
2747 __COUT__ <<
"Found fcl match! Reuse for "
2748 << builderUID << __E__;
2751 needToFlatten =
false;
2754 std::string outFile = getFlatFHICLFilename(
2755 ARTDAQAppType::EventBuilder, builderUID);
2756 __COUTVS__(3, outFile);
2757 std::ofstream ofs{outFile};
2760 __SS__ <<
"Failed to open fhicl output file '"
2761 << outFile <<
"!'" << __E__;
2764 ofs << flattenedLastFclParts[0] <<
"process_name: \""
2765 << processName <<
"\""
2766 << flattenedLastFclParts[1];
2768 << builderUID <<
" Flatten Clock time = "
2769 << artdaq::TimeUtils::GetElapsedTime(startClock)
2774 if(captureAsLastFcl)
2775 lastBuilderFcl[1] = newPiece;
2780 ARTDAQTableBase::flattenFHICL(
2781 ARTDAQAppType::EventBuilder,
2783 captureAsLastFcl ? &returnFcl :
nullptr);
2785 __COUT__ <<
"Skipping full flatten for " << builderUID << __E__;
2788 __COUTV__(captureAsLastFcl);
2789 if(captureAsLastFcl)
2791 size_t pnj = std::string::npos;
2792 auto pni = returnFcl.find(
"process_name:");
2793 if(pni != std::string::npos)
2797 (returnFcl[pni - 1] ==
' ' || returnFcl[pni - 1] ==
'\n' ||
2798 returnFcl[pni - 1] ==
'\t'))
2799 pnj = returnFcl.find(
'\n', pni);
2801 if(pnj != std::string::npos)
2804 <<
"Found flattened '"
2805 << returnFcl.substr(pni, pnj - pni) <<
"' at pos " << pni
2806 <<
" of " << returnFcl.size() << __E__;
2807 flattenedLastFclParts[0] = returnFcl.substr(0, pni);
2808 flattenedLastFclParts[1] = returnFcl.substr(pnj);
2812 __COUT_WARN__ <<
"Failed to capture fcl for " << processName
2820 __COUT__ <<
"Event Builder " << builderUID <<
" is disabled." << __E__;
2826 __COUT_WARN__ <<
"There should be at least one Event Builder!";
2833 void ARTDAQTableBase::extractDataLoggersInfo(
ConfigurationTree artdaqSupervisorNode,
2834 bool getStatusFalseNodes,
2836 size_t maxFragmentSizeBytes)
2838 __COUT__ <<
"Checking for Data Loggers..." << __E__;
2839 info_.processes[ARTDAQAppType::DataLogger].clear();
2842 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToDataLoggers_);
2845 std::vector<std::pair<std::string, ConfigurationTree>> dataloggers =
2848 for(
auto& datalogger : dataloggers)
2850 const std::string& loggerUID = datalogger.first;
2852 if(getStatusFalseNodes || datalogger.second.status())
2854 std::string loggerHost =
2855 datalogger.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2856 .getValueWithDefault(
"localhost");
2857 std::string loggerAP =
2859 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2860 .getValueWithDefault(
"");
2862 int loggerSubsystemID = 1;
2864 datalogger.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2867 loggerSubsystemID = getSubsytemId(loggerSubsystemLink);
2869 info_.subsystems[loggerSubsystemID].id = loggerSubsystemID;
2871 const std::string& loggerSubsystemName =
2875 info_.subsystems[loggerSubsystemID].label = loggerSubsystemName;
2877 auto loggerSubsystemDestinationLink = loggerSubsystemLink.
getNode(
2878 colARTDAQSubsystem_.colLinkToDestination_);
2879 if(loggerSubsystemDestinationLink.isDisconnected())
2882 info_.subsystems[loggerSubsystemID].destination = 0;
2887 info_.subsystems[loggerSubsystemID].destination =
2888 getSubsytemId(loggerSubsystemDestinationLink);
2894 if(!info_.subsystems.count(
2895 info_.subsystems[loggerSubsystemID].destination) ||
2896 !info_.subsystems[info_.subsystems[loggerSubsystemID].destination]
2897 .sources.count(loggerSubsystemID))
2899 info_.subsystems[info_.subsystems[loggerSubsystemID].destination]
2900 .sources.insert(loggerSubsystemID);
2905 __COUT__ <<
"Found Data Logger with UID " << loggerUID
2906 <<
", DAQInterface Hostname " << loggerHost <<
", and Subsystem "
2907 << loggerSubsystemID << __E__;
2908 info_.processes[ARTDAQAppType::DataLogger].emplace_back(
2913 ARTDAQAppType::DataLogger,
2914 datalogger.second.status());
2919 ARTDAQAppType::DataLogger,
2920 maxFragmentSizeBytes);
2922 flattenFHICL(ARTDAQAppType::DataLogger, datalogger.second.getValue());
2927 __COUT__ <<
"Data Logger " << loggerUID <<
" is disabled." << __E__;
2933 __COUT_WARN__ <<
"There were no Data Loggers found!";
2938 void ARTDAQTableBase::extractDispatchersInfo(
ConfigurationTree artdaqSupervisorNode,
2939 bool getStatusFalseNodes,
2941 size_t maxFragmentSizeBytes)
2943 __COUT__ <<
"Checking for Dispatchers..." << __E__;
2944 info_.processes[ARTDAQAppType::Dispatcher].clear();
2947 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToDispatchers_);
2950 std::vector<std::pair<std::string, ConfigurationTree>> dispatchers =
2953 for(
auto& dispatcher : dispatchers)
2955 const std::string& dispatcherUID = dispatcher.first;
2957 if(getStatusFalseNodes || dispatcher.second.status())
2959 std::string dispatcherHost =
2960 dispatcher.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2961 .getValueWithDefault(
"localhost");
2962 std::string dispatcherAP =
2964 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2965 .getValueWithDefault(
"");
2966 int dispatcherPort =
2967 dispatcher.second.getNode(
"DispatcherPort").getValue<
int>();
2969 auto dispatcherSubsystemID = 1;
2971 dispatcher.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2974 dispatcherSubsystemID = getSubsytemId(dispatcherSubsystemLink);
2976 info_.subsystems[dispatcherSubsystemID].id = dispatcherSubsystemID;
2978 const std::string& dispatcherSubsystemName =
2982 info_.subsystems[dispatcherSubsystemID].label =
2983 dispatcherSubsystemName;
2985 auto dispatcherSubsystemDestinationLink =
2986 dispatcherSubsystemLink.
getNode(
2987 colARTDAQSubsystem_.colLinkToDestination_);
2988 if(dispatcherSubsystemDestinationLink.isDisconnected())
2991 info_.subsystems[dispatcherSubsystemID].destination = 0;
2996 info_.subsystems[dispatcherSubsystemID].destination =
2997 getSubsytemId(dispatcherSubsystemDestinationLink);
3003 if(!info_.subsystems.count(
3004 info_.subsystems[dispatcherSubsystemID].destination) ||
3006 .subsystems[info_.subsystems[dispatcherSubsystemID]
3008 .sources.count(dispatcherSubsystemID))
3011 .subsystems[info_.subsystems[dispatcherSubsystemID]
3013 .sources.insert(dispatcherSubsystemID);
3017 __COUT__ <<
"Found Dispatcher with UID " << dispatcherUID
3018 <<
", DAQInterface Hostname " << dispatcherHost
3019 <<
", and Subsystem " << dispatcherSubsystemID << __E__;
3020 info_.processes[ARTDAQAppType::Dispatcher].emplace_back(
3024 dispatcherSubsystemID,
3025 ARTDAQAppType::Dispatcher,
3026 dispatcher.second.status(),
3032 ARTDAQAppType::Dispatcher,
3033 maxFragmentSizeBytes);
3035 flattenFHICL(ARTDAQAppType::Dispatcher, dispatcher.second.getValue());
3040 __COUT__ <<
"Dispatcher " << dispatcherUID <<
" is disabled." << __E__;
3046 __COUT_WARN__ <<
"There were no Dispatchers found!";
3056 for(
auto context : contexts)
3058 if(!context.second.isEnabled())
3061 auto apps = context.second
3062 .getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
3064 for(
auto app : apps)
3067 if(app.second.getNode(XDAQContextTable::colApplication_.colClass_)
3068 .getValue() == ARTDAQ_SUPERVISOR_CLASS &&
3069 app.second.isEnabled())
3087 std::map<std::string ,
3088 std::map<std::string , std::vector<std::string /*property*/>>>&
3089 nodeTypeToObjectMap,
3090 std::map<std::string /*subsystemName*/, std::string /*destinationSubsystemName*/>&
3092 std::vector<std::string /*property*/>& artdaqSupervisoInfo)
3094 __COUT__ <<
"getARTDAQSystem()" << __E__;
3096 artdaqSupervisoInfo.clear();
3107 return ARTDAQTableBase::info_;
3109 __COUTV__(artdaqContext->contextUID_);
3110 __COUTV__(artdaqContext->applications_.size());
3113 std::map<std::string , std::set<std::string >> nodeLayoutNames;
3115 const std::string& finalContextGroupName =
3116 cfgMgr->getActiveGroupName(ConfigurationManager::GroupType::CONTEXT_TYPE);
3118 cfgMgr->getActiveGroupKey(ConfigurationManager::GroupType::CONTEXT_TYPE);
3119 const std::string& finalConfigGroupName = cfgMgr->getActiveGroupName(
3120 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
3121 const TableGroupKey& finalConfigGroupKey = cfgMgr->getActiveGroupKey(
3122 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
3127 std::stringstream layoutPath;
3128 layoutPath << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH
3129 << finalContextGroupName <<
"_" << finalContextGroupKey <<
"."
3130 << finalConfigGroupName <<
"_" << finalConfigGroupKey <<
".dat";
3132 fp = fopen(layoutPath.str().c_str(),
"r");
3135 __COUT__ <<
"Layout file not found for '" << finalContextGroupName <<
"("
3136 << finalContextGroupKey <<
") + " << finalConfigGroupName <<
"("
3137 << finalConfigGroupKey <<
")': " << layoutPath.
str() << __E__;
3141 __COUTV__(layoutPath.str());
3145 std::stringstream layoutPath;
3146 layoutPath << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH
3147 << finalContextGroupName <<
"_" << finalContextGroupKey <<
".dat";
3148 __COUTV__(layoutPath.str());
3150 fp = fopen(layoutPath.str().c_str(),
"r");
3153 __COUT__ <<
"Layout file not found for '" << finalContextGroupName <<
"("
3154 << finalContextGroupKey <<
")': " << layoutPath.str() << __E__;
3157 __COUTV__(layoutPath.str());
3163 struct dirent* entry;
3168 float bestScore = 0, score;
3169 std::string bestName =
"";
3171 if(!(pDIR = opendir((ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH).c_str())))
3173 __SS__ <<
"Path '" << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH
3174 <<
"' could not be opened!" << __E__;
3179 while((entry = readdir(pDIR)))
3181 name = std::string(entry->d_name);
3182 type = int(entry->d_type);
3184 __COUTS__(2) << type <<
" " << name <<
"\n" << std::endl;
3186 if(name[0] !=
'.' &&
3196 if(type == 0 || type == 10)
3199 DIR* pTmpDIR = opendir(
3200 (ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH +
"/" + name)
3208 __COUTS__(2) <<
"Unable to open path as directory: "
3209 << (ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH +
3221 __COUTS__(2) <<
"Directory: " << type <<
" " << name << __E__;
3225 __COUTS__(2) <<
"File: " << type <<
" " << name <<
"\n"
3227 if(name.find(
".dat") !=
3231 __COUTS__(2) <<
"Contender: " << name <<
"\n" << std::endl;
3236 if(nameSplit.size() > 1)
3239 auto keyi = nameSplit[1].rfind(
'_');
3240 if(keyi != std::string::npos)
3244 .substr(keyi, nameSplit[1].size() - 4 - keyi)
3248 finalConfigGroupKey.key() -
3254 __COUTVS__(2, tmpscore);
3258 __COUTVS__(2, tmpscore);
3261 std::string nameToCompare = nameSplit[1].substr(0, keyi);
3262 __COUTVS__(2, nameToCompare);
3263 size_t i = 0, j = 0;
3265 for(; i < nameToCompare.size() &&
3266 j < finalConfigGroupName.size();
3269 if(nameToCompare[i] == finalConfigGroupName[j])
3275 __COUTVS__(2, tmpscore);
3277 for(; i < nameToCompare.size() &&
3278 j < finalConfigGroupName.size();
3281 if(nameToCompare[i] == finalConfigGroupName[j])
3287 __COUTVS__(2, tmpscore);
3290 __COUTVS__(2, score);
3292 if(nameSplit.size() > 0)
3295 auto keyi = nameSplit[0].rfind(
'_');
3296 if(keyi != std::string::npos)
3300 .substr(keyi, nameSplit[0].size() - 4 - keyi)
3304 finalContextGroupKey.key() -
3310 __COUTVS__(2, tmpscore);
3314 __COUTVS__(2, tmpscore);
3317 std::string nameToCompare = nameSplit[0].substr(0, keyi);
3318 __COUTVS__(2, nameToCompare);
3319 size_t i = 0, j = 0;
3321 for(; i < nameToCompare.size() &&
3322 j < finalContextGroupName.size();
3325 if(nameToCompare[i] == finalContextGroupName[j])
3331 __COUTVS__(2, tmpscore);
3333 for(; i < nameToCompare.size() &&
3334 j < finalContextGroupName.size();
3337 if(nameToCompare[i] == finalContextGroupName[j])
3343 __COUTVS__(2, tmpscore);
3346 __COUTVS__(2, score);
3349 if(score > bestScore)
3353 __COUTVS__(2, bestName);
3361 __COUT__ <<
"Found closest layout file name: " << bestName <<
".dat"
3363 std::stringstream layoutPath;
3364 layoutPath << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH << bestName
3366 __COUTV__(layoutPath.str());
3367 fp = fopen(layoutPath.str().c_str(),
"r");
3370 __COUT__ <<
"Closest layout file not found for '" << bestName <<
"'"
3380 __COUT__ <<
"Extract info from layout file.." << __E__;
3386 const size_t maxLineSz = 1000;
3387 char line[maxLineSz];
3388 if(!fgets(line, maxLineSz, fp))
3391 __COUT__ <<
"No layout naming info found." << __E__;
3397 char name[maxLineSz];
3398 char type[maxLineSz];
3400 while(fgets(line, maxLineSz, fp))
3403 sscanf(line,
"%s %s %u %u", type, name, &x, &y);
3404 nodeLayoutNames[type].emplace(name);
3419 for(
auto& artdaqApp : artdaqContext->applications_)
3421 if(artdaqApp.class_ != ARTDAQ_SUPERVISOR_CLASS)
3424 __COUTV__(artdaqApp.applicationUID_);
3425 artdaqSupervisoInfo.push_back(artdaqApp.applicationUID_);
3426 artdaqSupervisoInfo.push_back(
3427 (artdaqContext->status_ && artdaqApp.status_) ?
"1" :
"0");
3428 artdaqSupervisoInfo.push_back(artdaqContext->address_);
3429 artdaqSupervisoInfo.push_back(std::to_string(artdaqContext->port_));
3432 XDAQContextTable::getSupervisorConfigNode(
3434 artdaqContext->contextUID_,
3435 artdaqApp.applicationUID_),
3438 __COUT__ <<
"========== "
3439 <<
"Found " << info.subsystems.size() <<
" subsystems." << __E__;
3442 for(
auto& subsystem : info.subsystems)
3443 subsystemObjectMap.emplace(std::make_pair(
3444 subsystem.second.label, std::to_string(subsystem.second.destination)));
3446 __COUT__ <<
"========== "
3447 <<
"Found " << info.processes.size() <<
" process types." << __E__;
3451 const std::string& typeString = nameTypePair.first;
3452 __COUTV__(typeString);
3454 nodeTypeToObjectMap.emplace(
3455 std::make_pair(typeString,
3456 std::map<std::string ,
3457 std::vector<std::string /*property*/>>()));
3459 auto it = info.processes.find(nameTypePair.second);
3460 if(it == info.processes.end())
3463 <<
"Found 0 " << typeString << __E__;
3467 <<
"Found " << it->second.size() <<
" " << typeString <<
"(s)"
3473 __SS__ <<
"Invalid artdaq node type '" << typeString <<
"' attempted!"
3477 __COUTV__(tableIt->second);
3480 std::stringstream ss;
3481 cfgMgr->getTableByName(tableIt->second)->getView().print(ss);
3482 __COUT_MULTI__(1, ss.str());
3492 const std::set<std::string > skipColumns(
3493 {ARTDAQ_TYPE_TABLE_HOSTNAME,
3494 ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS,
3495 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK,
3497 .colDaqFragmentIDs_,
3498 TableViewColumnInfo::COL_NAME_COMMENT,
3499 TableViewColumnInfo::COL_NAME_AUTHOR,
3500 TableViewColumnInfo::
3501 COL_NAME_CREATION});
3503 if(TTEST(1) && nodeLayoutNames.find(typeString) != nodeLayoutNames.end())
3509 for(
auto& artdaqNode : it->second)
3512 if(skipSet.find(StringMacros::encodeURIComponent(artdaqNode.label)) !=
3517 <<
"Found '" << artdaqNode.label <<
"' " << typeString << __E__;
3519 std::string nodeName = artdaqNode.label;
3520 bool status = artdaqNode.status;
3521 std::string hostname = artdaqNode.hostname;
3522 std::string subsystemId = std::to_string(artdaqNode.subsystem);
3523 std::string subsystemName =
3524 info.subsystems.at(artdaqNode.subsystem).label;
3535 std::vector<std::string> multiNodeNames, hostnameArray;
3540 StringMacros::encodeURIComponent(nodeName));
3542 __COUTV__(allNodes.size());
3543 for(
auto& otherNode : allNodes)
3545 if(skipSet.find(StringMacros::encodeURIComponent(otherNode.first)) !=
3547 otherNode.second.status() != status)
3554 otherNode.second.getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID)
3563 auto otherNodeColumns = otherNode.second.getChildren();
3565 bool isMultiNode =
true;
3566 for(
unsigned int i = 0;
3567 i < thisNodeColumns.size() && i < otherNodeColumns.size();
3571 if(skipColumns.find(thisNodeColumns[i].first) !=
3572 skipColumns.end() ||
3573 thisNodeColumns[i].second.isLinkNode())
3584 if(thisNodeColumns[i].second.getValue() !=
3585 otherNodeColumns[i].second.getValue())
3587 __COUT__ <<
"Mismatch, not multi-node member." << __E__;
3588 isMultiNode =
false;
3595 __COUT__ <<
"Found '" << nodeName
3596 <<
"' multi-node member candidate '"
3597 << otherNode.first <<
"'" << __E__;
3600 if(!multiNodeNames.size())
3602 multiNodeNames.push_back(
3603 StringMacros::encodeURIComponent(nodeName));
3604 hostnameArray.push_back(
3605 StringMacros::encodeURIComponent(hostname));
3607 multiNodeNames.push_back(
3608 StringMacros::encodeURIComponent(otherNode.first));
3609 hostnameArray.push_back(StringMacros::encodeURIComponent(
3610 otherNode.second.getNode(ARTDAQ_TYPE_TABLE_HOSTNAME)
3613 __COUTV__(hostnameArray.back());
3615 StringMacros::encodeURIComponent(otherNode.first));
3620 unsigned int nodeFixedWildcardLength = 0, hostFixedWildcardLength = 0;
3621 std::string multiNodeString =
"", hostArrayString =
"";
3623 __COUTV__(nodeName);
3625 if(multiNodeNames.size() > 1)
3627 __COUT__ <<
"Handling multi-node printer syntax" << __E__;
3634 if(nodeLayoutNames.find(typeString) != nodeLayoutNames.end())
3642 std::string bestNodeLayoutName =
"";
3643 size_t bestNodeLayoutMatchCount =
3644 multiNodeNames.size() + 1;
3646 for(
const auto& layoutNameFull : nodeLayoutNames.at(typeString))
3648 __COUTTV__(layoutNameFull);
3649 size_t statusPos = layoutNameFull.find(
";status=");
3650 std::string layoutName = layoutNameFull.substr(0, statusPos);
3651 bool layoutStatus =
true;
3655 layoutStatus = status;
3657 layoutNameFull.substr(statusPos +
3658 std::string(
";status=").size()))
3659 layoutStatus =
false;
3661 __COUTTV__(layoutStatus);
3663 if(layoutStatus != status)
3665 __COUTT__ <<
"Status mismatch for template" << __E__;
3673 bool exactMatch =
true;
3675 for(
const auto& layoutSeg : layoutSplit)
3676 if((pos = nodeName.find(layoutSeg, pos)) ==
3679 __COUTT__ <<
"Did not find '" << layoutSeg <<
"' in '"
3680 << nodeName <<
"'" << __E__;
3685 __COUTTV__(exactMatch);
3688 size_t nodeLayoutMatchCount = 1;
3690 __COUT__ <<
"Found layout template name match! '"
3691 << layoutName <<
"' for node '" << nodeName
3692 <<
".' Trimming multinode candidates to match..."
3695 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
3697 __COUTTV__(multiNodeNames[i]);
3698 std::string multiNodeName =
3701 __COUTTV__(multiNodeName);
3702 bool exactMatch =
true;
3704 for(
const auto& layoutSeg : layoutSplit)
3705 if((pos = multiNodeName.find(layoutSeg, pos)) ==
3708 __COUTT__ <<
"Did not find '" << layoutSeg
3709 <<
"' in '" << multiNodeName <<
"'"
3717 ++nodeLayoutMatchCount;
3718 __COUTT__ <<
"Found '" << layoutName <<
"' in '"
3719 << multiNodeName <<
"'" << __E__;
3724 __COUTTV__(nodeLayoutMatchCount);
3725 if(nodeLayoutMatchCount < bestNodeLayoutMatchCount)
3727 bestNodeLayoutName = layoutNameFull;
3728 bestNodeLayoutMatchCount = nodeLayoutMatchCount;
3729 __COUTTV__(bestNodeLayoutName);
3730 __COUTTV__(bestNodeLayoutMatchCount);
3735 __COUTV__(nodeName);
3741 if(bestNodeLayoutMatchCount > 0)
3743 __COUTV__(bestNodeLayoutName);
3744 std::string layoutNameFull = bestNodeLayoutName;
3745 __COUTTV__(layoutNameFull);
3746 size_t statusPos = layoutNameFull.find(
";status=");
3747 std::string layoutName = layoutNameFull.substr(0, statusPos);
3753 __COUT__ <<
"Found layout template name match! '"
3754 << layoutName <<
"' for node '" << nodeName
3755 <<
".' Trimming multinode candidates to match..."
3758 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
3760 __COUTTV__(multiNodeNames[i]);
3761 std::string multiNodeName =
3763 __COUTTV__(multiNodeName);
3764 bool exactMatch =
true;
3766 for(
const auto& layoutSeg : layoutSplit)
3767 if((pos = multiNodeName.find(layoutSeg, pos)) ==
3770 __COUTT__ <<
"Did not find '" << layoutSeg
3771 <<
"' in '" << multiNodeName <<
"'"
3779 __COUT__ <<
"Trimming multinode candidate '"
3780 << multiNodeName <<
"'" << __E__;
3781 skipSet.erase(multiNodeNames[i]);
3782 multiNodeNames.erase(multiNodeNames.begin() + i);
3783 hostnameArray.erase(hostnameArray.begin() + i);
3790 __COUTV__(nodeName);
3797 unsigned int maxScore = 0;
3799 unsigned int minScore = -1;
3800 std::vector<unsigned int> scoreVector;
3801 scoreVector.push_back(-1);
3802 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
3806 __COUTS__(3) << multiNodeNames[0] <<
" vs "
3807 << multiNodeNames[i] << __E__;
3810 for(
unsigned int j = 0, k = 0; j < multiNodeNames[0].size() &&
3811 k < multiNodeNames[i].size();
3814 while(j < multiNodeNames[0].size() &&
3815 !(multiNodeNames[0][j] >=
'a' &&
3816 multiNodeNames[0][j] <=
'z') &&
3817 !(multiNodeNames[0][j] >=
'A' &&
3818 multiNodeNames[0][j] <=
'Z'))
3820 while(k < multiNodeNames[i].size() &&
3821 !(multiNodeNames[i][k] >=
'a' &&
3822 multiNodeNames[i][k] <=
'z') &&
3823 !(multiNodeNames[i][k] >=
'A' &&
3824 multiNodeNames[i][k] <=
'Z'))
3827 while(k < multiNodeNames[i].size() &&
3828 multiNodeNames[0][j] != multiNodeNames[i][k])
3832 << j <<
"-" << k <<
" of " << multiNodeNames[0].size()
3833 <<
"-" << multiNodeNames[i].size() << __E__;
3835 if(j < multiNodeNames[0].size() &&
3836 k < multiNodeNames[i].size())
3840 __COUTVS__(3, score);
3843 for(
unsigned int j = multiNodeNames[0].size() - 1,
3844 k = multiNodeNames[i].size() - 1;
3845 j < multiNodeNames[0].size() &&
3846 k < multiNodeNames[i].size();
3849 while(j < multiNodeNames[0].size() &&
3850 !(multiNodeNames[0][j] >=
'a' &&
3851 multiNodeNames[0][j] <=
'z') &&
3852 !(multiNodeNames[0][j] >=
'A' &&
3853 multiNodeNames[0][j] <=
'Z'))
3855 while(k < multiNodeNames[i].size() &&
3856 !(multiNodeNames[i][k] >=
'a' &&
3857 multiNodeNames[i][k] <=
'z') &&
3858 !(multiNodeNames[i][k] >=
'A' &&
3859 multiNodeNames[i][k] <=
'Z'))
3862 while(k < multiNodeNames[i].size() &&
3863 multiNodeNames[0][j] != multiNodeNames[i][k])
3866 __COUTS__(3) <<
"BACK" << j <<
"-" << k <<
" of "
3867 << multiNodeNames[0].size() <<
"-"
3868 << multiNodeNames[i].size() << __E__;
3870 if(j < multiNodeNames[0].size() &&
3871 k < multiNodeNames[i].size())
3875 __COUTVS__(3, score / 2.0);
3877 scoreVector.push_back(score);
3879 if(score > maxScore)
3884 if(score < minScore)
3891 __COUTVS__(2, minScore);
3892 __COUTVS__(2, maxScore);
3894 __COUT__ <<
"Trimming multi-node members with low match score..."
3899 for(
unsigned int i = multiNodeNames.size() - 1;
3900 i > 0 && i < multiNodeNames.size();
3905 if(maxScore > multiNodeNames[0].size() &&
3906 scoreVector[i] >= maxScore)
3910 __COUT__ <<
"Trimming low score match " << multiNodeNames[i]
3911 <<
" for node name " << nodeName << __E__;
3913 skipSet.erase(multiNodeNames[i]);
3914 multiNodeNames.erase(multiNodeNames.begin() + i);
3915 hostnameArray.erase(hostnameArray.begin() + i);
3921 __COUTV__(nodeName);
3928 __COUT__ <<
"Reorganizing multinode '" << nodeName
3929 <<
"' alphabetically..." << __E__;
3931 std::pair<std::string , std::string >>
3933 for(
unsigned int i = 0; i < multiNodeNames.size(); ++i)
3935 std::make_pair(multiNodeNames[i], hostnameArray[i]));
3940 multiNodeNames.clear();
3941 hostnameArray.clear();
3942 for(
const auto& orderedPair : reorderSet)
3944 multiNodeNames.push_back(orderedPair.first);
3945 hostnameArray.push_back(orderedPair.second);
3949 __COUTV__(nodeName);
3955 if(multiNodeNames.size() > 1)
3957 std::vector<std::string> commonChunks;
3958 std::vector<std::string> wildcards;
3962 bool wildcardsNeeded =
3966 nodeFixedWildcardLength);
3968 if(!wildcardsNeeded || wildcards.size() != multiNodeNames.size())
3971 <<
"Impossible extractCommonChunks result! Please notify "
3972 "admins or try to simplify record naming convention."
3982 for(
auto& commonChunk : commonChunks)
3984 nodeName += (!first ?
"*" :
"") + commonChunk;
3988 if(commonChunks.size() == 1)
3991 __COUTV__(nodeName);
3998 bool allIntegers =
true;
3999 for(
auto& wildcard : wildcards)
4002 else if(wildcard.size() == 0)
4004 allIntegers =
false;
4008 for(
unsigned int i = 0; i < wildcard.size(); ++i)
4009 if(!(wildcard[i] >=
'0' && wildcard[i] <=
'9'))
4011 allIntegers =
false;
4015 __COUTV__(allIntegers);
4021 std::vector<unsigned int> intWildcards;
4022 for(
auto& wildcard : wildcards)
4023 intWildcards.push_back(strtol(wildcard.c_str(), 0, 10));
4027 unsigned int hyphenLo = -1;
4028 bool isFirst =
true;
4029 for(
unsigned int i = 0; i < intWildcards.size(); ++i)
4031 if(i + 1 < intWildcards.size() &&
4032 intWildcards[i] + 1 == intWildcards[i + 1])
4044 (isFirst ?
"" :
",") +
4045 std::to_string(intWildcards[i]);
4050 if(intWildcards[hyphenLo] + 1 == intWildcards[i])
4052 (isFirst ?
"" :
",") +
4053 std::to_string(intWildcards[hyphenLo]) +
4054 "," + std::to_string(intWildcards[i]);
4057 (isFirst ?
"" :
",") +
4058 std::to_string(intWildcards[hyphenLo]) +
4059 "-" + std::to_string(intWildcards[i]);
4069 nodeFixedWildcardLength =
4073 __COUTV__(multiNodeString);
4074 __COUTV__(nodeFixedWildcardLength);
4077 if(hostnameArray.size() > 1)
4079 std::vector<std::string> commonChunks;
4080 std::vector<std::string> wildcards;
4084 bool wildcardsNeeded =
4088 hostFixedWildcardLength);
4090 __COUTV__(wildcardsNeeded);
4096 for(
auto& commonChunk : commonChunks)
4098 hostname += (!first ?
"*" :
"") + commonChunk;
4102 if(wildcardsNeeded && commonChunks.size() == 1)
4105 __COUTV__(hostname);
4115 bool allIntegers =
true;
4116 for(
auto& wildcard : wildcards)
4117 for(
unsigned int i = 0; i < wildcard.size(); ++i)
4118 if(!(wildcard[i] >=
'0' && wildcard[i] <=
'9'))
4120 allIntegers =
false;
4124 __COUTV__(allIntegers);
4131 std::vector<unsigned int> intWildcards;
4132 for(
auto& wildcard : wildcards)
4133 intWildcards.push_back(
4134 strtol(wildcard.c_str(), 0, 10));
4138 unsigned int hyphenLo = -1;
4139 bool isFirst =
true;
4140 for(
unsigned int i = 0; i < intWildcards.size(); ++i)
4142 if(i + 1 < intWildcards.size() &&
4143 intWildcards[i] + 1 == intWildcards[i + 1])
4155 (isFirst ?
"" :
",") +
4156 std::to_string(intWildcards[i]);
4161 if(intWildcards[hyphenLo] + 1 ==
4164 (isFirst ?
"" :
",") +
4166 intWildcards[hyphenLo]) +
4167 "," + std::to_string(intWildcards[i]);
4170 (isFirst ?
"" :
",") +
4172 intWildcards[hyphenLo]) +
4173 "-" + std::to_string(intWildcards[i]);
4183 hostFixedWildcardLength =
4187 __COUTV__(hostArrayString);
4188 __COUTV__(hostFixedWildcardLength);
4198 auto result = nodeTypeToObjectMap.at(typeString)
4199 .emplace(std::make_pair(
4200 nodeName, std::vector<std::string /*property*/>()));
4203 __SS__ <<
"Impossible printer syntax handling result! Collision of "
4204 "base names. Please notify "
4205 "admins or try to simplify record naming convention."
4210 nodeTypeToObjectMap.at(typeString)
4212 .push_back(status ?
"1" :
"0");
4214 nodeTypeToObjectMap.at(typeString).at(nodeName).push_back(hostname);
4216 nodeTypeToObjectMap.at(typeString).at(nodeName).push_back(subsystemId);
4217 if(multiNodeNames.size() > 1)
4219 nodeTypeToObjectMap.at(typeString)
4221 .push_back(multiNodeString);
4223 nodeTypeToObjectMap.at(typeString)
4225 .push_back(std::to_string(nodeFixedWildcardLength));
4227 if(hostnameArray.size() > 1)
4229 nodeTypeToObjectMap.at(typeString)
4231 .push_back(hostArrayString);
4233 nodeTypeToObjectMap.at(typeString)
4235 .push_back(std::to_string(hostFixedWildcardLength));
4239 __COUTV__(multiNodeString);
4241 __COUTV__(hostArrayString);
4242 __COUT__ <<
"Done with extraction of node '" << nodeName <<
"'" << __E__;
4248 __COUT__ <<
"Done getting artdaq nodes." << __E__;
4250 return ARTDAQTableBase::info_;
4264 const std::map<std::string ,
4265 std::map<std::string ,
4266 std::vector<std::string /*property*/>>>& nodeTypeToObjectMap,
4267 const std::map<std::string ,
4268 std::string >& subsystemObjectMap)
4270 __COUT__ <<
"setAndActivateARTDAQSystem()" << __E__;
4272 const std::string& author = cfgMgr->
getUsername();
4283 GroupEditStruct configGroupEdit(ConfigurationManager::GroupType::CONFIGURATION_TYPE,
4286 unsigned int artdaqSupervisorRow = TableView::INVALID;
4293 bool needArtdaqSupervisorParents =
true;
4294 bool needArtdaqSupervisorCreation =
false;
4296 __COUTV__(artdaqContext);
4301 const std::string& activeContextGroupName =
4302 cfgMgr->getActiveGroupName(ConfigurationManager::GroupType::CONTEXT_TYPE);
4304 cfgMgr->getActiveGroupKey(ConfigurationManager::GroupType::CONTEXT_TYPE);
4305 const std::string& activeConfigGroupName = cfgMgr->getActiveGroupName(
4306 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
4307 const TableGroupKey& activeConfigGroupKey = cfgMgr->getActiveGroupKey(
4308 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
4310 __COUTV__(activeContextGroupName);
4311 __COUTV__(activeContextGroupKey);
4312 __COUTV__(activeConfigGroupName);
4313 __COUTV__(activeConfigGroupKey);
4314 __COUTV__(cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4315 .
getNode(artdaqContext->contextUID_)
4318 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4319 .
getNode(artdaqContext->contextUID_)
4320 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4323 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4324 .
getNode(artdaqContext->contextUID_)
4325 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4326 .
getNode(artdaqContext->applications_[0].applicationUID_)
4328 __COUTV__(artdaqContext->applications_[0].applicationUID_);
4329 __COUTV__(XDAQContextTable::colApplication_.colLinkToSupervisorTable_);
4331 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4332 .
getNode(artdaqContext->contextUID_)
4333 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4334 .
getNode(artdaqContext->applications_[0].applicationUID_)
4335 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_)
4339 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4340 .
getNode(artdaqContext->contextUID_)
4341 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4342 .
getNode(artdaqContext->applications_[0].applicationUID_)
4343 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_);
4348 needArtdaqSupervisorCreation =
true;
4350 artdaqSupervisorRow = artdaqSupervisorNode.
getRow();
4352 needArtdaqSupervisorParents =
false;
4356 needArtdaqSupervisorCreation =
true;
4358 __COUTV__(needArtdaqSupervisorCreation);
4361 if(!artdaqContext || needArtdaqSupervisorCreation)
4363 __COUT__ <<
"No artdaq Supervisor found! Creating..." << __E__;
4364 __COUTV__(needArtdaqSupervisorParents);
4366 std::string artdaqSupervisorUID;
4375 ARTDAQ_SUPERVISOR_TABLE,
true );
4379 std::stringstream ss;
4380 artdaqSupervisorTable.tableView_->print(ss);
4381 __COUT_MULTI__(0, ss.str());
4385 row = artdaqSupervisorTable.tableView_->
addRow(
4386 author,
true ,
"artdaqSupervisor");
4389 artdaqSupervisorUID =
4390 artdaqSupervisorTable.tableView_
4391 ->getDataView()[row][artdaqSupervisorTable.tableView_->
getColUID()];
4392 artdaqSupervisorRow = row;
4394 __COUTV__(artdaqSupervisorRow);
4395 __COUTV__(artdaqSupervisorUID);
4401 artdaqSupervisorTable.tableView_->
findCol(
4402 colARTDAQSupervisor_.colDAQInterfaceDebugLevel_));
4405 "${MRB_BUILDDIR}/../setup_ots.sh",
4407 artdaqSupervisorTable.tableView_->
findCol(
4408 colARTDAQSupervisor_.colDAQSetupScript_));
4412 ARTDAQ_READER_TABLE,
4414 artdaqSupervisorTable.tableView_->
findCol(
4415 colARTDAQSupervisor_.colLinkToBoardReaders_));
4419 artdaqSupervisorTable.tableView_->
findCol(
4420 colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
4421 artdaqSupervisorUID +
4425 ARTDAQ_BUILDER_TABLE,
4427 artdaqSupervisorTable.tableView_->
findCol(
4428 colARTDAQSupervisor_.colLinkToEventBuilders_));
4431 artdaqSupervisorTable.tableView_->
findCol(
4432 colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
4433 artdaqSupervisorUID +
4437 ARTDAQ_LOGGER_TABLE,
4439 artdaqSupervisorTable.tableView_->
findCol(
4440 colARTDAQSupervisor_.colLinkToDataLoggers_));
4443 artdaqSupervisorTable.tableView_->
findCol(
4444 colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
4445 artdaqSupervisorUID +
4449 ARTDAQ_DISPATCHER_TABLE,
4451 artdaqSupervisorTable.tableView_->
findCol(
4452 colARTDAQSupervisor_.colLinkToDispatchers_));
4455 artdaqSupervisorTable.tableView_->
findCol(
4456 colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
4457 artdaqSupervisorUID +
4462 ARTDAQ_ROUTER_TABLE,
4464 artdaqSupervisorTable.tableView_->
findCol(
4465 colARTDAQSupervisor_.colLinkToRoutingManagers_));
4468 artdaqSupervisorTable.tableView_->
findCol(
4469 colARTDAQSupervisor_.colLinkToRoutingManagersGroupID_),
4470 artdaqSupervisorUID +
4475 std::stringstream ss;
4476 artdaqSupervisorTable.tableView_->print(ss);
4477 __COUT_MULTI__(0, ss.str());
4484 ConfigurationManager::GroupType::CONTEXT_TYPE, cfgMgr);
4487 ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME,
true );
4489 ConfigurationManager::XDAQ_APPLICATION_TABLE_NAME,
true );
4491 ConfigurationManager::XDAQ_APP_PROPERTY_TABLE_NAME,
4498 std::string contextUID;
4499 std::string contextAppGroupID;
4501 if(needArtdaqSupervisorParents)
4504 row = contextTable.tableView_->
addRow(
4505 author,
true ,
"artdaqContext");
4511 contextTable.tableView_
4512 ->getDataView()[row][contextTable.tableView_->
getColUID()];
4515 __COUTV__(contextUID);
4519 "http://${HOSTNAME}",
4521 contextTable.tableView_->
findCol(
4522 XDAQContextTable::colContext_.colAddress_));
4525 contextTable.tableView_->
findCol(
4526 XDAQContextTable::colContext_.colPort_),
4532 ConfigurationManager::XDAQ_APPLICATION_TABLE_NAME,
4534 contextTable.tableView_->
findCol(
4535 XDAQContextTable::colContext_.colLinkToApplicationTable_));
4538 contextTable.tableView_->
findCol(
4539 XDAQContextTable::colContext_.colLinkToApplicationGroupID_),
4540 "artdaqContextApps");
4542 __COUTV__(contextAppGroupID);
4546 std::string appPropertiesGroupID;
4552 if(needArtdaqSupervisorParents)
4556 unsigned int c = appTable.tableView_->
findCol(
4557 XDAQContextTable::colApplication_.colClass_);
4558 for(
unsigned int r = 0;
4559 r < appTable.tableView_->getNumberOfRows();
4561 if(appTable.tableView_->getDataView()[r][c] ==
4562 ARTDAQ_SUPERVISOR_CLASS)
4565 <<
"Found partially existing artdaq Supervisor "
4567 << appTable.tableView_->getDataView()
4569 <<
"'... Disabling it." << __E__;
4576 row = appTable.tableView_->
addRow(
4577 author,
true ,
"artdaqSupervisor");
4584 ->getDataView()[row][appTable.tableView_->
getColUID()];
4591 ARTDAQ_SUPERVISOR_CLASS,
4594 XDAQContextTable::colApplication_.colClass_));
4597 "${OTSDAQ_LIB}/libARTDAQSupervisor.so",
4600 XDAQContextTable::colApplication_.colModule_));
4605 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
4606 .colApplicationGroupID_));
4610 ConfigurationManager::XDAQ_APP_PROPERTY_TABLE_NAME,
4612 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
4613 .colLinkToPropertyTable_));
4616 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
4617 .colLinkToPropertyGroupID_),
4618 appUID +
"Properties");
4620 __COUTV__(appPropertiesGroupID);
4624 __COUT__ <<
"Getting row of existing parent supervisor." << __E__;
4628 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4629 .
getNode(artdaqContext->contextUID_)
4630 .
getNode(XDAQContextTable::colContext_
4631 .colLinkToApplicationTable_)
4632 .
getNode(artdaqContext->applications_[0].applicationUID_)
4641 ARTDAQ_SUPERVISOR_TABLE,
4644 XDAQContextTable::colApplication_.colLinkToSupervisorTable_));
4646 artdaqSupervisorUID,
4649 XDAQContextTable::colApplication_.colLinkToSupervisorUID_));
4654 if(needArtdaqSupervisorParents)
4658 const std::vector<std::string> propertyUIDs = {
"Partition0",
4661 "BoardReaderTimeout",
4662 "EventBuilderTimeout",
4663 "DataLoggerTimeout",
4664 "DispatcherTimeout"};
4665 const std::vector<std::string> propertyNames = {
4667 "productsdir_for_bash_scripts",
4668 "max_fragment_size_bytes",
4669 "boardreader_timeout",
4670 "eventbuilder_timeout",
4671 "datalogger_timeout",
4672 "dispatcher_timeout"
4674 const std::vector<std::string> propertyValues = {
4684 for(
unsigned int i = 0; i < propertyNames.size(); ++i)
4687 row = appPropertyTable.tableView_->
addRow(
4690 appUID + propertyUIDs[i]);
4693 "1", row, appPropertyTable.tableView_->
getColStatus());
4697 "ots::SupervisorProperty",
4699 appPropertyTable.tableView_->
findCol(
4700 XDAQContextTable::colAppProperty_.colPropertyType_));
4705 appPropertyTable.tableView_->
findCol(
4706 XDAQContextTable::colAppProperty_.colPropertyName_));
4711 appPropertyTable.tableView_->
findCol(
4712 XDAQContextTable::colAppProperty_.colPropertyValue_));
4715 appPropertiesGroupID,
4717 appPropertyTable.tableView_->
findCol(
4718 XDAQContextTable::colAppProperty_.colPropertyGroupID_));
4723 std::stringstream ss;
4724 contextTable.tableView_->print(ss);
4725 __COUT_MULTI__(0, ss.str());
4728 std::stringstream ss;
4729 appTable.tableView_->print(ss);
4730 __COUT_MULTI__(0, ss.str());
4733 std::stringstream ss;
4734 appPropertyTable.tableView_->print(ss);
4735 __COUT_MULTI__(0, ss.str());
4738 contextTable.tableView_
4740 appTable.tableView_->
init();
4741 appPropertyTable.tableView_
4747 <<
"Table errors while creating ARTDAQ Supervisor. Erasing all newly "
4748 "created table versions."
4753 __COUT_INFO__ <<
"Edits complete for new artdaq Supervisor! Created '"
4754 << appUID <<
"'" << __E__;
4758 __SS__ <<
"DEBUG blocking artdaq supervisor save!" << __E__;
4762 contextGroupEdit.saveChanges(contextGroupEdit.originalGroupName_,
4774 artdaqSupervisorRow =
4775 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4776 .
getNode(artdaqContext->contextUID_)
4777 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4778 .
getNode(artdaqContext->applications_[0].applicationUID_)
4779 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_)
4783 __COUT__ <<
"------------------------- artdaq nodes to save:" << __E__;
4784 for(
auto& subsystemPair : subsystemObjectMap)
4786 __COUTV__(subsystemPair.first);
4790 for(
auto& nodeTypePair : nodeTypeToObjectMap)
4792 __COUTV__(nodeTypePair.first);
4794 for(
auto& nodePair : nodeTypePair.second)
4796 __COUTV__(nodePair.first);
4800 __COUT__ <<
"------------------------- end artdaq nodes to save." << __E__;
4804 __COUTV__(artdaqSupervisorRow);
4805 if(artdaqSupervisorRow >= TableView::INVALID)
4807 __SS__ <<
"Invalid artdaq Supervisor row " << artdaqSupervisorRow <<
" found!"
4822 ARTDAQ_SUPERVISOR_TABLE,
true );
4826 std::string artdaqSupervisorUID =
4827 artdaqSupervisorTable.tableView_
4828 ->getDataView()[artdaqSupervisorRow]
4829 [artdaqSupervisorTable.tableView_->
getColUID()];
4832 if(artdaqSupervisorTable.tableView_
4833 ->getDataView()[artdaqSupervisorRow]
4834 [artdaqSupervisorTable.tableView_->
findCol(
4835 colARTDAQSupervisor_.colLinkToBoardReaders_)] ==
4836 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4838 __COUT__ <<
"Fixing missing link to Readers" << __E__;
4840 ARTDAQ_READER_TABLE,
4841 artdaqSupervisorRow,
4842 artdaqSupervisorTable.tableView_->
findCol(
4843 colARTDAQSupervisor_.colLinkToBoardReaders_));
4845 artdaqSupervisorRow,
4846 artdaqSupervisorTable.tableView_->
findCol(
4847 colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
4848 artdaqSupervisorUID +
4853 if(artdaqSupervisorTable.tableView_
4854 ->getDataView()[artdaqSupervisorRow]
4855 [artdaqSupervisorTable.tableView_->
findCol(
4856 colARTDAQSupervisor_.colLinkToEventBuilders_)] ==
4857 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4859 __COUT__ <<
"Fixing missing link to Builders" << __E__;
4861 ARTDAQ_BUILDER_TABLE,
4862 artdaqSupervisorRow,
4863 artdaqSupervisorTable.tableView_->
findCol(
4864 colARTDAQSupervisor_.colLinkToEventBuilders_));
4866 artdaqSupervisorRow,
4867 artdaqSupervisorTable.tableView_->
findCol(
4868 colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
4869 artdaqSupervisorUID +
4874 if(artdaqSupervisorTable.tableView_
4875 ->getDataView()[artdaqSupervisorRow]
4876 [artdaqSupervisorTable.tableView_->
findCol(
4877 colARTDAQSupervisor_.colLinkToDataLoggers_)] ==
4878 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4880 __COUT__ <<
"Fixing missing link to Loggers" << __E__;
4882 ARTDAQ_LOGGER_TABLE,
4883 artdaqSupervisorRow,
4884 artdaqSupervisorTable.tableView_->
findCol(
4885 colARTDAQSupervisor_.colLinkToDataLoggers_));
4887 artdaqSupervisorRow,
4888 artdaqSupervisorTable.tableView_->
findCol(
4889 colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
4890 artdaqSupervisorUID +
4895 if(artdaqSupervisorTable.tableView_
4896 ->getDataView()[artdaqSupervisorRow]
4897 [artdaqSupervisorTable.tableView_->
findCol(
4898 colARTDAQSupervisor_.colLinkToDispatchers_)] ==
4899 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4901 __COUT__ <<
"Fixing missing link to Dispatchers" << __E__;
4903 ARTDAQ_DISPATCHER_TABLE,
4904 artdaqSupervisorRow,
4905 artdaqSupervisorTable.tableView_->
findCol(
4906 colARTDAQSupervisor_.colLinkToDispatchers_));
4908 artdaqSupervisorRow,
4909 artdaqSupervisorTable.tableView_->
findCol(
4910 colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
4911 artdaqSupervisorUID +
4916 if(artdaqSupervisorTable.tableView_
4917 ->getDataView()[artdaqSupervisorRow]
4918 [artdaqSupervisorTable.tableView_->
findCol(
4919 colARTDAQSupervisor_.colLinkToRoutingManagers_)] ==
4920 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4922 __COUT__ <<
"Fixing missing link to Routers" << __E__;
4924 ARTDAQ_ROUTER_TABLE,
4925 artdaqSupervisorRow,
4926 artdaqSupervisorTable.tableView_->
findCol(
4927 colARTDAQSupervisor_.colLinkToRoutingManagers_));
4929 artdaqSupervisorRow,
4930 artdaqSupervisorTable.tableView_->
findCol(
4931 colARTDAQSupervisor_.colLinkToRoutingManagersGroupID_),
4932 artdaqSupervisorUID +
4937 std::stringstream ss;
4938 artdaqSupervisorTable.tableView_->print(ss);
4939 __COUT_MULTI__(0, ss.str());
4945 ARTDAQ_SUBSYSTEM_TABLE,
true );
4948 artdaqSubsystemTable.tableView_->deleteAllRows();
4950 for(
auto& subsystemPair : subsystemObjectMap)
4952 __COUTV__(subsystemPair.first);
4953 __COUTV__(subsystemPair.second);
4956 row = artdaqSubsystemTable.tableView_->
addRow(
4957 author,
true , subsystemPair.first);
4959 if(subsystemPair.second !=
"" &&
4960 subsystemPair.second != TableViewColumnInfo::DATATYPE_STRING_DEFAULT &&
4961 subsystemPair.second != NULL_SUBSYSTEM_DESTINATION_LABEL)
4965 ARTDAQ_SUBSYSTEM_TABLE,
4967 artdaqSubsystemTable.tableView_->
findCol(
4968 colARTDAQSubsystem_.colLinkToDestination_));
4970 subsystemPair.second,
4972 artdaqSubsystemTable.tableView_->
findCol(
4973 colARTDAQSubsystem_.colLinkToDestinationUID_));
4980 for(
auto& nodeTypePair : nodeTypeToObjectMap)
4982 __COUTV__(nodeTypePair.first);
4986 auto it =
processTypes_.mapToTable_.find(nodeTypePair.first);
4989 __SS__ <<
"Invalid artdaq node type '" << nodeTypePair.first
4990 <<
"' attempted!" << __E__;
4993 __COUTV__(it->second);
5003 if(nodeTypePair.second.size())
5006 __COUT__ <<
"Ignoring missing table '" << it->second
5007 <<
"' since there were no user records attempted of type '"
5008 << nodeTypePair.first <<
".'" << __E__;
5015 bool hasArtProcessName =
false;
5016 unsigned int artProcessNameCol = -1;
5020 __COUT__ <<
"Identified non-Reader, no-Router type '"
5021 << nodeTypePair.first
5022 <<
"' that has an art link and thus Process Name, so creating "
5023 "table edit structure to ART table."
5026 ARTDAQTableBase::ARTDAQ_ART_TABLE,
true );
5029 std::stringstream ss;
5030 artTable->tableView_->print(ss);
5031 __COUT_MULTI__(1, ss.str());
5033 artProcessNameCol = artTable->tableView_->
findCol(
5034 ARTDAQTableBase::colARTDAQArt_.colProcessName_);
5035 __COUTTV__(artProcessNameCol);
5037 hasArtProcessName =
true;
5039 __COUTV__(hasArtProcessName);
5041 const unsigned int commentCol =
5042 typeTable.tableView_->
findColByType(TableViewColumnInfo::TYPE_COMMENT);
5043 const unsigned int authorCol =
5044 typeTable.tableView_->
findColByType(TableViewColumnInfo::TYPE_AUTHOR);
5045 const unsigned int timestampCol =
5046 typeTable.tableView_->
findColByType(TableViewColumnInfo::TYPE_TIMESTAMP);
5049 std::map<
unsigned int ,
bool > deleteRecordMap;
5050 unsigned int maxRowToDelete = typeTable.tableView_->getNumberOfRows();
5051 for(
unsigned int r = 0; r < typeTable.tableView_->getNumberOfRows(); ++r)
5052 deleteRecordMap.emplace(std::make_pair(
5055 __COUTTV__(maxRowToDelete);
5061 const unsigned int ORIG_MAP_ART_PROC_NAME_COL = -1;
5062 std::map<std::string ,
5063 std::map<
unsigned int , std::string >>
5064 originalMultinodeValues;
5065 std::map<std::string ,
5066 std::map<
unsigned int ,
5069 originalMultinodeSameSiblingValues;
5072 std::map<
unsigned int ,
5074 std::vector<std::string >>>>
5075 originalMultinodeAllSiblingEmbeddedName;
5078 std::map<
unsigned int ,
5080 std::vector<std::string >>>>
5081 originalMultinodeAllSiblingEmbeddedPrinterIndex;
5084 for(
auto& nodePair : nodeTypePair.second)
5086 __COUTV__(nodePair.first);
5089 std::vector<std::string> nodeIndices, hostnameIndices;
5090 unsigned int hostnameFixedWidth = 0, nodeNameFixedWidth = 0;
5091 std::string hostname;
5098 for(
unsigned int i = 0; i < nodePair.second.size(); ++i)
5100 __COUTV__(nodePair.second[i]);
5104 std::string nodeName;
5110 if(nodePair.second[i][0] ==
':')
5112 __COUT__ <<
"Handling original multi-node." << __E__;
5117 std::string lastOriginalName;
5118 std::vector<std::string> originalParameterArr =
5120 &(nodePair.second[i].c_str()[1]),
5123 if(originalParameterArr.size() != 3)
5125 __SS__ <<
"Illegal original name parameter string '"
5126 << nodePair.second[i] <<
"!'" << __E__;
5132 unsigned int fixedWidth;
5133 sscanf(originalParameterArr[0].c_str(),
"%u", &fixedWidth);
5134 __COUTV__(fixedWidth);
5136 std::vector<std::string> printerSyntaxArr =
5141 std::vector<std::string> originalNodeIndices;
5142 for(
auto& printerSyntaxValue : printerSyntaxArr)
5144 __COUTV__(printerSyntaxValue);
5146 std::vector<std::string> printerSyntaxRange =
5148 printerSyntaxValue, {
'-'} );
5150 if(printerSyntaxRange.size() == 0 ||
5151 printerSyntaxRange.size() > 2)
5153 __SS__ <<
"Illegal multi-node printer syntax string '"
5154 << printerSyntaxValue <<
"!'" << __E__;
5157 else if(printerSyntaxRange.size() == 1)
5159 __COUTV__(printerSyntaxRange[0]);
5160 originalNodeIndices.push_back(printerSyntaxRange[0]);
5164 unsigned int lo, hi;
5165 sscanf(printerSyntaxRange[0].c_str(),
"%u", &lo);
5166 sscanf(printerSyntaxRange[1].c_str(),
"%u", &hi);
5170 sscanf(printerSyntaxRange[0].c_str(),
"%u", &hi);
5172 for(; lo <= hi; ++lo)
5175 originalNodeIndices.push_back(std::to_string(lo));
5180 __COUTTV__(originalParameterArr[2]);
5182 originalParameterArr[2] = originalParameterArr[2].substr(
5183 0, originalParameterArr[2].find(
";status="));
5184 __COUTV__(originalParameterArr[2]);
5185 std::vector<std::string> originalNamePieces =
5190 if(originalNamePieces.size() < 2)
5192 __SS__ <<
"Illegal original multi-node name template - "
5193 "please use * to indicate where the multi-node "
5194 "index should be inserted!"
5201 std::stringstream ss;
5202 typeTable.tableView_->print(ss);
5203 __COUT_MULTI__(1, ss.str());
5208 <<
"originalMultinodeSameSiblingValues init col map for "
5209 << nodePair.first << __E__;
5210 originalMultinodeSameSiblingValues.emplace(std::make_pair(
5216 __COUT__ <<
"originalMultinodeAllSiblingEmbeddedName init "
5218 << nodePair.first << __E__;
5219 originalMultinodeAllSiblingEmbeddedName.emplace(std::make_pair(
5228 __COUT__ <<
"originalMultinodeAllSiblingEmbeddedPrinterIndex "
5230 << nodePair.first << __E__;
5231 originalMultinodeAllSiblingEmbeddedPrinterIndex.emplace(
5244 unsigned int originalRow = TableView::INVALID,
5245 lastOriginalRow = TableView::INVALID,
5246 lastArtProcessRow = TableView::INVALID;
5247 for(
unsigned int i = 0; i < originalNodeIndices.size(); ++i)
5249 std::string originalName = originalNamePieces[0];
5250 std::string nodeNameIndex;
5251 for(
unsigned int p = 1; p < originalNamePieces.size();
5254 nodeNameIndex = originalNodeIndices[i];
5257 if(nodeNameIndex.size() > fixedWidth)
5259 __SS__ <<
"Illegal original node name index '"
5261 <<
"' - length is longer than fixed "
5262 "width requirement of "
5263 << fixedWidth <<
"!" << __E__;
5268 while(nodeNameIndex.size() < fixedWidth)
5269 nodeNameIndex =
"0" + nodeNameIndex;
5272 originalName += nodeNameIndex + originalNamePieces[p];
5274 __COUTTV__(originalName);
5275 originalRow = typeTable.tableView_->
findRow(
5280 __COUTTV__(originalRow);
5284 auto result = originalMultinodeValues.emplace(
5285 std::make_pair(originalName,
5286 std::map<
unsigned int ,
5290 <<
"originalName '" << originalName
5291 <<
"' already in original multinode value cache."
5295 __COUT__ <<
"Saving multinode value " << originalName
5296 <<
"[" << originalRow
5297 <<
"][*] with row count = "
5298 << typeTable.tableView_->getNumberOfRows()
5302 for(
unsigned int col = 0;
5303 col < typeTable.tableView_->getNumberOfColumns();
5306 if(typeTable.tableView_->getColumnInfo(col)
5309 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK ||
5310 typeTable.tableView_->getColumnInfo(col)
5313 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID ||
5314 typeTable.tableView_->getColumnInfo(col)
5317 ARTDAQ_TYPE_TABLE_HOSTNAME ||
5318 typeTable.tableView_->getColumnInfo(col)
5321 typeTable.tableView_->getColumnInfo(col)
5323 col == timestampCol ||
5330 <<
"Caching node value: " << originalName
5331 <<
"[" << originalRow <<
"][" << col
5333 << typeTable.tableView_
5334 ->getColumnInfo(col)
5337 << typeTable.tableView_
5338 ->getDataView()[originalRow][col]
5340 originalMultinodeValues.at(originalName)
5341 .emplace(std::make_pair(
5343 typeTable.tableView_
5344 ->getDataView()[originalRow]
5349 for(
const auto& pair :
5350 originalMultinodeSameSiblingValues)
5351 __COUTT__ <<
"originalMultinodeSameSiblin"
5353 << pair.first <<
"]" << __E__;
5355 originalMultinodeSameSiblingValues
5357 .emplace(std::make_pair(
5362 typeTable.tableView_
5364 [originalRow][col])));
5366 for(
const auto& pair :
5367 originalMultinodeAllSiblingEmbeddedName)
5368 __COUTT__ <<
"originalMultinodeAllSibling"
5370 << pair.first <<
"]" << __E__;
5371 originalMultinodeAllSiblingEmbeddedName
5373 .emplace(std::make_pair(
5376 typeTable.tableView_
5379 .find(originalName) !=
5382 std::vector<std::string>())));
5384 for(
const auto& pair :
5385 originalMultinodeAllSiblingEmbeddedPrinterIndex)
5386 __COUTT__ <<
"originalMultinodeAllSibling"
5387 "EmbeddedPrinterIndex["
5388 << pair.first <<
"]" << __E__;
5389 originalMultinodeAllSiblingEmbeddedPrinterIndex
5391 .emplace(std::make_pair(
5394 typeTable.tableView_
5397 .find(nodeNameIndex) !=
5400 std::vector<std::string>())));
5406 originalMultinodeSameSiblingValues
5412 originalMultinodeAllSiblingEmbeddedName
5416 if(originalMultinodeAllSiblingEmbeddedName
5422 <<
"Determine string splits for "
5425 const std::string& val =
5426 typeTable.tableView_
5427 ->getDataView()[originalRow]
5429 size_t pos = val.find(originalName);
5430 originalMultinodeAllSiblingEmbeddedName
5434 val.substr(0, pos));
5435 originalMultinodeAllSiblingEmbeddedName
5438 .second.push_back(val.substr(
5439 pos + originalName.size()));
5441 originalMultinodeAllSiblingEmbeddedName
5447 originalMultinodeAllSiblingEmbeddedPrinterIndex
5451 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5456 __COUTT__ <<
"Determine string "
5457 "splits for embedded "
5458 "printer syntax index: "
5459 << nodeNameIndex << __E__;
5460 const std::string& val =
5461 typeTable.tableView_
5462 ->getDataView()[originalRow]
5464 size_t pos = val.find(nodeNameIndex);
5465 originalMultinodeAllSiblingEmbeddedPrinterIndex
5469 val.substr(0, pos));
5470 originalMultinodeAllSiblingEmbeddedPrinterIndex
5473 .second.push_back(val.substr(
5474 pos + nodeNameIndex.size()));
5476 originalMultinodeAllSiblingEmbeddedPrinterIndex
5484 if(originalMultinodeSameSiblingValues
5489 __COUTT__ <<
"Checking sibling same "
5491 << nodePair.first << __E__;
5492 if(typeTable.tableView_
5493 ->getDataView()[originalRow]
5495 typeTable.tableView_->getDataView()
5496 [lastOriginalRow][col])
5499 <<
"Found different sibling "
5502 << nodePair.first << __E__;
5503 originalMultinodeSameSiblingValues
5509 if(originalMultinodeAllSiblingEmbeddedName
5514 __COUTT__ <<
"Checking sibling "
5515 "embedded name... for "
5516 << nodePair.first <<
":"
5517 << originalName << __E__;
5518 if(typeTable.tableView_
5519 ->getDataView()[originalRow]
5521 .find(originalName) ==
5524 __COUT__ <<
"Found no embedded "
5526 << col <<
" looking for "
5527 << originalName << __E__;
5528 originalMultinodeAllSiblingEmbeddedName
5534 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5540 <<
"Checking sibling embedded "
5541 "printer syntax index... for "
5542 << nodePair.first <<
":"
5543 << nodeNameIndex << __E__;
5544 if(typeTable.tableView_
5545 ->getDataView()[originalRow]
5547 .find(nodeNameIndex) ==
5550 __COUT__ <<
"Found no embedded "
5553 << col <<
" looking for "
5556 originalMultinodeAllSiblingEmbeddedPrinterIndex
5565 <<
"originalMultinodeSameSiblingValues["
5566 << nodePair.first <<
"][" << col <<
"] = "
5567 << originalMultinodeSameSiblingValues
5573 <<
"originalMultinodeAllSiblingEmbeddedNa"
5575 << nodePair.first <<
"][" << col <<
"] = "
5576 << originalMultinodeAllSiblingEmbeddedName
5582 <<
"originalMultinodeAllSiblingEmbeddedPr"
5584 << nodePair.first <<
"][" << col <<
"] = "
5585 << originalMultinodeAllSiblingEmbeddedPrinterIndex
5591 if(hasArtProcessName && artTable &&
5592 typeTable.tableView_->getColumnInfo(col)
5594 ARTDAQTableBase::colARTDAQNotReader_
5599 <<
"Checking ART Process Name... for "
5601 << originalName <<
"' / "
5602 << typeTable.tableView_
5603 ->getDataView()[originalRow]
5606 unsigned int artRow =
5607 artTable->tableView_->
findRow(
5610 typeTable.tableView_
5611 ->getDataView()[originalRow]
5616 <<
"Found ART Process Name = "
5617 << artTable->tableView_->getDataView()
5618 [artRow][artProcessNameCol]
5622 originalMultinodeValues.at(originalName)
5623 .emplace(std::make_pair(
5624 ORIG_MAP_ART_PROC_NAME_COL,
5625 artTable->tableView_
5628 [artProcessNameCol]));
5630 originalMultinodeValues
5632 .at(ORIG_MAP_ART_PROC_NAME_COL));
5635 originalMultinodeSameSiblingValues
5637 .emplace(std::make_pair(
5638 ORIG_MAP_ART_PROC_NAME_COL,
5642 artTable->tableView_
5645 [artProcessNameCol])));
5646 originalMultinodeAllSiblingEmbeddedName
5648 .emplace(std::make_pair(
5649 ORIG_MAP_ART_PROC_NAME_COL,
5651 artTable->tableView_
5655 .find(originalName) !=
5658 std::vector<std::string>())));
5659 originalMultinodeAllSiblingEmbeddedPrinterIndex
5661 .emplace(std::make_pair(
5662 ORIG_MAP_ART_PROC_NAME_COL,
5664 artTable->tableView_
5672 std::vector<std::string>())));
5678 originalMultinodeSameSiblingValues
5680 .at(ORIG_MAP_ART_PROC_NAME_COL)
5684 originalMultinodeAllSiblingEmbeddedName
5686 .at(ORIG_MAP_ART_PROC_NAME_COL)
5688 if(originalMultinodeAllSiblingEmbeddedName
5690 .at(ORIG_MAP_ART_PROC_NAME_COL)
5694 <<
"Determine string splits "
5697 const std::string& val =
5698 artTable->tableView_
5701 [artProcessNameCol];
5703 val.find(originalName);
5704 originalMultinodeAllSiblingEmbeddedName
5706 .at(ORIG_MAP_ART_PROC_NAME_COL)
5708 val.substr(0, pos));
5709 originalMultinodeAllSiblingEmbeddedName
5711 .at(ORIG_MAP_ART_PROC_NAME_COL)
5712 .second.push_back(val.substr(
5714 originalName.size()));
5716 originalMultinodeAllSiblingEmbeddedName
5718 .at(ORIG_MAP_ART_PROC_NAME_COL)
5722 originalMultinodeAllSiblingEmbeddedPrinterIndex
5724 .at(ORIG_MAP_ART_PROC_NAME_COL)
5726 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5728 .at(ORIG_MAP_ART_PROC_NAME_COL)
5732 <<
"Determine string splits "
5733 "for embedded printer "
5735 << nodeNameIndex << __E__;
5736 const std::string& val =
5737 artTable->tableView_
5740 [artProcessNameCol];
5742 val.find(nodeNameIndex);
5743 originalMultinodeAllSiblingEmbeddedPrinterIndex
5745 .at(ORIG_MAP_ART_PROC_NAME_COL)
5747 val.substr(0, pos));
5748 originalMultinodeAllSiblingEmbeddedPrinterIndex
5750 .at(ORIG_MAP_ART_PROC_NAME_COL)
5751 .second.push_back(val.substr(
5753 nodeNameIndex.size()));
5755 originalMultinodeAllSiblingEmbeddedPrinterIndex
5757 .at(ORIG_MAP_ART_PROC_NAME_COL)
5763 if(originalMultinodeSameSiblingValues
5765 .at(ORIG_MAP_ART_PROC_NAME_COL)
5768 __COUTT__ <<
"Checking sibling "
5769 "same values... for "
5772 if(artTable->tableView_
5775 [artProcessNameCol] !=
5776 artTable->tableView_
5779 [artProcessNameCol])
5782 <<
"Found different "
5784 "at artProcessNameCol="
5785 << artProcessNameCol
5789 originalMultinodeSameSiblingValues
5791 .at(ORIG_MAP_ART_PROC_NAME_COL)
5795 if(originalMultinodeAllSiblingEmbeddedName
5797 .at(ORIG_MAP_ART_PROC_NAME_COL)
5801 <<
"Checking sibling "
5802 "embedded name... for "
5803 << nodePair.first <<
":"
5804 << originalName << __E__;
5805 if(artTable->tableView_
5809 .find(originalName) ==
5813 <<
"Found no embedded "
5815 "artProcessNameCol="
5816 << artProcessNameCol
5818 << originalName << __E__;
5819 originalMultinodeAllSiblingEmbeddedName
5821 .at(ORIG_MAP_ART_PROC_NAME_COL)
5825 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5827 .at(ORIG_MAP_ART_PROC_NAME_COL)
5831 <<
"Checking sibling "
5832 "embedded printer syntax "
5834 << nodePair.first <<
":"
5835 << nodeNameIndex << __E__;
5836 if(artTable->tableView_
5840 .find(nodeNameIndex) ==
5844 <<
"Found no embedded "
5845 "printer syntax index "
5846 "at artProcessNameCol="
5847 << artProcessNameCol
5849 << nodeNameIndex << __E__;
5850 originalMultinodeAllSiblingEmbeddedPrinterIndex
5852 .at(ORIG_MAP_ART_PROC_NAME_COL)
5859 <<
"originalMultinodeSameSiblingValue"
5861 << nodePair.first <<
"]["
5862 << ORIG_MAP_ART_PROC_NAME_COL
5864 << originalMultinodeSameSiblingValues
5866 .at(ORIG_MAP_ART_PROC_NAME_COL)
5870 <<
"originalMultinodeAllSiblingEmbedd"
5872 << nodePair.first <<
"]["
5873 << ORIG_MAP_ART_PROC_NAME_COL
5875 << originalMultinodeAllSiblingEmbeddedName
5877 .at(ORIG_MAP_ART_PROC_NAME_COL)
5881 <<
"originalMultinodeAllSiblingEmbedd"
5883 << nodePair.first <<
"]["
5884 << ORIG_MAP_ART_PROC_NAME_COL
5886 << originalMultinodeAllSiblingEmbeddedPrinterIndex
5888 .at(ORIG_MAP_ART_PROC_NAME_COL)
5893 <<
"Checking ART Process Name "
5894 "complete for originalName='"
5895 << originalName <<
"' / "
5896 << typeTable.tableView_
5897 ->getDataView()[originalRow]
5911 lastOriginalRow = originalRow;
5913 __COUTTV__(lastOriginalRow);
5914 lastOriginalName = originalName;
5917 for(
const auto& pair :
5918 originalMultinodeSameSiblingValues.at(nodePair.first))
5919 __COUTT__ <<
"originalMultinodeSameSiblingValues["
5920 << nodePair.first <<
"][" << pair.first
5921 <<
"] = " << pair.second.first << __E__;
5922 for(
const auto& pair :
5923 originalMultinodeAllSiblingEmbeddedName.at(
5925 __COUTT__ <<
"originalMultinodeAllSiblingEmbeddedName["
5926 << nodePair.first <<
"][" << pair.first
5927 <<
"] = " << pair.second.first << __E__;
5928 for(
const auto& pair :
5929 originalMultinodeAllSiblingEmbeddedPrinterIndex.at(
5932 <<
"originalMultinodeAllSiblingEmbeddedPrinterIndex["
5933 << nodePair.first <<
"][" << pair.first
5934 <<
"] = " << pair.second.first << __E__;
5936 __COUTTV__(lastOriginalRow);
5937 row = lastOriginalRow;
5942 std::string originalName = nodePair.second[i].substr(
5943 0, nodePair.second[i].find(
";status="));
5944 __COUTV__(originalName);
5947 row = typeTable.tableView_->
findRow(
5957 nodeName = nodePair.first;
5958 __COUTV__(nodeName);
5960 nodeName = nodeName.substr(0, nodeName.find(
";status="));
5963 std::string tmpNodeName = nodeName;
5965 for(
size_t c = 0; c < tmpNodeName.size(); ++c)
5966 if(tmpNodeName[c] !=
'*')
5967 nodeName += tmpNodeName[c];
5970 __COUTV__(nodeName);
5971 if(row == TableView::INVALID)
5974 row = typeTable.tableView_->
addRow(
5975 author,
true , nodeName);
5980 __COUT__ <<
"Handling new " << nodeTypePair.first
5981 <<
" defaults!" << __E__;
5984 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
5989 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
5991 typeTable.tableView_->
findCol(
5992 ARTDAQTableBase::colARTDAQReader_
5993 .colLinkToDaqParameters_));
5994 std::string daqParameterGroupID =
5997 typeTable.tableView_->
findCol(
5998 ARTDAQTableBase::colARTDAQReader_
5999 .colLinkToDaqParametersGroupID_),
6000 nodeName +
"DaqParameters");
6003 std::stringstream ss;
6004 typeTable.tableView_->print(ss);
6005 __COUT_MULTI__(1, ss.str());
6009 const std::vector<std::string> parameterUIDs = {
6010 "BoardID",
"FragmentID"};
6012 const std::vector<std::string> parameterNames = {
6016 const std::vector<std::string> parameterValues = {
6021 unsigned int parameterRow;
6022 for(
unsigned int i = 0; i < parameterNames.size(); ++i)
6025 parameterRow = daqParameterTable.tableView_->
addRow(
6028 nodeName + parameterUIDs[i]);
6039 daqParameterTable.tableView_->
findCol(
6040 ARTDAQTableBase::colARTDAQDaqParameter_
6041 .colDaqParameterKey_));
6046 daqParameterTable.tableView_->
findCol(
6047 ARTDAQTableBase::colARTDAQDaqParameter_
6048 .colDaqParameterValue_));
6051 daqParameterGroupID,
6053 daqParameterTable.tableView_->
findCol(
6054 ARTDAQTableBase::colARTDAQDaqParameter_
6055 .colDaqParameterGroupID_));
6059 daqParameterTable.tableView_
6067 __COUT__ <<
"Handling new " << nodeTypePair.first
6068 <<
" defaults!" << __E__;
6073 ARTDAQTableBase::ARTDAQ_DAQ_TABLE,
6076 unsigned int daqRecordRow = daqTable.tableView_->
addRow(
6080 std::string daqRecordUID =
6082 ->getDataView()[daqRecordRow]
6087 ARTDAQTableBase::ARTDAQ_DAQ_TABLE,
6089 typeTable.tableView_->
findCol(
6090 ARTDAQTableBase::colARTDAQNotReader_
6095 typeTable.tableView_->
findCol(
6096 ARTDAQTableBase::colARTDAQNotReader_
6097 .colLinkToDaqUID_));
6101 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
6105 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
6108 ARTDAQTableBase::colARTDAQDaq_
6109 .colLinkToDaqParameters_));
6110 std::string daqParameterGroupID =
6114 ARTDAQTableBase::colARTDAQDaq_
6115 .colLinkToDaqParametersGroupID_),
6116 nodeName +
"DaqParameters");
6119 const std::vector<std::string> parameterUIDs = {
6120 "BufferCount",
"FragmentsPerEvent"};
6122 const std::vector<std::string> parameterNames = {
6124 "expected_fragments_per_event"
6126 const std::vector<std::string> parameterValues = {
6131 unsigned int parameterRow;
6132 for(
unsigned int i = 0; i < parameterNames.size(); ++i)
6135 parameterRow = daqParameterTable.tableView_->
addRow(
6138 nodeName + parameterUIDs[i]);
6149 daqParameterTable.tableView_->
findCol(
6150 ARTDAQTableBase::colARTDAQDaqParameter_
6151 .colDaqParameterKey_));
6156 daqParameterTable.tableView_->
findCol(
6157 ARTDAQTableBase::colARTDAQDaqParameter_
6158 .colDaqParameterValue_));
6161 daqParameterGroupID,
6163 daqParameterTable.tableView_->
findCol(
6164 ARTDAQTableBase::colARTDAQDaqParameter_
6165 .colDaqParameterGroupID_));
6171 daqParameterTable.tableView_
6179 <<
"Reusing row " << row <<
" current-UID="
6180 << typeTable.tableView_
6181 ->getDataView()[row]
6183 <<
" as (temporarily to basename if multinode) new-UID="
6184 << nodeName << __E__;
6185 typeTable.tableView_
6194 if(row < maxRowToDelete)
6195 deleteRecordMap[row] =
false;
6202 artdaqSupervisorTable.tableView_
6203 ->getDataView()[artdaqSupervisorRow]
6204 [artdaqSupervisorTable.tableView_->
findCol(
6206 .at(nodeTypePair.first))],
6208 typeTable.tableView_->
findCol(
6210 nodeTypePair.first)));
6223 hostname = nodePair.second[i];
6227 typeTable.tableView_->
findCol(ARTDAQ_TYPE_TABLE_HOSTNAME));
6232 if(nodePair.second[i] !=
"" &&
6233 nodePair.second[i] !=
6234 TableViewColumnInfo::DATATYPE_STRING_DEFAULT)
6237 if(subsystemObjectMap.find(nodePair.second[i]) ==
6238 subsystemObjectMap.end())
6240 __SS__ <<
"Illegal subsystem '" << nodePair.second[i]
6241 <<
"' mismatch!" << __E__;
6246 ARTDAQ_SUBSYSTEM_TABLE,
6248 typeTable.tableView_->
findCol(
6249 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK));
6253 typeTable.tableView_->
findCol(
6254 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID));
6259 TableViewColumnInfo::DATATYPE_LINK_DEFAULT,
6261 typeTable.tableView_->
findCol(
6262 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK));
6266 i == 4 || i == 5 || i == 6 ||
6273 __COUT__ <<
"Handling printer syntax i=" << i << __E__;
6275 std::vector<std::string> printerSyntaxArr =
6279 if(printerSyntaxArr.size() == 2)
6281 if(printerSyntaxArr[0] ==
6284 sscanf(printerSyntaxArr[1].c_str(),
6286 &nodeNameFixedWidth);
6287 __COUTV__(nodeNameFixedWidth);
6290 else if(printerSyntaxArr[0] ==
6293 sscanf(printerSyntaxArr[1].c_str(),
6295 &hostnameFixedWidth);
6296 __COUTV__(hostnameFixedWidth);
6302 for(
auto& printerSyntaxValue : printerSyntaxArr)
6304 __COUTV__(printerSyntaxValue);
6306 std::vector<std::string> printerSyntaxRange =
6309 if(printerSyntaxRange.size() == 0 ||
6310 printerSyntaxRange.size() > 2)
6312 __SS__ <<
"Illegal multi-node printer syntax string '"
6313 << printerSyntaxValue <<
"!'" << __E__;
6316 else if(printerSyntaxRange.size() == 1)
6319 __COUTV__(printerSyntaxRange[0]);
6324 nodeIndices.push_back(printerSyntaxRange[0]);
6326 hostnameIndices.push_back(printerSyntaxRange[0]);
6330 unsigned int lo, hi;
6331 sscanf(printerSyntaxRange[0].c_str(),
"%u", &lo);
6332 sscanf(printerSyntaxRange[1].c_str(),
"%u", &hi);
6336 sscanf(printerSyntaxRange[0].c_str(),
"%u", &hi);
6338 for(; lo <= hi; ++lo)
6342 nodeIndices.push_back(std::to_string(lo));
6344 hostnameIndices.push_back(std::to_string(lo));
6351 __SS__ <<
"Unexpected parameter[" << i <<
" '"
6352 << nodePair.second[i] <<
"' for node " << nodePair.first
6358 __COUTV__(nodeIndices.size());
6359 __COUTV__(hostnameIndices.size());
6361 if(hostnameIndices.size())
6363 if(hostnameIndices.size() != nodeIndices.size())
6365 __SS__ <<
"Illegal associated hostname array has count "
6366 << hostnameIndices.size()
6367 <<
" which is not equal to the node count "
6368 << nodeIndices.size() <<
"!" << __E__;
6373 if(nodeIndices.size())
6375 unsigned int hostnameCol =
6376 typeTable.tableView_->
findCol(ARTDAQ_TYPE_TABLE_HOSTNAME);
6381 std::vector<std::string> namePieces =
6383 nodePair.first.substr(0, nodePair.first.find(
";status=")),
6387 if(namePieces.size() < 2)
6390 <<
"Illegal multi-node name template - please use * to "
6391 "indicate where the multi-node index should be inserted!"
6396 std::vector<std::string> hostnamePieces;
6397 if(hostnameIndices.size())
6403 if(hostnamePieces.size() < 2)
6406 <<
"Illegal hostname array template - please use * to "
6407 "indicate where the hostname index should be inserted!"
6413 bool isFirst =
true;
6414 unsigned int lastArtRow = TableView::INVALID;
6415 for(
unsigned int i = 0; i < nodeIndices.size(); ++i)
6417 std::string name = namePieces[0];
6418 std::string nodeNameIndex;
6419 for(
unsigned int p = 1; p < namePieces.size(); ++p)
6421 nodeNameIndex = nodeIndices[i];
6422 if(nodeNameFixedWidth > 1)
6424 if(nodeNameIndex.size() > nodeNameFixedWidth)
6426 __SS__ <<
"Illegal node name index '" << nodeNameIndex
6427 <<
"' - length is longer than fixed width "
6429 << nodeNameFixedWidth <<
"!" << __E__;
6434 while(nodeNameIndex.size() < nodeNameFixedWidth)
6435 nodeNameIndex =
"0" + nodeNameIndex;
6438 name += nodeNameIndex + namePieces[p];
6442 if(hostnamePieces.size())
6444 hostname = hostnamePieces[0];
6445 std::string hostnameIndex;
6446 for(
unsigned int p = 1; p < hostnamePieces.size(); ++p)
6448 hostnameIndex = hostnameIndices[i];
6449 if(hostnameFixedWidth > 1)
6451 if(hostnameIndex.size() > hostnameFixedWidth)
6453 __SS__ <<
"Illegal hostname index '"
6455 <<
"' - length is longer than fixed width "
6457 << hostnameFixedWidth <<
"!" << __E__;
6462 while(hostnameIndex.size() < hostnameFixedWidth)
6463 hostnameIndex =
"0" + hostnameIndex;
6466 hostname += hostnameIndex + hostnamePieces[p];
6468 __COUTV__(hostname);
6475 << author <<
"... Replacing row UID '"
6476 << typeTable.tableView_
6477 ->getDataView()[row]
6479 <<
"' with UID '" << name <<
"'" << __E__;
6482 if(row < maxRowToDelete)
6483 deleteRecordMap[row] =
false;
6488 << author <<
"... Copying row UID '"
6489 << typeTable.tableView_
6490 ->getDataView()[row]
6492 <<
"' to UID '" << name <<
"'" << __E__;
6493 unsigned int copyRow = typeTable.tableView_->
copyRows(
6495 *(typeTable.tableView_),
6502 if(row < maxRowToDelete)
6503 deleteRecordMap[copyRow] =
false;
6508 name, row, typeTable.tableView_->
getColUID());
6510 hostname, row, hostnameCol);
6513 TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT,
6517 typeTable.tableView_->
setValue(time(0), row, timestampCol);
6519 __COUTTV__(typeTable
6521 ->getDataView()[row][commentCol]);
6522 __COUTTV__(typeTable
6524 ->getDataView()[row][authorCol]);
6525 __COUTTV__(typeTable
6527 ->getDataView()[row][timestampCol]);
6537 <<
"Looking for best original node match for row=" << row
6538 <<
" UID='" << name <<
"'" << __E__;
6539 size_t bestScore = 0;
6540 std::string bestOriginalNodeName;
6541 for(
const auto& originalNodePair : originalMultinodeValues)
6543 if(originalNodePair.second.find(
6544 ORIG_MAP_ART_PROC_NAME_COL) !=
6545 originalNodePair.second.end())
6546 __COUTTV__(originalNodePair.second.at(
6547 ORIG_MAP_ART_PROC_NAME_COL));
6549 for(
size_t c = 0, d = 0;
6550 c < originalNodePair.first.size() && d < name.size();
6553 if(name[d] == originalNodePair.first[c])
6555 else if(d + 1 < name.size() &&
6556 name[d + 1] == originalNodePair.first[c])
6558 else if(c + 1 < originalNodePair.first.size() &&
6559 name[d] == originalNodePair.first[c + 1])
6562 if(originalNodePair.first.size() == name.size())
6564 __COUTVS__(2, score);
6565 if(score > bestScore)
6567 bestOriginalNodeName = originalNodePair.first;
6569 __COUTVS__(2, bestOriginalNodeName);
6570 __COUTVS__(2, bestScore);
6574 bool exactMatch = (bestOriginalNodeName == name);
6575 bool needToHandleArtProcessName =
false;
6576 std::string artProcessName;
6579 originalMultinodeValues.find(bestOriginalNodeName) !=
6580 originalMultinodeValues.end())
6582 __COUT__ <<
"Populating original multinode value from '"
6583 << bestOriginalNodeName <<
"' into '" << name
6586 for(
const auto& valuePair :
6587 originalMultinodeValues.at(bestOriginalNodeName))
6590 if(!exactMatch && (valuePair.first == commentCol ||
6591 valuePair.first == authorCol ||
6592 valuePair.first == timestampCol))
6595 <<
"Not exact node name match, so keeping "
6596 "default meta info for node: "
6597 << name <<
"[" << row <<
"]["
6599 <<
"] /= " << valuePair.second <<
" keep= "
6600 << typeTable.tableView_
6601 ->getDataView()[row][valuePair.first]
6606 __COUTT__ <<
"Customizing node: " << name <<
"["
6607 << row <<
"][" << valuePair.first
6608 <<
"] = " << valuePair.second << __E__;
6610 if(valuePair.first == ORIG_MAP_ART_PROC_NAME_COL)
6612 __COUTT__ <<
"NEED Special art Process Name "
6614 << valuePair.second << __E__;
6615 needToHandleArtProcessName =
true;
6616 artProcessName = valuePair.second;
6619 valuePair.second, row, artProcessNameCol);
6623 valuePair.second, row, valuePair.first);
6627 __COUT__ <<
"Did not find '" << name
6628 <<
"' in original value cache. Looking for "
6629 "bestOriginalNodeName="
6630 << bestOriginalNodeName << __E__;
6632 __COUTV__(exactMatch);
6635 if(originalMultinodeSameSiblingValues.find(
6637 originalMultinodeSameSiblingValues.end())
6639 __COUT__ <<
"Applying multinode sibling same value "
6641 << row <<
" UID='" << name <<
"'" << __E__;
6642 for(
const auto& sameValuePair :
6643 originalMultinodeSameSiblingValues.at(
6646 if(!sameValuePair.second.first)
6649 <<
"Found originalMultinodeSameSiblingValues["
6650 << nodePair.first <<
"]["
6651 << sameValuePair.first <<
"] = "
6652 << sameValuePair.second.first <<
" --> "
6653 << sameValuePair.second.second << __E__;
6656 if(sameValuePair.first ==
6657 ORIG_MAP_ART_PROC_NAME_COL)
6659 __COUTT__ <<
"NEED Special art Process Name "
6661 << sameValuePair.second.second
6663 needToHandleArtProcessName =
true;
6664 artProcessName = sameValuePair.second.second;
6667 sameValuePair.second.second,
6673 sameValuePair.second.second,
6675 sameValuePair.first);
6680 if(originalMultinodeAllSiblingEmbeddedPrinterIndex.find(
6682 originalMultinodeAllSiblingEmbeddedPrinterIndex.end())
6684 __COUT__ <<
"Applying multinode sibling embbeded "
6685 "printer syntax index rules for row="
6686 << row <<
" UID='" << name
6687 <<
"' and printer index='" << nodeNameIndex
6689 for(
const auto& embedValuePair :
6690 originalMultinodeAllSiblingEmbeddedPrinterIndex
6691 .at(nodePair.first))
6693 if(!embedValuePair.second.first ||
6694 embedValuePair.second.second.size() < 2)
6698 "originalMultinodeAllSiblingEmbeddedPrinte"
6700 << nodePair.first <<
"]["
6701 << embedValuePair.first <<
"] = "
6702 << embedValuePair.second.first <<
" --> "
6704 embedValuePair.second.second)
6706 std::string embedValue =
6708 embedValuePair.second.second,
6710 __COUTTV__(embedValue);
6713 if(embedValuePair.first ==
6714 ORIG_MAP_ART_PROC_NAME_COL)
6716 __COUTT__ <<
"NEED Special art Process Name "
6718 << embedValue << __E__;
6719 needToHandleArtProcessName =
true;
6720 artProcessName = embedValue;
6723 embedValue, row, artProcessNameCol);
6727 embedValue, row, embedValuePair.first);
6731 if(originalMultinodeAllSiblingEmbeddedName.find(
6733 originalMultinodeAllSiblingEmbeddedName.end())
6735 __COUT__ <<
"Applying multinode sibling embbeded "
6736 "name rules for row="
6737 << row <<
" UID='" << name <<
"'" << __E__;
6738 for(
const auto& embedValuePair :
6739 originalMultinodeAllSiblingEmbeddedName.at(
6742 if(!embedValuePair.second.first ||
6743 embedValuePair.second.second.size() < 2)
6747 "originalMultinodeAllSiblingEmbeddedName["
6748 << nodePair.first <<
"]["
6749 << embedValuePair.first <<
"] = "
6750 << embedValuePair.second.first <<
" --> "
6752 embedValuePair.second.second)
6754 std::string embedValue =
6756 embedValuePair.second.second, name);
6757 __COUTTV__(embedValue);
6760 if(embedValuePair.first ==
6761 ORIG_MAP_ART_PROC_NAME_COL)
6763 __COUTT__ <<
"NEED Special art Process Name "
6765 << embedValue << __E__;
6766 needToHandleArtProcessName =
true;
6767 artProcessName = embedValue;
6770 embedValue, row, artProcessNameCol);
6774 embedValue, row, embedValuePair.first);
6778 __COUTV__(needToHandleArtProcessName);
6779 if(needToHandleArtProcessName)
6781 __COUTT__ <<
"Special art Process Name column value: "
6782 << artProcessName << __E__;
6784 std::string artRecord =
6785 typeTable.tableView_->getDataView()
6786 [row][typeTable.tableView_->
findCol(
6787 ARTDAQTableBase::colARTDAQNotReader_
6788 .colLinkToArtUID_)];
6789 __COUTTV__(artRecord);
6791 const unsigned int artCommentCol =
6793 TableViewColumnInfo::TYPE_COMMENT);
6794 const unsigned int artAuthorCol =
6796 TableViewColumnInfo::TYPE_AUTHOR);
6797 const unsigned int artTimestampCol =
6799 TableViewColumnInfo::TYPE_TIMESTAMP);
6801 unsigned int artRow = artTable->tableView_->
findRow(
6807 if(artRow == TableView::INVALID)
6809 __COUTT__ <<
"Need to make art Process record... "
6811 << artRecord << __E__;
6815 __COUTTV__(bestOriginalNodeName);
6816 const unsigned int bestMatchRow =
6817 typeTable.tableView_->
findRow(
6819 bestOriginalNodeName);
6820 __COUTTV__(bestMatchRow);
6822 std::string bestMatchArtRecord =
6823 typeTable.tableView_->getDataView()
6825 [typeTable.tableView_->
findCol(
6828 .colLinkToArtUID_)];
6829 __COUTTV__(bestMatchArtRecord);
6831 unsigned int bestMatchArtRow =
6832 artTable->tableView_->
findRow(
6837 __COUTTV__(bestMatchArtRow);
6838 if(bestMatchArtRow !=
6843 __COUTTV__(lastArtRow);
6846 if(lastArtRow != TableView::INVALID)
6848 __COUTT__ <<
"Copying art Process record... "
6850 << lastArtRow << __E__;
6851 unsigned int copyRow =
6854 *(artTable->tableView_),
6868 DATATYPE_COMMENT_DEFAULT,
6872 author, artRow, artAuthorCol);
6874 time(0), artRow, artTimestampCol);
6878 __COUTT__ <<
"Creating art Process record... "
6880 << artRecord << __E__;
6882 artRow = artTable->tableView_->
addRow(
6888 <<
"Made art Process record... artRecord="
6889 << artRecord << __E__;
6892 __COUTT__ <<
"Modify art Process record based on "
6893 "sibling rules... artRecord="
6895 <<
" artProcessName=" << artProcessName
6899 artProcessName, artRow, artProcessNameCol);
6900 lastArtRow = artRow;
6904 needToHandleArtProcessName)
6906 std::string artRecord =
6907 typeTable.tableView_->getDataView()
6908 [row][typeTable.tableView_->
findCol(
6909 ARTDAQTableBase::colARTDAQNotReader_
6910 .colLinkToArtUID_)];
6911 __COUTTV__(artRecord);
6912 unsigned int artRow = artTable->tableView_->
findRow(
6920 lastArtRow = artRow;
6923 __COUTTV__(lastArtRow);
6928 if(row < maxRowToDelete)
6929 __COUTTV__(deleteRecordMap[row]);
6931 __COUTTV__(typeTable
6933 ->getDataView()[row][commentCol]);
6934 __COUTTV__(typeTable
6936 ->getDataView()[row][authorCol]);
6937 __COUTTV__(typeTable
6939 ->getDataView()[row][timestampCol]);
6949 __COUT__ <<
"Deleting '" << nodeTypePair.first
6950 <<
"' records not specified..." << __E__;
6953 std::set<unsigned int> orderedRowSet;
6954 for(
auto& deletePair : deleteRecordMap)
6956 if(!deletePair.second)
6958 __COUTT__ <<
"Row keep = " << deletePair.first << __E__;
6962 __COUTT__ <<
"Row delete = " << deletePair.first << __E__;
6963 orderedRowSet.emplace(deletePair.first);
6967 for(std::set<unsigned int>::reverse_iterator rit = orderedRowSet.rbegin();
6968 rit != orderedRowSet.rend();
6974 if(TTEST(1) && artTable)
6976 std::stringstream ss;
6977 artTable->tableView_->print(ss);
6978 __COUT_MULTI__(1, ss.str());
6981 if(hasArtProcessName && artTable)
6982 artTable->tableView_
6987 std::stringstream ss;
6988 typeTable.tableView_->print(ss);
6989 __COUT_MULTI__(1, ss.str());
6992 typeTable.tableView_->
init();
6999 std::stringstream ss;
7000 artdaqSupervisorTable.tableView_->print(ss);
7001 __COUT_MULTI__(1, ss.str());
7004 std::stringstream ss;
7005 artdaqSubsystemTable.tableView_->print(ss);
7006 __COUT_MULTI__(1, ss.str());
7010 artdaqSupervisorTable.tableView_
7012 artdaqSubsystemTable.tableView_
7017 __COUT__ <<
"Table errors while creating ARTDAQ nodes. Erasing all newly "
7018 "created table versions."
7023 __COUT__ <<
"Edits complete for artdaq nodes and subsystems.. now save and activate "
7024 "groups, and update aliases!"
7030 __SS__ <<
"DEBUG blocking save!" << __E__;
7034 std::string localAccumulatedWarnings;
7035 configGroupEdit.saveChanges(configGroupEdit.originalGroupName_,
7036 newConfigurationGroupKey,
7043 &localAccumulatedWarnings);
7059 void ARTDAQTableBase::addCommentWhitespace(std::ostream& os,
size_t lineLength)
7061 for(
size_t i = 0;
true; i += 20)
7063 if(lineLength < FCL_COMMENT_POSITION + i)
7065 os << std::string(FCL_COMMENT_POSITION + i - lineLength,
' ');
<virtual so future plugins can inherit from multiple table base classes
static void outputDataReceiverFHICL(const ConfigurationTree &receiverNode, ARTDAQAppType appType, size_t maxFragmentSizeBytes=DEFAULT_MAX_FRAGMENT_SIZE, size_t routingTimeoutMs=DEFAULT_ROUTING_TIMEOUT_MS, size_t routingRetryCount=DEFAULT_ROUTING_RETRY_COUNT, std::string *returnFcl=nullptr)
static void insertArtProcessBlock(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree art, ConfigurationTree subsystemLink=ConfigurationTree(), size_t routingTimeoutMs=DEFAULT_ROUTING_TIMEOUT_MS, size_t routingRetryCount=DEFAULT_ROUTING_RETRY_COUNT)
static const std::string ARTDAQ_FCL_PATH
Tree-path rule is, if the last link in the path is a group link with a specified group ID,...
static std::string insertModuleType(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree moduleTypeNode)
static bool isARTDAQEnabled(const ConfigurationManager *cfgMgr)
isARTDAQEnabled
static void insertParameters(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree parameterLink, const std::string ¶meterPreamble, bool onlyInsertAtTableParameters=false, bool includeAtTableParameters=false)
static void setAndActivateARTDAQSystem(ConfigurationManagerRW *cfgMgr, const std::map< std::string, std::map< std::string, std::vector< std::string >>> &nodeTypeToObjectMap, const std::map< std::string, std::string > &subsystemObjectMap)
static struct ots::ARTDAQTableBase::ProcessTypes processTypes_
Note!!!! processTypes_ must be instantiate after the static artdaq table names (to construct map in c...
static void outputOnlineMonitorFHICL(const ConfigurationTree &onlineMonitorNode)
static const ARTDAQInfo & getARTDAQSystem(ConfigurationManagerRW *cfgMgr, std::map< std::string, std::map< std::string, std::vector< std::string >>> &nodeTypeToObjectMap, std::map< std::string, std::string > &subsystemObjectMap, std::vector< std::string > &artdaqSupervisoInfo)
static void insertMetricsBlock(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree daqNode)
insertMetricsBlock
const std::string & getUsername(void) const
Getters.
ConfigurationTree getNode(const std::string &nodeString, bool doNotThrowOnBrokenUIDLinks=false) const
"root/parent/parent/"
const unsigned int & getRow(void) const
getRow
bool isDisconnected(void) const
ConfigurationTree getNode(const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
navigating between nodes
const std::string & getTableName(void) const
getTableName
T getValueWithDefault(const T &defaultValue) const
const std::string & getValueAsString(bool returnLinkTableValue=false) const
void getValue(T &value) const
std::vector< std::pair< std::string, ConfigurationTree > > getChildren(std::map< std::string, std::string > filterMap=std::map< std::string, std::string >(), bool byPriority=false, bool onlyStatusTrue=false) const
std::string getParentLinkIndex(void) const
getParentLinkIndex
const std::string & getUIDAsString(void) const
const unsigned int & getNodeRow(void) const
getNodeRow
const std::string & getFieldName(void) const
alias for getValueName
std::string getParentLinkID(void) const
getParentLinkID
const std::string & getParentTableName(void) const
getParentTableName
const std::string & getParentRecordName(void) const
getParentRecordName
const std::string & getParentLinkColumnName(void) const
getParentLinkColumnName
std::string str() const
alternative alias method
bool isUID(void) const
isUID
bool isGroupID(void) const
unsigned int findRow(unsigned int col, const T &value, unsigned int offsetRow=0, bool doNotThrow=false) const
< in included .icc source
void setValueAsString(const std::string &value, unsigned int row, unsigned int col)
unsigned int getColStatus(void) const
unsigned int findColByType(const std::string &type, unsigned int startingCol=0) const
unsigned int copyRows(const std::string &author, const TableView &src, unsigned int srcOffsetRow=0, unsigned int srcRowsToCopy=(unsigned int) -1, unsigned int destOffsetRow=(unsigned int) -1, unsigned char generateUniqueDataColumns=false, const std::string &baseNameAutoUID="")
const std::string & setUniqueColumnValue(unsigned int row, unsigned int col, std::string baseValueAsString="", bool doMathAppendStrategy=false, std::string childLinkIndex="", std::string groupId="")
unsigned int getColUID(void) const
unsigned int findCol(const std::string &name) const
void setValue(const T &value, unsigned int row, unsigned int col)
< in included .icc source
unsigned int addRow(const std::string &author="", unsigned char incrementUniqueData=false, const std::string &baseNameAutoUID="", unsigned int rowToAdd=(unsigned int) -1, std::string childLinkIndex="", std::string groupId="")
const XDAQContext * getTheARTDAQSupervisorContext(void) const
artdaq specific get methods
ARTDAQ DAQ Parameter Column names.
ARTDAQ Builder/Logger/Dispatcher Column names.
ARTDAQ Reader Column names.
ARTDAQ Subsystem Column names.
ARTDAQ Supervisor Column names.
TableEditStruct & getTableEditStruct(const std::string &tableName, bool markModified=false)
Note: if markModified, and table not found in group, this function will try to add it to group.
static std::string getTimestampString(const std::string &linuxTimeInSeconds)
static void getVectorFromString(const std::string &inputString, std::vector< std::string > &listToReturn, const std::set< char > &delimiter={',', '|', '&'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}, std::vector< char > *listOfDelimiters=0, bool decodeURIComponents=false)
static std::string setToString(const std::set< T > &setToReturn, const std::string &delimeter=", ")
setToString ~
static std::string vectorToString(const std::vector< T > &setToReturn, const std::string &delimeter=", ")
vectorToString ~
static bool extractCommonChunks(const std::vector< std::string > &haystack, std::vector< std::string > &commonChunksToReturn, std::vector< std::string > &wildcardStrings, unsigned int &fixedWildcardLength)
static std::string mapToString(const std::map< std::string, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ")
static std::string decodeURIComponent(const std::string &data)
static std::string stackTrace(void)