CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PopCon.cc
Go to the documentation of this file.
5 #include <iostream>
6 
7 namespace popcon {
8 
10  m_record(pset.getParameter<std::string> ("record")),
11  m_payload_name(pset.getUntrackedParameter<std::string> ("name","")),
12  m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
13  m_IsDestDbCheckedInQueryLog(pset.getUntrackedParameter< bool > ("IsDestDbCheckedInQueryLog",true)),
14  m_close(pset.getUntrackedParameter< bool > ("closeIOV",false)),
15  m_lastTill(pset.getUntrackedParameter< bool > ("lastTill",0))
16  {
17  //TODO set the policy (cfg or global configuration?)
18  //Policy if corrupted data found
19 
20  edm::LogInfo ("PopCon") << "This is PopCon (Populator of Condition) V4.0\n"
21  << "Please report any problem and feature request through the savannah portal under the category conditions\n" ;
22 
23  }
24 
26 
27 
29  edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
30  if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
31  const std::string & connectionStr = m_dbService->session().connectionString();
36  // m_dbService->queryLog().LookupLastEntryByTag(m_tag, m_logDBEntry);
39  std::cout << " ------ log info searched in the same db: " << connectionStr << "------" <<std::endl;
40  } else {
42  std::cout << " ------ log info found in another db " << "------" <<std::endl;
43  }
44 
45  edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
46  << "TAG: " << m_tag
47  << ", last since/till: " << m_tagInfo.lastInterval.first
48  << "/" << m_tagInfo.lastInterval.second
49  << ", , size: " << m_tagInfo.size << "\n"
50  << "Last writer: " << m_logDBEntry.provenance
51  << ", size: " << m_logDBEntry.payloadIdx+1 << std::endl;
52  } else {
53  edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
54  << "TAG: " << m_tag
55  << "; First writer to this new tag." << std::endl;
56  }
57  }
58 
59 
60  void PopCon::finalize(Time_t lastTill) {
61 
62  if (m_close) {
63  // avoid to close it before lastSince
64  if (m_lastTill>lastTill) lastTill=m_lastTill;
65  m_dbService->closeIOV(lastTill,m_record);
66  }
67  }
68 
69 }
const std::string & connectionString() const
Definition: DbSession.cc:169
cond::LogDBEntry m_logDBEntry
Definition: PopCon.h:82
void closeIOV(Time_t lastTill, const std::string &recordName, bool withlogging=false)
void finalize(Time_t lastTill)
Definition: PopCon.cc:60
unsigned int payloadIdx
Definition: LogDBEntry.h:23
Time_t m_lastTill
Definition: PopCon.h:85
bool m_close
Definition: PopCon.h:84
cond::Time_t Time_t
Definition: PopCon.h:45
std::string m_tag
Definition: PopCon.h:78
std::string m_record
Definition: PopCon.h:70
std::string tag(const std::string &recordName)
std::string name
Definition: TagInfo.h:9
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:47
size_t size
Definition: TagInfo.h:13
PopCon(const edm::ParameterSet &pset)
Definition: PopCon.cc:9
void tagInfo(const std::string &recordName, cond::TagInfo &result)
bool m_IsDestDbCheckedInQueryLog
Definition: PopCon.h:76
void initialize()
Definition: PopCon.cc:28
std::string provenance
Definition: LogDBEntry.h:19
cond::TagInfo m_tagInfo
Definition: PopCon.h:80
virtual ~PopCon()
Definition: PopCon.cc:25
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
void LookupLastEntryByTag(const std::string &iovtag, LogDBEntry &logentry, bool filterFailedOp=true) const
Definition: Logger.cc:289
tuple cout
Definition: gather_cfg.py:121
std::string m_payload_name
Definition: PopCon.h:72
const cond::Logger & queryLog() const
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:68