Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14420 from diguida/fix_RunInfo_and_PopCon
Fixes for RunInfo O2O and cleanup of PopCon interface
- Loading branch information
Showing
8 changed files
with
397 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
#ifndef CondTools_RunInfo_RunInfoRead_h | ||
#define CondTools_RunInfo_RunInfoRead_h | ||
|
||
#include "CondTools/RunInfo/interface/TestBase.h" | ||
#include "CondFormats/RunInfo/interface/RunInfo.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include <string> | ||
|
||
class RunInfoRead : virtual public TestBase { | ||
class RunInfoRead { | ||
public: | ||
RunInfoRead(const std::string& connectionString, | ||
const std::string& user, | ||
const std::string& pass); | ||
virtual ~RunInfoRead(); | ||
void run(); | ||
RunInfo readData(const std::string& table, const std::string& column, const int r_number); | ||
const edm::ParameterSet& connectionPset); | ||
~RunInfoRead(); | ||
RunInfo readData(const std::string& runinfo_schema, const std::string& dcsenv_schema, const int r_number); | ||
private: | ||
std::string m_tableToRead; | ||
std::string m_columnToRead; | ||
std::string m_connectionString; | ||
std::string m_user; | ||
std::string m_pass; | ||
edm::ParameterSet m_connectionPset; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,70 @@ | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "CondTools/RunInfo/interface/RunInfoHandler.h" | ||
#include "CondTools/RunInfo/interface/RunInfoRead.h" | ||
#include<iostream> | ||
#include<vector> | ||
|
||
RunInfoHandler::RunInfoHandler(const edm::ParameterSet& pset) : | ||
m_name( pset.getUntrackedParameter<std::string>( "name", "RunInfoHandler") ) | ||
,m_since( pset.getParameter<unsigned long long>( "runNumber" ) ) | ||
,m_connectionString( pset.getUntrackedParameter<std::string>( "connectionString", "oracle://cms_omds_adg/CMS_RUNINFO") ) | ||
,m_authpath( pset.getUntrackedParameter<std::string>( "authenticationPath", "." ) ) | ||
,m_user( pset.getUntrackedParameter<std::string>( "OnlineDBUser", "CMS_RUNINFO_R" ) ) | ||
,m_pass( pset.getUntrackedParameter<std::string>( "OnlineDBPass", "PASSWORD") ) { | ||
RunInfoHandler::RunInfoHandler( const edm::ParameterSet& pset ) : | ||
m_since( pset.getParameter<unsigned long long>( "runNumber" ) ) | ||
,m_name( pset.getUntrackedParameter<std::string>( "name", "RunInfoHandler" ) ) | ||
,m_runinfo_schema( pset.getUntrackedParameter<std::string>( "RunInfoSchema", "CMS_RUNINFO" ) ) | ||
,m_dcsenv_schema( pset.getUntrackedParameter<std::string>( "DCSEnvSchema", "CMS_DCS_ENV_PVSS_COND") ) | ||
,m_connectionString( pset.getParameter<std::string>( "connect" ) ) | ||
,m_connectionPset( pset.getParameter<edm::ParameterSet>( "DBParameters" ) ) { | ||
} | ||
|
||
RunInfoHandler::~RunInfoHandler() {} | ||
|
||
void RunInfoHandler::getNewObjects() { | ||
//check whats already inside of database | ||
edm::LogInfo( "RunInfoHandler" ) << "------- " << m_name | ||
<< " - > getNewObjects\n" | ||
<< "got offlineInfo " << tagInfo().name | ||
edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": " | ||
<< "Destination Tag Info: name " << tagInfo().name | ||
<< ", size " << tagInfo().size | ||
<< ", last object valid since " << tagInfo().lastInterval.first | ||
<< " token " << tagInfo().lastPayloadToken << std::endl; | ||
edm::LogInfo( "RunInfoHandler" ) << "runnumber/first since = " << m_since << std::endl; | ||
<< ", hash " << tagInfo().lastPayloadToken << std::endl; | ||
edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": runnumber/first since = " << m_since << std::endl; | ||
|
||
//check if a transfer is needed: | ||
//if the new run number is smaller than or equal to the latest IOV, exit. | ||
//This is needed as now the IOV Editor does not always protect for insertions: | ||
//ANY and VALIDATION sychronizations are allowed to write in the past. | ||
if( tagInfo().size > 0 && tagInfo().lastInterval.first >= m_since ) { | ||
edm::LogWarning( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": " | ||
<< "last IOV " << tagInfo().lastInterval.first | ||
<< ( tagInfo().lastInterval.first == m_since ? " is equal to" : " is larger than" ) | ||
<< " the run proposed for insertion " << m_since | ||
<< ". No transfer needed." << std::endl; | ||
return; | ||
} | ||
|
||
RunInfo* r = new RunInfo(); | ||
|
||
//fill with null runinfo if empty run are found beetween the two last valid ones | ||
size_t n_empty_run = 0; | ||
if( tagInfo().size > 0 && (tagInfo().lastInterval.first + 1) < m_since ) { | ||
n_empty_run = m_since - tagInfo().lastInterval.first - 1; | ||
edm::LogInfo( "RunInfoHandler" ) << "------- " << "entering fake run from " | ||
edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": " | ||
<< "entering fake run from " | ||
<< tagInfo().lastInterval.first + 1 | ||
<< "to " << m_since - 1 << "- > getNewObjects" | ||
<< " to " << m_since - 1 | ||
<< std::endl; | ||
} | ||
std::ostringstream ss; | ||
// transfer fake run for 1 to since for the first time | ||
if( tagInfo().size == 0 && m_since != 1 ) { | ||
m_to_transfer.push_back( std::make_pair( (RunInfo*)(r->Fake_RunInfo()), 1 ) ); | ||
ss << "fake run number: " << 1 << ", "; | ||
} | ||
if ( n_empty_run != 0 ) { | ||
m_to_transfer.push_back(std::make_pair( (RunInfo*)(r->Fake_RunInfo()), tagInfo().lastInterval.first + 1 ) ); | ||
ss << "fake run number: " << tagInfo().lastInterval.first + 1 << ", "; | ||
} | ||
|
||
//reading from omds | ||
RunInfoRead rn( m_connectionString, m_user, m_pass ); | ||
*r = rn.readData( "RUNSESSION_PARAMETER", "STRING_VALUE",(int)m_since ); | ||
RunInfoRead rn( m_connectionString, m_connectionPset ); | ||
*r = rn.readData( m_runinfo_schema, m_dcsenv_schema, (int)m_since ); | ||
m_to_transfer.push_back( std::make_pair( (RunInfo*)r, m_since) ); | ||
std::ostringstream ss; | ||
ss << "since =" << m_since; | ||
m_userTextLog = ss.str() + ";"; | ||
edm::LogInfo( "RunInfoHandler" ) << "------- " << m_name << " - > getNewObjects" << std::endl; | ||
ss << "run number: " << m_since << ";"; | ||
m_userTextLog = ss.str(); | ||
edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": END." << std::endl; | ||
} |
Oops, something went wrong.