CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
QTestStatusChecker Class Reference

#include <QTestStatusChecker.h>

Public Member Functions

std::map< std::string, std::vector< std::string > > checkDetailedStatus (DQMStore *bei)
 Check status of quality tests for individual ME's. More...
 
std::pair< std::string, std::string > checkGlobalStatus (DQMStore *bei)
 Check global status of Quality tests, returns a pair of string: message and color relative to global status. More...
 
std::vector< std::string > fullPathNames (DQMStore *bei)
 
void processAlarms (const std::vector< std::string > &allPathNames, DQMStore *bei)
 
 QTestStatusChecker ()
 Creator. More...
 
 ~QTestStatusChecker ()
 Destructor. More...
 

Private Types

typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 

Private Attributes

std::map< std::string, std::vector< std::string > > detailedWarnings
 

Detailed Description

Definition at line 18 of file QTestStatusChecker.h.

Member Typedef Documentation

Definition at line 19 of file QTestStatusChecker.h.

Definition at line 20 of file QTestStatusChecker.h.

Constructor & Destructor Documentation

QTestStatusChecker::QTestStatusChecker ( )

Creator.

Definition at line 12 of file QTestStatusChecker.cc.

12 {}
QTestStatusChecker::~QTestStatusChecker ( )

Destructor.

Definition at line 14 of file QTestStatusChecker.cc.

14 {}

Member Function Documentation

std::map< std::string, std::vector< std::string > > QTestStatusChecker::checkDetailedStatus ( DQMStore bei)

Check status of quality tests for individual ME's.

Definition at line 40 of file QTestStatusChecker.cc.

References detailedWarnings, fullPathNames(), and processAlarms().

Referenced by QTestHandle::checkDetailedQTStatus().

40  {
41  std::vector<std::string> allPathNames = this->fullPathNames(bei);
42  detailedWarnings.clear();
43 
44  this->processAlarms(allPathNames, bei);
45  return detailedWarnings;
46 }
void processAlarms(const std::vector< std::string > &allPathNames, DQMStore *bei)
std::vector< std::string > fullPathNames(DQMStore *bei)
std::map< std::string, std::vector< std::string > > detailedWarnings
std::pair< std::string, std::string > QTestStatusChecker::checkGlobalStatus ( DQMStore bei)

Check global status of Quality tests, returns a pair of string: message and color relative to global status.

Definition at line 16 of file QTestStatusChecker.cc.

References dqm::qstatus::ERROR, dqm::dqmstoreimpl::DQMStore::getStatus(), dqm::qstatus::OTHER, mps_update::status, and dqm::qstatus::WARNING.

Referenced by QTestHandle::checkGlobalQTStatus().

16  {
17  std::pair<std::string, std::string> statement;
18  int status = bei->getStatus();
19  switch (status) {
21  statement.first = "Errors detected in quality tests";
22  statement.second = "red";
23  break;
25  statement.first = "Warnings detected in quality tests";
26  statement.second = "orange";
27  break;
29  statement.first = "Some tests did not run";
30  statement.second = "black";
31  break;
32  default:
33  statement.first = "No problems detected in quality tests ";
34  statement.second = "green";
35  }
36 
37  return statement;
38 }
static const int OTHER
static const int WARNING
static const int ERROR
std::vector< std::string > QTestStatusChecker::fullPathNames ( DQMStore bei)

Definition at line 88 of file QTestStatusChecker.cc.

References relmon_rootfiles_spy::contents, TrackerOfflineValidation_Dqm_cff::dirName, reco_skim_cfg_mod::fullpath, dqm::dqmstoreimpl::DQMStore::getContents(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by checkDetailedStatus().

88  {
89  std::vector<std::string> contents;
90  std::vector<std::string> contentVec;
91  bei->getContents(contentVec);
92  for (std::vector<std::string>::iterator it = contentVec.begin(); it != contentVec.end(); it++) {
93  std::string::size_type dirCharNumber = it->find(":", 0);
94  std::string dirName = it->substr(0, dirCharNumber);
95  dirName += "/";
96  std::string meCollectionName = it->substr(dirCharNumber + 1);
97 
98  std::string reminingNames = meCollectionName;
99  bool anotherME = true;
100  while (anotherME) {
101  if (reminingNames.find(",") == std::string::npos)
102  anotherME = false;
103  std::string::size_type singleMeNameCharNumber = reminingNames.find(",", 0);
104  std::string singleMeName = reminingNames.substr(0, singleMeNameCharNumber);
105  std::string fullpath = dirName + singleMeName;
106  contents.push_back(fullpath);
107  reminingNames = reminingNames.substr(singleMeNameCharNumber + 1);
108  }
109  }
110 
111  return contents;
112 }
uint16_t size_type
void QTestStatusChecker::processAlarms ( const std::vector< std::string > &  allPathNames,
DQMStore bei 
)

Definition at line 48 of file QTestStatusChecker.cc.

References detailedWarnings, dqm::dqmstoreimpl::DQMStore::get(), dqm::impl::MonitorElement::getQErrors(), dqm::impl::MonitorElement::getQOthers(), dqm::impl::MonitorElement::getQWarnings(), dqm::impl::MonitorElement::hasError(), dqm::impl::MonitorElement::hasOtherReport(), dqm::impl::MonitorElement::hasWarning(), hlt_dqm_clientPB-live_cfg::me, edmIntegrityCheck::report, AlCaHLTBitMon_QueryRunRegistry::string, and runonSM::text.

Referenced by checkDetailedStatus().

48  {
49  for (std::vector<std::string>::const_iterator fullMePath = allPathNames.begin(); fullMePath != allPathNames.end();
50  ++fullMePath) {
51  MonitorElement *me = nullptr;
52  me = bei->get(*fullMePath);
53 
54  if (me) {
55  std::vector<QReport *> report;
56  std::string colour;
57 
58  if (me->hasError()) {
59  colour = "red";
60  report = me->getQErrors();
61  }
62  if (me->hasWarning()) {
63  colour = "orange";
64  report = me->getQWarnings();
65  }
66  if (me->hasOtherReport()) {
67  colour = "black";
68  report = me->getQOthers();
69  }
70  for (std::vector<QReport *>::iterator itr = report.begin(); itr != report.end(); ++itr) {
71  std::string text = (*fullMePath) + (*itr)->getMessage();
72  std::vector<std::string> messageList;
73 
74  if (detailedWarnings.find(colour) == detailedWarnings.end()) {
75  messageList.push_back(text);
76  detailedWarnings[colour] = messageList;
77 
78  } else {
79  messageList = detailedWarnings[colour];
80  messageList.push_back(text);
81  detailedWarnings[colour] = messageList;
82  }
83  }
84  }
85  }
86 }
std::vector< QReport * > getQWarnings() const
get warnings from last set of quality tests
bool hasOtherReport() const
true if at least of one of the tests returned some other (non-ok) status
std::vector< QReport * > getQErrors() const
get errors from last set of quality tests
bool hasWarning() const
true if at least of one of the quality tests returned a warning
std::vector< QReport * > getQOthers() const
from last set of quality tests
bool hasError() const
true if at least of one of the quality tests returned an error
std::map< std::string, std::vector< std::string > > detailedWarnings

Member Data Documentation

std::map<std::string, std::vector<std::string> > QTestStatusChecker::detailedWarnings
private

Definition at line 36 of file QTestStatusChecker.h.

Referenced by checkDetailedStatus(), and processAlarms().