Skip to content

Commit

Permalink
Merge pull request #173 from art-daq/rrivera/lastAddsPreGR3tk2
Browse files Browse the repository at this point in the history
Rrivera/last adds pre gr3tk2
  • Loading branch information
eflumerf authored Oct 16, 2024
2 parents 6dcc091 + 61a7b0d commit 4508dfa
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 37 deletions.
113 changes: 99 additions & 14 deletions otsdaq/ConfigurationInterface/ConfigurationManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ ConfigurationManager::ConfigurationManager(bool initForWriteAccess /*=false*/, b
, theBackboneTableGroup_("")
, groupMetadataTable_(true /*special table*/, ConfigurationInterface::GROUP_METADATA_TABLE_NAME)
{
__GEN_COUTV__(runTimeSeconds());
__GEN_COUTTV__(runTimeSeconds());
theInterface_ = ConfigurationInterface::getInstance(ConfigurationInterface::CONFIGURATION_MODE::ARTDAQ_DATABASE); // false to use artdaq DB

__GEN_COUTV__(runTimeSeconds());
__GEN_COUTTV__(runTimeSeconds());

// initialize special group metadata table
{
Expand Down Expand Up @@ -172,10 +172,10 @@ ConfigurationManager::ConfigurationManager(bool initForWriteAccess /*=false*/, b
}
// else do normal init

__GEN_COUTV__(runTimeSeconds());
__GEN_COUTTV__(runTimeSeconds());
if(!initForWriteAccess) //ConfigurationManagerRW can do manual init later when it calls getAllTableInfo(true)
init(0 /*accumulatedErrors*/, initForWriteAccess);
__GEN_COUTV__(runTimeSeconds());
__GEN_COUTTV__(runTimeSeconds());

} // end constructor()

Expand Down Expand Up @@ -209,7 +209,7 @@ void ConfigurationManager::init(std::string* accumulatedErrors /*=0*/, bool init
{
try
{
__GEN_COUTV__(username_);
__GEN_COUTTV__(username_);

// if write access, then load all specified table groups (including configuration group),
// otherwise skip configuration group. Important to consider initForWriteAccess
Expand Down Expand Up @@ -3531,12 +3531,12 @@ std::map<std::string /*groupType*/,
std::pair<std::string /*groupName*/,
TableGroupKey>> retMap;

__GEN_COUTV__(otherSubsystemUID);
__GEN_COUTTV__(otherSubsystemUID);

ConfigurationTree node = getNode(ConfigurationManager::CONTEXT_SUBSYSTEM_OPTIONAL_TABLE).getNode(otherSubsystemUID);
std::string userPath = node.getNode("SubsystemUserDataPath").getValue();
auto splitPath = StringMacros::getVectorFromString(userPath,{':'});
__GEN_COUTV__(StringMacros::vectorToString(splitPath));
__GEN_COUTTV__(StringMacros::vectorToString(splitPath));

if(!splitPath.size() || splitPath.size() > 2)
{
Expand Down Expand Up @@ -3571,7 +3571,7 @@ std::map<std::string /*groupType*/,
{
//since we are running exec, cleanse the username@host path for alphanumeric,_,-,/ only
std::vector<std::string> userHostSplit = StringMacros::getVectorFromString(splitPath[0],{'@'});
__GEN_COUTV__(userHostSplit.size());
__GEN_COUTTV__(userHostSplit.size());
if(userHostSplit.size() == 1)
hostname = userHostSplit[0];
else if(userHostSplit.size() == 2)
Expand Down Expand Up @@ -3619,7 +3619,7 @@ std::map<std::string /*groupType*/,
}

std::string tmpSubsystemFilename = ConfigurationManager::ACTIVE_GROUPS_FILENAME + "." + otherSubsystemUID;
__GEN_COUTV__(tmpSubsystemFilename);
__GEN_COUTTV__(tmpSubsystemFilename);
if(userHostSplit.size() == 2) //has username
{
cmdResult = StringMacros::exec(("rm " + tmpSubsystemFilename + " 2>/dev/null; scp " + username + "@" + hostname +
Expand All @@ -3644,7 +3644,7 @@ std::map<std::string /*groupType*/,
if(hostnamePtr) *hostnamePtr = hostname;
if(usernamePtr) *usernamePtr = username;

__GEN_COUTV__(cmdResult);
__GEN_COUTTV__(cmdResult);
if(cmdResult.find("Permission denied") != std::string::npos)
{
__GEN_SS__ << "Permission denied accessing user data path specified for subsystem '" << otherSubsystemUID
Expand All @@ -3653,16 +3653,16 @@ std::map<std::string /*groupType*/,
}

auto subsystemActiveGroupMap = StringMacros::getVectorFromString(cmdResult,{'\n'} /* delimieter*/, {' ','\t'} /* whitespace*/);
__GEN_COUTV__(StringMacros::vectorToString(subsystemActiveGroupMap));
__GEN_COUTV__(subsystemActiveGroupMap.size());
__GEN_COUTTV__(StringMacros::vectorToString(subsystemActiveGroupMap));
__GEN_COUTTV__(subsystemActiveGroupMap.size());

std::string //groupComment, groupAuthor, groupCreationTime,
groupType;
for(unsigned int i = 0; i + 1 < subsystemActiveGroupMap.size(); i += 2)
{
if(subsystemActiveGroupMap[i] == "" || subsystemActiveGroupMap[i+1] == "-1") continue;

__GEN_COUT__ << "Loading type of subsystem '" << otherSubsystemUID
__GEN_COUTT__ << "Loading type of subsystem '" << otherSubsystemUID
<< "' group " << subsystemActiveGroupMap[i] << "(" << subsystemActiveGroupMap[i+1] << ")" << __E__;

try
Expand Down Expand Up @@ -3693,7 +3693,6 @@ std::map<std::string /*groupType*/,
return retMap;
} //end getOtherSubsystemActiveTableGroups()


//==============================================================================
//Ignore any System Aliases with "Context" or "Iterat" in the name
std::set<std::string /* configAlias */> ConfigurationManager::getOtherSubsystemConfigAliases(const std::string& otherSubsystemUID)
Expand Down Expand Up @@ -3909,6 +3908,92 @@ std::set<std::string /* configAlias */> ConfigurationManager::getOtherSubsystemF
return retSet;
} //end getOtherSubsystemFilteredConfigAliases()

//==============================================================================
// returns configAlias translation group info by reference
void ConfigurationManager::getOtherSubsystemConfigAliasInfo(const std::string& otherSubsystemUID,
const std::string& configAlias, std::pair<std::string, TableGroupKey>& groupTranslation,
std::string& groupComment, std::string& groupAuthor, std::string& groupCreationTime)
{
__GEN_COUTV__(otherSubsystemUID);


std::map<std::string /*groupType*/,
std::pair<std::string /*groupName*/,
TableGroupKey>> retMap = getOtherSubsystemActiveTableGroups(otherSubsystemUID);


//load backbone
auto it = retMap.find(ConfigurationManager::convertGroupTypeToName(GroupType::BACKBONE_TYPE));
if(it == retMap.end())
{
__GEN_SS__ << "No active Backbone group found in the active groups of remote subsystem '" <<
otherSubsystemUID << "!'" << __E__;
__GEN_SS_THROW__;
}
auto it2 = retMap.find(ConfigurationManager::convertGroupTypeToName(GroupType::CONTEXT_TYPE));
if(it2 == retMap.end())
{
__GEN_SS__ << "No active Context group found in the active groups of remote subsystem '" <<
otherSubsystemUID << "!'" << __E__;
__GEN_SS_THROW__;
}

std::string accumulatedWarnings;

// be careful to not activate! which calls init() and then generates output files to disk
// and changes the system active group; instead only setActiveView
loadTableGroup(it->second.first,
it->second.second,
false /*doActivate*/,
0 /*groupMembers*/,
0 /*progressBar*/,
&accumulatedWarnings /*accumulateWarnings = 0*/
);
__GEN_COUTTV__(accumulatedWarnings);

// (a la ConfigurationManager::getTableGroupFromAlias)
try
{
// find runType in Group Aliases table
ConfigurationTree entry = getNode(ConfigurationManager::GROUP_ALIASES_TABLE_NAME).getNode(configAlias);

groupTranslation =
std::pair<std::string, TableGroupKey>(entry.getNode("GroupName").getValueAsString(),
TableGroupKey(entry.getNode("GroupKey").getValueAsString()));
__COUT__ << "Found " << configAlias << " translates to " << groupTranslation.first << "(" <<
groupTranslation.second << ")" << __E__;

//get comment, author, creationTime
try
{
loadTableGroup(groupTranslation.first,
groupTranslation.second,
false /*doActivate*/,
0 /*groupMembers*/,
0 /*progressBar*/,
&accumulatedWarnings,
&groupComment,
&groupAuthor,
&groupCreationTime,
true /*doNotLoadMembers*/);
}
catch(...)
{
__COUT_WARN__ << "Failed to load group metadata." << __E__;
}
__COUT__ << "Found " << configAlias << " author: " << groupAuthor << ", createTime: "
<< groupCreationTime << ", comment: " << groupComment << __E__;
}
catch(...)
{
__GEN_SS__ << "Did not find the Configuration Alias '" << configAlias <<
"' in the active Backbone group of remote subsystem '" <<
otherSubsystemUID << "!'" << __E__;
__GEN_SS_THROW__;
}

} //end getOtherSubsystemConfigAliasInfo()

//==============================================================================
// allow for just the desktop icons of the Context to be changed during run-time
TableBase* ConfigurationManager::getDesktopIconTable(void)
Expand Down
1 change: 1 addition & 0 deletions otsdaq/ConfigurationInterface/ConfigurationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ const T* retPtr = dynamic_cast<const T*>(srcPtr); if(retPtr == nullptr) { __SS__
TableGroupKey>> getOtherSubsystemActiveTableGroups (const std::string& otherSubsystemUID, std::string* userDataPathPtr = nullptr, std::string* hostnamePtr = nullptr, std::string* usernamePtr = nullptr);
std::set<std::string /* configAlias */> getOtherSubsystemConfigAliases (const std::string& otherSubsystemUID);
std::set<std::string /* configAlias */> getOtherSubsystemFilteredConfigAliases (const std::string& otherSubsystemUID, const std::string& otherSubsystemFsmName );
void getOtherSubsystemConfigAliasInfo (const std::string& otherSubsystemUID, const std::string& configAlias, std::pair<std::string, TableGroupKey>& groupTranslation, std::string& groupComment, std::string& groupAuthor, std::string& groupCreationTime);

//==============================================================================
// Setters/Modifiers
Expand Down
2 changes: 1 addition & 1 deletion otsdaq/CoreSupervisors/CorePropertySupervisorBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void CorePropertySupervisorBase::checkSupervisorPropertySetup()

setSupervisorPropertyDefaults(); // calls override version defaults

__SUP_COUTT__ << "Done setting up supervisor specific property DEFAULTS for supervisor" << "." << __E__;
__SUP_COUTT__ << "Done setting up supervisor specific property DEFAULTS for supervisor." << __E__;

if(allSupervisorInfo_.isWizardMode())
__SUP_COUT__ << "Wiz mode detected. Skipping setup of supervisor properties for "
Expand Down
Loading

0 comments on commit 4508dfa

Please sign in to comment.