6 #include "otsdaq-core/ConfigurationInterface/ConfigurationManagerRW.h"
7 #include "otsdaq-core/ConfigurationInterface/ConfigurationInterface.h"
20 void FlattenActiveSystemAliasConfigurationGroups(
int argc,
char* argv[])
22 std::cout <<
"=================================================\n";
23 std::cout <<
"=================================================\n";
24 std::cout <<
"=================================================\n";
25 std::cout << __COUT_HDR_FL__ <<
"\nFlattening Active System Aliases!" << std::endl;
27 std::cout <<
"\n\nusage: Two arguments:\n\t pathToSwapIn <baseFlatVersion> <pathToSwapIn (optional)> \n\n" <<
28 "\t Default values: baseFlatVersion = 0, pathToSwapIn = \"\" \n\n" <<
31 std::cout <<
"\n\nNote: you can optionally just swap databases (and not modify their contents at all)" <<
32 " by providing an invalid baseFlatVersion of -1.\n\n" <<
35 std::cout <<
"\n\nNote: This assumes artdaq db file type interface. " <<
36 "The current database/ will be moved to database_<linuxtime>/ " <<
37 "and if a pathToSwapIn is specified it will be copied to database/ " <<
38 "before saving the currently active groups.\n\n" <<
41 std::cout <<
"argc = " << argc << std::endl;
42 for(
int i = 0; i < argc; i++)
43 std::cout <<
"argv[" << i <<
"] = " << argv[i] << std::endl;
47 std::cout <<
"Must provide at least one parameter.";
52 std::string flatVersionStr = argv[1];
53 if(flatVersionStr.find(
'h') != std::string::npos)
55 std::cout <<
"Recognized parameter 1. as a 'help' option. Usage was printed. Exiting." << std::endl;
60 std::string pathToSwapIn =
"";
62 sscanf(argv[1],
"%d",&flatVersion);
64 pathToSwapIn = argv[2];
66 std::cout << __COUT_HDR_FL__ <<
"flatVersion = " << flatVersion << std::endl;
67 std::cout << __COUT_HDR_FL__ <<
"pathToSwapIn = " << pathToSwapIn << std::endl;
75 setenv(
"CONFIGURATION_TYPE",
"File",1);
76 setenv(
"CONFIGURATION_DATA_PATH",(std::string(getenv(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(),1);
77 setenv(
"CONFIGURATION_INFO_PATH",(std::string(getenv(
"USER_DATA")) +
"/ConfigurationInfo").c_str(),1);
81 setenv(
"SERVICE_DATA_PATH",(std::string(getenv(
"USER_DATA")) +
"/ServiceData").c_str(),1);
85 setenv(
"OTSDAQ_LIB",(std::string(getenv(
"USER_DATA")) +
"/").c_str(),1);
86 setenv(
"OTSDAQ_UTILITIES_LIB",(std::string(getenv(
"USER_DATA")) +
"/").c_str(),1);
89 setenv(
"OTS_MAIN_PORT",
"2015",1);
92 setenv(
"XDAQ_CONFIGURATION_DATA_PATH",(std::string(getenv(
"USER_DATA")) +
"/XDAQConfigurations").c_str(),1);
93 setenv(
"XDAQ_CONFIGURATION_XML",
"otsConfigurationNoRU_CMake",1);
100 std::cout <<
"\n\n\n" << __COUT_HDR_FL__ <<
"Loading active Aliases..." << std::endl;
129 std::map<std::pair<std::string,ConfigurationGroupKey>,
132 std::map<std::pair<std::string,ConfigurationVersion>,
135 ConfigurationGroupKey>> activeGroupKeys;
136 std::map<std::pair<std::string,ConfigurationGroupKey>,
137 std::string> groupErrors;
139 std::string activeBackboneTableName =
"";
140 std::string activeContextTableName =
"";
141 std::string activeConfigTableName =
"";
143 std::string nowTime = std::to_string(time(0));
145 std::string thenTime =
"";
146 if(pathToSwapIn !=
"")
148 thenTime = pathToSwapIn.substr(pathToSwapIn.rfind(
'_')+1);
149 std::cout << __COUT_HDR_FL__<<
"thenTime = " << thenTime << std::endl;
154 std::map<std::string, std::pair<std::string, ConfigurationGroupKey>> activeGroupsMap =
155 cfgMgr->getActiveConfigurationGroups();
157 for(
const auto &activeGroup: activeGroupsMap)
159 groupSet.insert(std::pair<
160 std::pair<std::string,ConfigurationGroupKey>,
161 ConfigurationGroupKey> (
162 std::pair<std::string,ConfigurationGroupKey>(
163 activeGroup.second.first,
164 activeGroup.second.second),
165 ConfigurationGroupKey())
167 activeGroupKeys.insert(std::pair<
169 std::pair<ConfigurationGroupKey,ConfigurationGroupKey>> (
170 activeGroup.second.first,
171 std::pair<ConfigurationGroupKey,ConfigurationGroupKey>(
172 activeGroup.second.second,
173 ConfigurationGroupKey()))
176 if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_BACKBONE)
178 activeBackboneTableName = activeGroup.second.first;
179 std::cout << __COUT_HDR_FL__<<
"found activeBackboneTableName = " <<
180 activeBackboneTableName << std::endl;
182 else if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_CONTEXT)
184 activeContextTableName = activeGroup.second.first;
185 std::cout << __COUT_HDR_FL__<<
"found activeContextTableName = " <<
186 activeContextTableName << std::endl;
188 else if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_CONFIGURATION)
190 activeConfigTableName = activeGroup.second.first;
191 std::cout << __COUT_HDR_FL__<<
"found activeConfigTableName = " <<
192 activeConfigTableName << std::endl;
197 const std::string groupAliasesTableName =
"GroupAliasesConfiguration";
198 std::map<std::string, ConfigurationVersion> activeVersions = cfgMgr->getActiveVersions();
199 if(activeVersions.find(groupAliasesTableName) == activeVersions.end())
201 __SS__ <<
"\nActive version of GroupAliasesConfiguration missing! " <<
202 "GroupAliasesConfiguration is a required member of the Backbone configuration group." <<
203 "\n\nLikely you need to activate a valid Backbone group." <<
205 throw std::runtime_error(ss.str());
209 std::vector<std::pair<std::string,ConfigurationTree> > aliasNodePairs =
210 cfgMgr->getNode(groupAliasesTableName).getChildren();
211 for(
auto& groupPair:aliasNodePairs)
212 groupSet.insert(std::pair<
213 std::pair<std::string,ConfigurationGroupKey>,
214 ConfigurationGroupKey> (
215 std::pair<std::string,ConfigurationGroupKey>(
216 groupPair.second.getNode(
"GroupName").getValueAsString(),
217 ConfigurationGroupKey(groupPair.second.getNode(
"GroupKey").getValueAsString())),
218 ConfigurationGroupKey())
221 std::cout << __COUT_HDR_FL__<<
"Identfied groups:" << std::endl;
222 for(
auto& group:groupSet)
223 std::cout << __COUT_HDR_FL__<< group.first.first <<
" " << group.first.second << std::endl;
224 std::cout << __COUT_HDR_FL__<< std::endl;
225 std::cout << __COUT_HDR_FL__<< std::endl;
230 std::string currentDir = getenv(
"ARTDAQ_DATABASE_URI");
232 if(currentDir.find(
"filesystemdb://") != 0)
233 throw std::runtime_error(
"filesystemdb:// was not found in $ARTDAQ_DATABASE_URI!");
235 currentDir = currentDir.substr(std::string(
"filesystemdb://").length());
236 while(currentDir.length() && currentDir[currentDir.length()-1] ==
'/')
237 currentDir = currentDir.substr(0,currentDir.length()-1);
238 std::string moveToDir = currentDir +
"_" + nowTime;
240 throw std::runtime_error(
"Aborting move! Must at least give version argument to flatten to!");
242 if(pathToSwapIn !=
"")
245 if((dp = opendir(pathToSwapIn.c_str())) == 0)
247 std::cout << __COUT_HDR_FL__<<
"ERROR:(" << errno <<
"). Can't open directory: " << pathToSwapIn << std::endl;
254 std::cout << __COUT_HDR_FL__ <<
"Moving current directory: \t" << currentDir << std::endl;
255 std::cout << __COUT_HDR_FL__ <<
"\t... to: \t\t" << moveToDir << std::endl;
257 rename(currentDir.c_str(),moveToDir.c_str());
259 if(pathToSwapIn !=
"")
261 std::cout << __COUT_HDR_FL__ <<
"Swapping in directory: \t" << pathToSwapIn << std::endl;
262 std::cout << __COUT_HDR_FL__ <<
"\t.. to: \t\t" << currentDir << std::endl;
263 rename(pathToSwapIn.c_str(),currentDir.c_str());
267 std::string activeGroupsFile = ConfigurationManager::ACTIVE_GROUP_FILENAME +
"." + thenTime;
268 FILE *fp = fopen(activeGroupsFile.c_str(),
"r");
271 std::cout << __COUT_HDR_FL__ <<
"Swapping active groups file: \t" <<
272 activeGroupsFile << std::endl;
273 std::cout << __COUT_HDR_FL__ <<
"\t.. to: \t\t" <<
274 ConfigurationManager::ACTIVE_GROUP_FILENAME << std::endl;
275 rename(activeGroupsFile.c_str(),
276 ConfigurationManager::ACTIVE_GROUP_FILENAME.c_str());
289 std::string accumulateErrors =
"";
290 std::map<std::string, ConfigurationVersion> memberMap;
298 " is an invalid or temporary version. Skipping to end!" << std::endl;
303 for(
auto& groupPair:groupSet)
307 std::cout << __COUT_HDR_FL__ <<
"****************************" << std::endl;
308 std::cout << __COUT_HDR_FL__ <<
"Loading members for " <<
309 groupPair.first.first <<
310 "(" << groupPair.first.second <<
")" <<
312 std::cout << __COUT_HDR_FL__ <<
"flatVersion = " << flatVersion << std::endl;
315 if(pathToSwapIn !=
"")
317 std::cout << __COUT_HDR_FL__ <<
"REVERT by Swapping back directory: \t" << currentDir << std::endl;
318 std::cout << __COUT_HDR_FL__ <<
"\t.. to: \t\t" << pathToSwapIn << std::endl;
319 if(rename(currentDir.c_str(),pathToSwapIn.c_str()) < 0)
321 __SS__ <<
"Problem!" << std::endl;
322 throw std::runtime_error(ss.str());
328 std::cout << __COUT_HDR_FL__ <<
"REVERT by Moving directory: \t" << currentDir << std::endl;
329 std::cout << __COUT_HDR_FL__ <<
"\t.. to temporary directory: \t\t" << (moveToDir+
"_tmp") << std::endl;
330 if(rename(currentDir.c_str(),(moveToDir+
"_tmp").c_str()) < 0)
332 __SS__ <<
"Problem!" << std::endl;
333 throw std::runtime_error(ss.str());
338 std::cout << __COUT_HDR_FL__ <<
"REVERT by Moving directory: \t" << moveToDir << std::endl;
339 std::cout << __COUT_HDR_FL__ <<
"\t... to: \t\t" << currentDir << std::endl;
340 if(rename(moveToDir.c_str(),currentDir.c_str()) < 0)
342 __SS__ <<
"Problem!" << std::endl;
343 throw std::runtime_error(ss.str());
352 cfgMgr->loadConfigurationGroup(
353 groupPair.first.first,
354 groupPair.first.second,
355 true,0,&accumulateErrors);
357 catch(std::runtime_error& e)
360 std::cout << __COUT_HDR_FL__ <<
"Error was caught loading members for " <<
361 groupPair.first.first <<
362 "(" << groupPair.first.second <<
")" <<
364 std::cout << __COUT_HDR_FL__ << e.what() << std::endl;
369 std::cout << __COUT_HDR_FL__ <<
"Error was caught loading members for " <<
370 groupPair.first.first <<
371 "(" << groupPair.first.second <<
")" <<
382 std::cout << __COUT_HDR_FL__ <<
"Moving current directory: \t" << currentDir << std::endl;
383 std::cout << __COUT_HDR_FL__ <<
"\t... to: \t\t" << moveToDir << std::endl;
384 if(rename(currentDir.c_str(),moveToDir.c_str()) < 0)
386 __SS__ <<
"Problem!" << std::endl;
387 throw std::runtime_error(ss.str());
390 if(pathToSwapIn !=
"")
392 std::cout << __COUT_HDR_FL__ <<
"Swapping in directory: \t" << pathToSwapIn << std::endl;
393 std::cout << __COUT_HDR_FL__ <<
"\t.. to: \t\t" << currentDir << std::endl;
394 if(rename(pathToSwapIn.c_str(),currentDir.c_str()) < 0)
396 __SS__ <<
"Problem!" << std::endl;
397 throw std::runtime_error(ss.str());
402 std::cout << __COUT_HDR_FL__ <<
"Moving temporary directory: \t" << (moveToDir+
"_tmp") << std::endl;
403 std::cout << __COUT_HDR_FL__ <<
"\t.. to current directory: \t\t" << currentDir << std::endl;
404 if(rename((moveToDir+
"_tmp").c_str(),currentDir.c_str()) < 0)
406 __SS__ <<
"Problem!" << std::endl;
407 throw std::runtime_error(ss.str());
420 groupErrors.insert(std::pair<
421 std::pair<std::string,ConfigurationGroupKey>,
423 std::pair<std::string,ConfigurationGroupKey>(
424 groupPair.first.first,
425 groupPair.first.second),
426 "Error caught loading the group."));
438 for(
auto &memberPair:memberMap)
440 std::cout << __COUT_HDR_FL__ << memberPair.first <<
":v" << memberPair.second << std::endl;
444 if(modifiedTables.find(std::pair<std::string,ConfigurationVersion>(
447 )) != modifiedTables.end())
450 std::cout << __COUT_HDR_FL__ <<
"Table was already modified!" << std::endl;
451 memberPair.second = modifiedTables[std::pair<std::string,ConfigurationVersion>(
455 std::cout << __COUT_HDR_FL__ <<
"\t to...\t" <<
456 memberPair.first <<
":v" << memberPair.second << std::endl;
461 config = cfgMgr->getConfigurationByName(memberPair.first);
462 cfgView = config->getViewP();
464 theInterface_->saveActiveVersion(config);
467 cfgView->setVersion(memberPair.second);
469 memberPair.second = flatVersion;
471 std::cout << __COUT_HDR_FL__ <<
"\t to...\t" <<
472 memberPair.first <<
":v" << memberPair.second << std::endl;
475 modifiedTables.insert(std::pair<
476 std::pair<std::string,ConfigurationVersion>,
478 std::pair<std::string,ConfigurationVersion>(
486 theInterface_->saveConfigurationGroup(memberMap,
487 ConfigurationGroupKey::getFullGroupString(
488 groupPair.first.first,
489 ConfigurationGroupKey(flatVersion)));
492 groupPair.second = ConfigurationGroupKey(flatVersion);
495 if(activeGroupKeys.find(groupPair.first.first) != activeGroupKeys.end() &&
496 activeGroupKeys[groupPair.first.first].first == groupPair.first.second)
497 activeGroupKeys[groupPair.first.first].second =
498 ConfigurationGroupKey(flatVersion);
500 catch(std::runtime_error& e)
502 std::cout << __COUT_HDR_FL__ <<
"Error was caught saving group " <<
503 groupPair.first.first <<
504 " (" << groupPair.first.second <<
") " <<
506 std::cout << __COUT_HDR_FL__ << e.what() << std::endl;
508 groupErrors.insert(std::pair<
509 std::pair<std::string,ConfigurationGroupKey>,
511 std::pair<std::string,ConfigurationGroupKey>(
512 groupPair.first.first,
513 groupPair.first.second),
514 "Error caught saving the group."));
518 std::cout << __COUT_HDR_FL__ <<
"Error was caught saving group " <<
519 groupPair.first.first <<
520 " (" << groupPair.first.second <<
") " <<
523 groupErrors.insert(std::pair<
524 std::pair<std::string,ConfigurationGroupKey>,
526 std::pair<std::string,ConfigurationGroupKey>(
527 groupPair.first.first,
528 groupPair.first.second),
529 "Error caught saving the group."));
541 FILE *fp = fopen((moveToDir +
"/README_otsdaq_flatten.txt").c_str(),
"a");
543 std::cout << __COUT_HDR_FL__ <<
"\tError opening README file!" << std::endl;
547 struct tm * timeinfo;
551 timeinfo = localtime (&rawtime);
552 strftime (buffer,200,
"%b %d, %Y %I:%M%p %Z",timeinfo);
554 fprintf(fp,
"This database was moved from...\n\t %s \nto...\n\t %s \nat this time \n\t %lu \t %s\n\n\n",
555 currentDir.c_str(),moveToDir.c_str(),time(0),buffer);
564 FILE *fp = fopen((currentDir +
"/README_otsdaq_flatten.txt").c_str(),
"a");
567 std::cout << __COUT_HDR_FL__ <<
"\tError opening README file!" << std::endl;
571 struct tm * timeinfo;
575 timeinfo = localtime (&rawtime);
576 strftime (buffer,200,
"%b %d, %Y %I:%M:%S%p %Z",timeinfo);
578 fprintf(fp,
"This database was moved from...\t %s \t to...\t %s at this time \t %lu \t %s\n\n",
579 pathToSwapIn.c_str(),currentDir.c_str(),time(0),buffer);
612 if(activeBackboneTableName ==
"")
614 std::cout << __COUT_HDR_FL__ <<
"No active Backbone table identified." << std::endl;
618 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
619 "Modifying the active Backbone table to reflect new table versions and group keys." <<
624 cfgMgr->loadConfigurationGroup(
625 activeBackboneTableName,
626 activeGroupKeys[activeBackboneTableName].second,
627 true,0,&accumulateErrors);
632 const std::string groupAliasesName =
"GroupAliasesConfiguration";
633 const std::string versionAliasesName =
"VersionAliasesConfiguration";
636 std::map<std::string, ConfigurationVersion> activeMap = cfgMgr->getActiveVersions();
639 if(activeMap.find(groupAliasesName) != activeMap.end())
641 std::cout << __COUT_HDR_FL__ <<
"\n\nModifying " << groupAliasesName << std::endl;
642 config = cfgMgr->getConfigurationByName(groupAliasesName);
643 cfgView = config->getViewP();
645 unsigned int col1 = cfgView->findCol(
"GroupName");
646 unsigned int col2 = cfgView->findCol(
"GroupKey");
652 for(
unsigned int row = 0; row<cfgView->getNumberOfRows(); ++row )
655 for(
const auto &group: groupSet)
656 if(group.second.isInvalid())
continue;
657 else if(cfgView->getDataView()[row][col1] == group.first.first &&
658 cfgView->getDataView()[row][col2] == group.first.second.toString())
661 std::cout << __COUT_HDR_FL__ <<
662 "Changing row " << row <<
" for " <<
663 cfgView->getDataView()[row][col1] <<
" key=" <<
664 cfgView->getDataView()[row][col2] <<
" to NEW key=" <<
665 group.second << std::endl;
667 group.second.toString(),
674 cfgView->deleteRow(row--);
680 if(activeMap.find(versionAliasesName) != activeMap.end())
682 std::cout << __COUT_HDR_FL__ <<
"\n\nModifying " << versionAliasesName << std::endl;
683 config = cfgMgr->getConfigurationByName(versionAliasesName);
684 cfgView = config->getViewP();
685 unsigned int col1 = cfgView->findCol(
"ConfigurationName");
686 unsigned int col2 = cfgView->findCol(
"Version");
690 for(
unsigned int row = 0; row<cfgView->getNumberOfRows(); ++row )
693 for(
const auto &table:modifiedTables)
694 if(cfgView->getDataView()[row][col1] == table.first.first &&
695 cfgView->getDataView()[row][col2] == table.first.second.toString())
698 std::cout << __COUT_HDR_FL__ <<
"Changing row " << row <<
" for " <<
699 cfgView->getDataView()[row][col1] <<
" version=" <<
700 cfgView->getDataView()[row][col2] <<
" to NEW version=" <<
701 table.second << std::endl;
702 cfgView->setValue(table.second.toString(),row,col2);
708 cfgView->deleteRow(row--);
716 std::cout << __COUT_HDR_FL__ << groupAliasesName <<
":v" <<
717 memberMap[groupAliasesName] << std::endl;
719 config = cfgMgr->getConfigurationByName(groupAliasesName);
720 cfgView = config->getViewP();
722 theInterface_->saveActiveVersion(config);
724 memberMap[groupAliasesName] = flatVersion;
726 std::cout << __COUT_HDR_FL__ <<
"\t to...\t" <<
727 groupAliasesName <<
":v" << memberMap[groupAliasesName] << std::endl;
731 std::cout << __COUT_HDR_FL__ << versionAliasesName <<
":v" <<
732 memberMap[versionAliasesName] << std::endl;
734 config = cfgMgr->getConfigurationByName(versionAliasesName);
735 cfgView = config->getViewP();
737 theInterface_->saveActiveVersion(config);
739 memberMap[versionAliasesName] = flatVersion;
741 std::cout << __COUT_HDR_FL__ <<
"\t to...\t" <<
742 versionAliasesName <<
":v" << memberMap[versionAliasesName] << std::endl;
745 theInterface_->saveConfigurationGroup(memberMap,
746 ConfigurationGroupKey::getFullGroupString(
747 activeBackboneTableName,
748 ConfigurationGroupKey(flatVersion)));
750 activeGroupKeys[activeBackboneTableName].second =
751 ConfigurationGroupKey(flatVersion);
753 std::cout << __COUT_HDR_FL__ <<
"New to-be-active backbone group " << activeBackboneTableName <<
754 ":v" << activeGroupKeys[activeBackboneTableName].second << std::endl;
764 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Manipulating the Active Groups file..." << std::endl;
767 FILE *fp = fopen(ConfigurationManager::ACTIVE_GROUP_FILENAME.c_str(),
"r");
770 __SS__ <<
"Original active groups file '" << ConfigurationManager::ACTIVE_GROUP_FILENAME
771 <<
"' not found." << std::endl;
775 std::cout << __COUT_HDR_FL__ <<
"Backing up file: " << ConfigurationManager::ACTIVE_GROUP_FILENAME
780 std::string renameFile = ConfigurationManager::ACTIVE_GROUP_FILENAME +
"." + nowTime;
781 rename(ConfigurationManager::ACTIVE_GROUP_FILENAME.c_str(),
784 std::cout << __COUT_HDR_FL__ <<
"Backup file name: " << renameFile
787 ConfigurationGroupKey *theConfigurationGroupKey_, *theContextGroupKey_, *theBackboneGroupKey_;
788 std::string theConfigurationGroup_, theContextGroup_, theBackboneGroup_;
790 theConfigurationGroup_ = activeConfigTableName;
791 theConfigurationGroupKey_ = &(activeGroupKeys[activeConfigTableName].second);
793 theContextGroup_ = activeContextTableName;
794 theContextGroupKey_ = &(activeGroupKeys[activeContextTableName].second);
796 theBackboneGroup_ = activeBackboneTableName;
797 theBackboneGroupKey_ = &(activeGroupKeys[activeBackboneTableName].second);
802 std::cout << __COUT_HDR_FL__ <<
"Updating persistent active groups to " <<
803 ConfigurationManager::ACTIVE_GROUP_FILENAME <<
" ..." << std::endl;
805 std::string fn = ConfigurationManager::ACTIVE_GROUP_FILENAME;
806 FILE *fp = fopen(fn.c_str(),
"w");
809 fprintf(fp,
"%s\n",theContextGroup_.c_str());
810 fprintf(fp,
"%s\n",theContextGroupKey_?theContextGroupKey_->toString().c_str():
"-1");
811 fprintf(fp,
"%s\n",theBackboneGroup_.c_str());
812 fprintf(fp,
"%s\n",theBackboneGroupKey_?theBackboneGroupKey_->toString().c_str():
"-1");
813 fprintf(fp,
"%s\n",theConfigurationGroup_.c_str());
814 fprintf(fp,
"%s\n",theConfigurationGroupKey_?theConfigurationGroupKey_->toString().c_str():
"-1");
821 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Groups:" << std::endl;
822 for(
const auto &group: groupSet)
823 std::cout << __COUT_HDR_FL__ <<
"\t" << group.first.first <<
": " <<
824 group.first.second <<
" => " << group.second << std::endl;
825 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Groups end." << std::endl;
830 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Active Groups:" << std::endl;
831 for(
const auto &activeGroup: activeGroupKeys)
832 std::cout << __COUT_HDR_FL__ <<
"\t" << activeGroup.first <<
": " <<
833 activeGroup.second.first <<
" => " << activeGroup.second.second << std::endl;
835 std::cout << __COUT_HDR_FL__ << activeBackboneTableName <<
" is the " <<
836 ConfigurationManager::ACTIVE_GROUP_NAME_BACKBONE <<
"." << std::endl;
837 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Active Groups end." << std::endl;
842 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"End of Flattening Active Configuration Groups!\n\n\n" << std::endl;
846 std::cout << __COUT_HDR_FL__ <<
"****************************" << std::endl;
847 std::cout << __COUT_HDR_FL__ <<
"There were " << groupSet.size() <<
848 " groups considered, and there were errors handling " << groupErrors.size() <<
849 " of those groups." << std::endl;
850 std::cout << __COUT_HDR_FL__ <<
"The following errors were found handling the groups:" << std::endl;
851 for(
auto& groupErr:groupErrors)
852 std::cout << __COUT_HDR_FL__ <<
"\t" << groupErr.first.first <<
" " << groupErr.first.second <<
853 ": \t" << groupErr.second << std::endl;
854 std::cout << __COUT_HDR_FL__ <<
"End of errors.\n\n" << std::endl;
857 std::cout << __COUT_HDR_FL__ <<
"Run the following to return to your previous database structure:" <<
859 std::cout << __COUT_HDR_FL__ <<
"\t otsdaq_flatten_system_aliases -1 " << moveToDir <<
866 int main(
int argc,
char* argv[])
868 FlattenActiveSystemAliasConfigurationGroups(argc,argv);