CMS 3D CMS Logo

PopCon.cc
Go to the documentation of this file.
6 #include <iostream>
7 
8 namespace popcon {
9 
10  constexpr const char* const PopCon::s_version;
11 
13  m_targetSession(),
14  m_targetConnectionString(pset.getUntrackedParameter< std::string >("targetDBConnectionString","")),
15  m_authPath( pset.getUntrackedParameter<std::string>("authenticationPath","")),
16  m_authSys( pset.getUntrackedParameter<int>("authenticationSystem",1)),
17  m_record(pset.getParameter<std::string> ("record")),
18  m_payload_name(pset.getUntrackedParameter<std::string> ("name","")),
19  m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
20  m_close(pset.getUntrackedParameter< bool > ("closeIOV",false)),
21  m_lastTill(pset.getUntrackedParameter< bool > ("lastTill",false))
22  {
23  //TODO set the policy (cfg or global configuration?)
24  //Policy if corrupted data found
25 
26  edm::LogInfo ("PopCon") << "This is PopCon (Populator of Condition) v" << s_version << ".\n"
27  << "Please report any problem and feature request through the JIRA project CMSCONDDB.\n" ;
28  }
29 
31  if( !m_targetConnectionString.empty() ) {
33  }
34  }
35 
36 
38  edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
39  if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
40  const std::string & connectionStr = m_dbService->session().connectionString();
44  else {
48  connPool.configure();
51  }
55  m_tagInfo.size = iov.sequenceSize();
56  if( m_tagInfo.size>0 ){
57  cond::Iov_t last = iov.getLast();
60  }
61 
62  edm::LogInfo ("PopCon") << "destination DB: " << connectionStr
63  << ", target DB: " << ( m_targetConnectionString.empty() ? connectionStr : m_targetConnectionString ) << "\n"
64  << "TAG: " << m_tag
65  << ", last since/till: " << m_tagInfo.lastInterval.first
66  << "/" << m_tagInfo.lastInterval.second
67  << ", size: " << m_tagInfo.size << "\n" << std::endl;
68  } else {
69  edm::LogInfo ("PopCon") << "destination DB: " << connectionStr
70  << ", target DB: " << ( m_targetConnectionString.empty() ? connectionStr : m_targetConnectionString ) << "\n"
71  << "TAG: " << m_tag
72  << "; First writer to this new tag." << std::endl;
73  }
74  return m_targetSession;
75  }
76 
77 
78  void PopCon::finalize(Time_t lastTill) {
79 
80  if (m_close) {
81  // avoid to close it before lastSince
82  if (m_lastTill>lastTill) lastTill=m_lastTill;
83  m_dbService->closeIOV(lastTill,m_record);
84  }
85  if( !m_targetConnectionString.empty() ) {
87  }
88  }
89 
90 }
void closeIOV(Time_t lastTill, const std::string &recordName, bool withlogging=false)
void finalize(Time_t lastTill)
Definition: PopCon.cc:78
Time_t m_lastTill
Definition: PopCon.h:83
void start(bool readOnly=true)
Definition: Session.cc:22
cond::persistency::Session session() const
bool m_close
Definition: PopCon.h:81
Time_t since
Definition: Types.h:55
cond::Time_t Time_t
Definition: PopCon.h:36
size_t size
Definition: Types.h:78
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::string m_tag
Definition: PopCon.h:75
std::string m_record
Definition: PopCon.h:69
Transaction & transaction()
Definition: Session.cc:66
std::string tag(const std::string &recordName)
cond::persistency::Session m_targetSession
Definition: PopCon.h:61
std::string name
Definition: Types.h:74
static const char *const s_version
Definition: PopCon.h:85
cond::ValidityInterval lastInterval
Definition: Types.h:76
IOVProxy readIov(const std::string &tag, bool full=false)
Definition: Session.cc:81
void setAuthenticationSystem(int authSysCode)
bool isAvailable() const
Definition: Service.h:40
Hash payloadId
Definition: Types.h:57
Session createSession(const std::string &connectionString, bool writeCapable=false)
std::string m_targetConnectionString
Definition: PopCon.h:63
cond::TagInfo_t m_tagInfo
Definition: PopCon.h:77
std::string connectionString()
Definition: Session.cc:232
PopCon(const edm::ParameterSet &pset)
Definition: PopCon.cc:12
int m_authSys
Definition: PopCon.h:67
cond::persistency::Session initialize()
Definition: PopCon.cc:37
std::string lastPayloadToken
Definition: Types.h:77
bool existsIov(const std::string &tag)
Definition: Session.cc:97
std::string m_authPath
Definition: PopCon.h:65
virtual ~PopCon()
Definition: PopCon.cc:30
void setAuthenticationPath(const std::string &p)
std::string m_payload_name
Definition: PopCon.h:71
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:59
#define constexpr
Time_t till
Definition: Types.h:56