src
CondCore
PopCon
interface
OnlinePopCon.h
Go to the documentation of this file.
1
#ifndef CONDCORE_POPCON_ONLINEPOPCON_H
2
#define CONDCORE_POPCON_ONLINEPOPCON_H
3
4
//
5
// Authors:
6
// - Francesco Brivio (Milano-Bicocca)
7
// - Jan Chyczynski (AGH University of Krakow)
8
//
9
10
#include "
CondCore/DBOutputService/interface/OnlineDBOutputService.h
"
11
#include "
CondCore/PopCon/interface/Exception.h
"
12
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.h
"
13
#include "
FWCore/ServiceRegistry/interface/Service.h
"
14
15
#include <algorithm>
16
#include <functional>
17
#include <iostream>
18
#include <string>
19
#include <vector>
20
21
namespace
popcon
{
22
23
// Populator of the Condition DB.
24
// Specific implementation for online lumi-based conditions (OnlineDBOutputService)
25
26
class
OnlinePopCon
{
27
public
:
28
typedef
cond::Time_t
Time_t
;
29
30
OnlinePopCon
(
const
edm::ParameterSet
&
pset
);
31
32
virtual
~OnlinePopCon
();
33
34
template
<
typename
Source>
35
void
write
(
Source
const
&
source
);
36
37
private
:
38
cond::persistency::Session
initialize
();
39
cond::persistency::Session
preparePopCon
();
40
void
finalize
();
41
42
private
:
43
// DB service
44
edm::Service<cond::service::OnlineDBOutputService>
m_dbService
;
45
46
// PopCon infrastructure
47
cond::persistency::Session
m_targetSession
;
48
std::string
m_targetConnectionString
;
49
std::string
m_authPath
;
50
int
m_authSys
;
51
std::string
m_recordName
;
52
cond::TagInfo_t
m_tagInfo
;
53
cond::LogDBEntry_t
m_logDBEntry
;
54
55
// OnlinePopCon specific
56
int
m_dbLoggerReturn_
;
// DB logger return value
57
bool
m_useLockRecors
;
// whether to lock the records or not
58
59
// Version
60
static
constexpr
const
char
*
const
s_version
=
"1.0"
;
61
};
62
63
template
<
typename
Source>
64
void
OnlinePopCon::write
(
Source
const
&
source
) {
65
// Get data to be uploaded
66
typedef
typename
Source::Container
Container
;
67
std::pair<Container const*, std::string const>
ret
=
source
(
initialize
(),
m_tagInfo
,
m_logDBEntry
);
68
Container
const
&
iovs
= *
ret
.first;
69
70
// Check that only 1 iov/payload is provided
71
if
(
iovs
.size() > 1) {
72
throw
Exception
(
"OnlinePopCon"
,
"[write] More than one iov/payload provided!"
);
73
}
74
75
// If zero payloads to transfer, finalize and return
76
if
(
iovs
.empty()) {
77
m_dbService
->
logger
().
logInfo
() <<
"OnlinePopCon::write - Nothing to transfer"
;
78
finalize
();
79
return
;
80
}
81
82
// Upload
83
// Check if DB service is available
84
if
(!
m_dbService
.
isAvailable
()) {
85
throw
Exception
(
"OnlinePopCon"
,
"[write] DBService not available"
);
86
}
87
88
// Get the only payload to transfer
89
auto
[originalSince,
payload
] = *
iovs
.begin();
90
91
// Log the original since
92
m_dbService
->
logger
().
logInfo
() <<
"OnlinePopCon::write - original since: "
<< originalSince;
93
94
// Upload the payload
95
try
{
96
auto
targetSince =
m_dbService
->
writeIOVForNextLumisection
(*
payload
,
m_recordName
);
97
m_dbService
->
logger
().
logInfo
() <<
"OnlinePopCon::write - writeForNextLumisection successful!"
;
98
m_dbService
->
logger
().
logInfo
() <<
"OnlinePopCon::write - uploaded with since: "
<< targetSince;
99
}
catch
(
const
std::exception
&
e
) {
100
m_dbService
->
logger
().
logError
() <<
"OnlinePopCon::write - Error writing record: "
<<
m_recordName
;
101
m_dbService
->
logger
().
logError
() <<
"Error is: "
<<
e
.what();
102
m_dbLoggerReturn_
= 2;
103
}
104
105
// Finalize
106
finalize
();
107
}
108
109
}
// namespace popcon
110
111
#endif // CONDCORE_POPCON_ONLINEPOPCON_H
popcon::OnlinePopCon::m_authPath
std::string m_authPath
Definition:
OnlinePopCon.h:49
popcon::OnlinePopCon::m_dbService
edm::Service< cond::service::OnlineDBOutputService > m_dbService
Definition:
OnlinePopCon.h:44
edm::Service< cond::service::OnlineDBOutputService >
popcon::OnlinePopCon::Time_t
cond::Time_t Time_t
Definition:
OnlinePopCon.h:28
Exception
Definition:
hltDiff.cc:245
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:740
popcon::OnlinePopCon::write
void write(Source const &source)
Definition:
OnlinePopCon.h:64
popcon::OnlinePopCon::m_authSys
int m_authSys
Definition:
OnlinePopCon.h:50
Exception.h
popcon
Definition:
Exception.h:6
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
popcon::OnlinePopCon
Definition:
OnlinePopCon.h:26
OnlineDBOutputService.h
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr
if constexpr(n > 3)
Definition:
BrokenLine.h:164
ParameterSetfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
cppFunctionSkipper.exception
exception
Definition:
cppFunctionSkipper.py:10
cond::LogDBEntry_t
Definition:
Types.h:86
cond::Time_t
unsigned long long Time_t
Definition:
Time.h:14
cond::persistency::Logger::logError
EchoedLogStream< edm::LogError > logError()
Definition:
Logger.cc:165
cond::service::PoolDBOutputService::logger
cond::persistency::Logger & logger()
Definition:
PoolDBOutputService.h:245
popcon::OnlinePopCon::~OnlinePopCon
virtual ~OnlinePopCon()
Definition:
OnlinePopCon.cc:24
popcon::OnlinePopCon::initialize
cond::persistency::Session initialize()
Definition:
OnlinePopCon.cc:68
Service.h
cond::service::OnlineDBOutputService::writeIOVForNextLumisection
cond::Time_t writeIOVForNextLumisection(const PayloadType &payload, const std::string &recordName)
Definition:
OnlineDBOutputService.h:37
jetsAK4_Puppi_cff.payload
payload
Definition:
jetsAK4_Puppi_cff.py:17
cond::TagInfo_t
Definition:
Types.h:69
popcon::OnlinePopCon::m_useLockRecors
bool m_useLockRecors
Definition:
OnlinePopCon.h:57
popcon_last_value_cfg.Source
Source
Definition:
popcon_last_value_cfg.py:163
popcon::OnlinePopCon::m_targetSession
cond::persistency::Session m_targetSession
Definition:
OnlinePopCon.h:47
popcon::OnlinePopCon::preparePopCon
cond::persistency::Session preparePopCon()
Definition:
OnlinePopCon.cc:30
popcon::OnlinePopCon::m_tagInfo
cond::TagInfo_t m_tagInfo
Definition:
OnlinePopCon.h:52
cond::persistency::Session
Definition:
Session.h:63
edm::ParameterSet
Definition:
ParameterSet.h:48
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
popcon::OnlinePopCon::m_dbLoggerReturn_
int m_dbLoggerReturn_
Definition:
OnlinePopCon.h:56
popcon::OnlinePopCon::s_version
static constexpr const char *const s_version
Definition:
OnlinePopCon.h:60
popcon::OnlinePopCon::OnlinePopCon
OnlinePopCon(const edm::ParameterSet &pset)
Definition:
OnlinePopCon.cc:12
cond::persistency::Logger::logInfo
EchoedLogStream< edm::LogInfo > logInfo()
Definition:
Logger.cc:157
popcon::OnlinePopCon::m_recordName
std::string m_recordName
Definition:
OnlinePopCon.h:51
reco::JetExtendedAssociation::Container
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
Definition:
JetExtendedAssociation.h:29
run_AlCaRecoTriggerBitsUpdateWorkflow.iovs
iovs
Definition:
run_AlCaRecoTriggerBitsUpdateWorkflow.py:60
source
static std::string const source
Definition:
EdmProvDump.cc:49
popcon::OnlinePopCon::m_targetConnectionString
std::string m_targetConnectionString
Definition:
OnlinePopCon.h:48
popcon::OnlinePopCon::finalize
void finalize()
Definition:
OnlinePopCon.cc:90
popcon::OnlinePopCon::m_logDBEntry
cond::LogDBEntry_t m_logDBEntry
Definition:
OnlinePopCon.h:53
Generated for CMSSW Reference Manual by
1.8.14