Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of private frontier Key for workflow-specific caching #33505

Merged
merged 1 commit into from Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CondCore/DBOutputService/interface/OnlineDBOutputService.h
Expand Up @@ -84,6 +84,7 @@ namespace cond {
std::string m_omsServiceUrl;
std::string m_lastLumiFile;
std::string m_preLoadConnectionString;
std::string m_frontierKey;
bool m_debug;

}; //OnlineDBOutputService
Expand Down
15 changes: 14 additions & 1 deletion CondCore/DBOutputService/src/OnlineDBOutputService.cc
Expand Up @@ -84,10 +84,18 @@ cond::service::OnlineDBOutputService::OnlineDBOutputService(const edm::Parameter
m_latencyInLumisections(iConfig.getUntrackedParameter<unsigned int>("latency", 1)),
m_omsServiceUrl(iConfig.getUntrackedParameter<std::string>("omsServiceUrl", "")),
m_preLoadConnectionString(iConfig.getUntrackedParameter<std::string>("preLoadConnectionString", "")),
m_frontierKey(""),
m_debug(iConfig.getUntrackedParameter<bool>("debugLogging", false)) {
if (m_omsServiceUrl.empty()) {
m_lastLumiFile = iConfig.getUntrackedParameter<std::string>("lastLumiFile", "");
}
std::string frontierKeyFilePath(iConfig.getUntrackedParameter<std::string>("frontierKeyFilePath", ""));
if (!frontierKeyFilePath.empty()) {
std::ifstream frontierKeyFile(frontierKeyFilePath);
if (!frontierKeyFile)
throw Exception(std::string("Can't access frontierKey file ") + frontierKeyFilePath);
frontierKeyFile >> m_frontierKey;
}
}

cond::service::OnlineDBOutputService::~OnlineDBOutputService() {}
Expand Down Expand Up @@ -124,5 +132,10 @@ cond::Iov_t cond::service::OnlineDBOutputService::preLoadIov(const std::string&
}

cond::persistency::Session cond::service::OnlineDBOutputService::getReadOnlyCache(cond::Time_t targetTime) {
return PoolDBOutputService::newReadOnlySession(m_preLoadConnectionString, std::to_string(targetTime));
std::stringstream transId;
transId << targetTime;
if (!m_frontierKey.empty()) {
transId << "_" << m_frontierKey;
}
return PoolDBOutputService::newReadOnlySession(m_preLoadConnectionString, transId.str());
}
Expand Up @@ -32,12 +32,12 @@
messageLevel = cms.untracked.int32(1),
authenticationPath = cms.untracked.string('.')
),
#timetype = cms.untracked.string('runnumber'),
jobName = cms.untracked.string("TestLumiBasedUpdate"),
connect = cms.string('oracle://cms_orcoff_prep/CMS_CONDITIONS'),
preLoadConnectionString = cms.untracked.string('frontier://FrontierPrep/CMS_CONDITIONS'),
runNumber = cms.untracked.uint64(options.runNumber),
#lastLumiFile = cms.untracked.string('last_lumi.txt'),
#frontierKeyFilePath = cms.untracked.string('frontier.key'),
writeTransactionDelay = cms.untracked.uint32(options.transDelay),
autoCommit = cms.untracked.bool(True),
saveLogsOnDB = cms.untracked.bool(True),
Expand Down
10 changes: 9 additions & 1 deletion CondCore/ESSources/plugins/CondDBESSource.cc
Expand Up @@ -98,6 +98,7 @@ namespace {
CondDBESSource::CondDBESSource(const edm::ParameterSet& iConfig)
: m_connection(),
m_connectionString(""),
m_frontierKey(""),
m_lastRun(0), // for the stat
m_lastLumi(0), // for the stat
m_policy(NOREFRESH),
Expand Down Expand Up @@ -139,6 +140,11 @@ CondDBESSource::CondDBESSource(const edm::ParameterSet& iConfig)
} else if (iConfig.exists("connect")) // default connection string
m_connectionString = iConfig.getParameter<std::string>("connect");

// frontier key
if (iConfig.exists("frontierKey")) {
m_frontierKey = iConfig.getParameter<std::string>("frontierKey");
}

// snapshot
boost::posix_time::ptime snapshotTime;
if (iConfig.exists("snapshotTime")) {
Expand Down Expand Up @@ -453,8 +459,10 @@ void CondDBESSource::setIntervalFor(const EventSetupRecordKey& iKey,
<< "Checking if the session must be closed and re-opened for getting correct conditions"
<< "; from CondDBESSource::setIntervalFor";
std::stringstream transId;
//transId << "long" << m_lastRun;
transId << lastTime;
if (!m_frontierKey.empty()) {
transId << "_" << m_frontierKey;
}
std::string connStr = m_connectionString;
std::pair<std::string, std::string> tagParams = cond::persistency::parseTag(tcIter->second.tagName());
if (!tagParams.second.empty())
Expand Down
1 change: 1 addition & 0 deletions CondCore/ESSources/plugins/CondDBESSource.h
Expand Up @@ -110,6 +110,7 @@ class CondDBESSource : public edm::eventsetup::DataProxyProvider, public edm::Ev

cond::persistency::ConnectionPool m_connection;
std::string m_connectionString;
std::string m_frontierKey;

// Container of DataProxy, implemented as multi-map keyed by records
ProxyMap m_proxies;
Expand Down
Expand Up @@ -107,6 +107,7 @@
DBParameters = CondDBParameters,
connect = cms.string( options.connectionString ),
snapshotTime = cms.string( options.snapshotTime ),
frontierKey = cms.string('abcdefghijklmnopqrstuvwxyz0123456789'),
toGet = cms.VPSet(cms.PSet(
record = cms.string('BeamSpotObjectsRcd'),
tag = cms.string( options.tag ),
Expand Down