Skip to content

Commit

Permalink
Merge pull request #68 from art-daq/mrigatti/hwdevbranch
Browse files Browse the repository at this point in the history
Mrigatti/hwdevbranch
  • Loading branch information
rrivera747 committed Dec 2, 2022
2 parents 7d8ef2c + 241e932 commit 3a7f450
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 112 deletions.
20 changes: 18 additions & 2 deletions otsdaq/CoreSupervisors/ConfigurationSupervisorBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ try
}
}

bool ignoreDuplicates = false;
if(!version.isTemporaryVersion() && sourceTableAsIs &&
table->getViewP()->getSourceColumnNames().size() != table->getViewP()->getDataColumnSize())
{
__COUT__ << "table->getViewP()->getNumberOfColumns() " << table->getViewP()->getNumberOfColumns() << __E__;
__COUTV__(table->getViewP()->getSourceColumnNames().size());
__COUT_INFO__ << "Source view v" << version << " has a mismatch in the number of columns, so forcing new version saved." << __E__;
ignoreDuplicates = true;
}

// create a temporary version from the source version
TableVersion temporaryVersion = table->createTemporaryView(version);

Expand Down Expand Up @@ -196,15 +206,21 @@ try
}

// note: if sourceTableAsIs, accept equivalent versions
ConfigurationSupervisorBase::saveModifiedVersionXML(xmlOut,
auto newVersion = ConfigurationSupervisorBase::saveModifiedVersionXML(xmlOut,
cfgMgr,
tableName,
version,
makeTemporary,
table,
temporaryVersion,
false /*ignoreDuplicates*/,
ignoreDuplicates /*ignoreDuplicates*/,
lookForEquivalent || sourceTableAsIs /*lookForEquivalent*/);

if(ignoreDuplicates && sourceTableAsIs) //reset cache for this table
{
table = cfgMgr->getTableByName(tableName);
table->eraseView(newVersion);
}
} // end handleCreateTableXML()
catch(std::runtime_error& e)
{
Expand Down
4 changes: 3 additions & 1 deletion otsdaq/CoreSupervisors/FESupervisor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -958,13 +958,15 @@ void FESupervisor::transitionConfiguring(toolbox::Event::Reference /*event*/)
void FESupervisor::transitionHalting(toolbox::Event::Reference event)
{
__SUP_COUT__ << "transitionHalting" << __E__;

TLOG_DEBUG(7) << "transitionHalting";
try
{
if(metricMan && metricMan->Initialized())
{
TLOG_DEBUG(7) << "Metric manager(" << metricMan << ") shutting down..." << __E__;
metricMan->shutdown(); // will set initilized_ to false with mutex, which should prevent races
metricMan.reset(nullptr);
TLOG_DEBUG(7) << "Metric manager shutdown." << __E__;
}
else
__SUP_COUT__ << "Metric manager(" << metricMan << ") already shutdown." << __E__;
Expand Down
2 changes: 1 addition & 1 deletion otsdaq/FECore/FEVInterfacesManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ void FEVInterfacesManager::startMacroMultiDimensional(const std::string& request
__SS_THROW__;
}
macroMultiDimensionalStatusMap_.emplace(std::make_pair(interfaceID, "Active"));
}
} // unlock mutex scope

// start thread
std::thread(
Expand Down
35 changes: 17 additions & 18 deletions otsdaq/GatewaySupervisor/GatewaySupervisor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3258,14 +3258,13 @@ void GatewaySupervisor::request(xgi::Input* in, xgi::Output* out)

std::string stateMachineAliasFilter = "*"; // default to all

// IMPORTANT -- use temporary ConfigurationManager to get the Active Group Aliases, to avoid changine the Context Configuration tree for the Gateway
// Supervisor
// IMPORTANT -- use temporary ConfigurationManager to get the Active Group Aliases,
// to avoid changing the Context Configuration tree for the Gateway Supervisor
ConfigurationManager temporaryConfigMgr;
std::map<std::string /*alias*/, std::pair<std::string /*group name*/, TableGroupKey>> aliasMap;
{
ConfigurationManager temporaryConfigMgr;
aliasMap = temporaryConfigMgr.getActiveGroupAliases();
} // end temporary scope for ConfigurationManager to get active group aliases
aliasMap = temporaryConfigMgr.getActiveGroupAliases();

// AND IMPORTANT -- to use ConfigurationManager to get the Context settings for the Gateway Supervisor
// get stateMachineAliasFilter if possible
ConfigurationTree configLinkNode =
CorePropertySupervisorBase::theConfigurationManager_->getSupervisorTableNode(supervisorContextUID_, supervisorApplicationUID_);
Expand Down Expand Up @@ -3377,28 +3376,28 @@ void GatewaySupervisor::request(xgi::Input* in, xgi::Output* out)
xmlOut.addTextElementToData("config_alias", aliasMapPair.first);
xmlOut.addTextElementToData("config_key", TableGroupKey::getFullGroupString(aliasMapPair.second.first, aliasMapPair.second.second).c_str());

// __COUT__ << "config_alias_comment" << " " << CorePropertySupervisorBase::theConfigurationManager_->getNode(
// __COUT__ << "config_alias_comment" << " " << temporaryConfigMgr.getNode(
// ConfigurationManager::GROUP_ALIASES_TABLE_NAME).getNode(aliasMapPair.first).getNode(
// TableViewColumnInfo::COL_NAME_COMMENT).getValue<std::string>() << __E__;
xmlOut.addTextElementToData("config_alias_comment",
CorePropertySupervisorBase::theConfigurationManager_->getNode(ConfigurationManager::GROUP_ALIASES_TABLE_NAME)
temporaryConfigMgr.getNode(ConfigurationManager::GROUP_ALIASES_TABLE_NAME)
.getNode(aliasMapPair.first)
.getNode(TableViewColumnInfo::COL_NAME_COMMENT)
.getValue<std::string>());

std::string groupComment, groupAuthor, groupCreationTime;
try
{
CorePropertySupervisorBase::theConfigurationManager_->loadTableGroup(aliasMapPair.second.first,
aliasMapPair.second.second,
false,
0,
0,
0,
&groupComment,
&groupAuthor,
&groupCreationTime,
true /*doNotLoadMembers*/);
temporaryConfigMgr.loadTableGroup(aliasMapPair.second.first,
aliasMapPair.second.second,
false,
0,
0,
0,
&groupComment,
&groupAuthor,
&groupCreationTime,
true /*doNotLoadMembers*/);

xmlOut.addTextElementToData("config_comment", groupComment);
xmlOut.addTextElementToData("config_author", groupAuthor);
Expand Down
24 changes: 24 additions & 0 deletions otsdaq/TableCore/TableView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,30 @@ void TableView::init(void)
bool tmpIsGroup;
std::pair<unsigned int /*link col*/, unsigned int /*link id col*/> tmpLinkPair;


//check sanity of data view rows x cols (have seen weird out-of-range crashes)
if(getNumberOfRows() != theDataView_.size())
{
__SS__ << "Impossible row mismatch " << getNumberOfRows() << " vs " << theDataView_.size() << "! How did you get here?" << __E__;
__SS_THROW__;
}
for(unsigned int row = 0; row < getNumberOfRows(); ++row)
if(getNumberOfColumns() != theDataView_[row].size())
{
__SS__ << "Impossible col mismatch " << getNumberOfColumns() << " vs [" << row << "]" << theDataView_[row].size() << "! How did you get here?" << __E__;
__SS_THROW__;
}
if(getNumberOfColumns() != columnsInfo_.size())
{
__SS__ << "Impossible col info mismatch " << getNumberOfColumns() << " vs " << columnsInfo_.size() << "! How did you get here?" << __E__;
__SS_THROW__;
}
if(getNumberOfColumns() != rowDefaults.size())
{
__SS__ << "Impossible col default mismatch " << getNumberOfColumns() << " vs " << rowDefaults.size() << "! How did you get here?" << __E__;
__SS_THROW__;
}

for(unsigned int col = 0; col < getNumberOfColumns(); ++col)
{
if(columnsInfo_[col].getType() == TableViewColumnInfo::TYPE_FIXED_CHOICE_DATA)
Expand Down
Loading

0 comments on commit 3a7f450

Please sign in to comment.