CMS 3D CMS Logo

LogErrorHarvester.cc
Go to the documentation of this file.
1 //
2 // Package: LogErrorHarvester
3 // Class: LogErrorHarvester
4 
13 //
14 // Original Author: Giovanni Petrucciani
15 // Created: Thu Dec 4 16:22:40 CET 2008
16 //
17 
18 // user include files
30 
31 // system include files
32 #include <memory>
33 #include <unordered_set>
34 #include <string>
35 
36 //
37 // class decleration
38 //
39 
40 namespace edm {
42  public:
43  explicit LogErrorHarvester(ParameterSet const&);
44  static void fillDescriptions(ConfigurationDescriptions& descriptions);
45 
46  private:
47  void beginJob() override;
48  void produce(StreamID, Event&, EventSetup const&) const override;
49  void endJob() override;
51  };
52 
53  LogErrorHarvester::LogErrorHarvester(ParameterSet const& iPSet) : token_{produces<std::vector<ErrorSummaryEntry>>()} {
54  const edm::TypeID endPathStatusType{typeid(edm::EndPathStatus)};
55  const edm::TypeID pathStatusType{typeid(edm::PathStatus)};
56  const edm::TypeID triggerResultsType{typeid(edm::TriggerResults)};
57 
58  auto const& ignore = iPSet.getUntrackedParameter<std::vector<std::string>>("excludeModules");
59  const std::unordered_set<std::string> excludedModules(ignore.begin(), ignore.end());
60 
61  auto const& includeM = iPSet.getUntrackedParameter<std::vector<std::string>>("includeModules");
62  const std::unordered_set<std::string> includeModules(includeM.begin(), includeM.end());
63 
64  //Need to be sure to run only after all other EDProducers have run
65  callWhenNewProductsRegistered(
66  [this, endPathStatusType, pathStatusType, triggerResultsType, excludedModules, includeModules](
67  edm::BranchDescription const& iBD) {
68  if ((iBD.branchType() == edm::InEvent and moduleDescription().processName() == iBD.processName()) and
69  ((includeModules.empty() or includeModules.end() != includeModules.find(iBD.moduleLabel())) and
70  (iBD.unwrappedTypeID() != endPathStatusType and iBD.unwrappedTypeID() != pathStatusType and
71  iBD.unwrappedTypeID() != triggerResultsType))) {
72  if (excludedModules.end() == excludedModules.find(iBD.moduleLabel())) {
75  }
76  }
77  });
78  }
79 
80  void LogErrorHarvester::produce(StreamID const sid, Event& iEvent, EventSetup const&) const {
81  const auto index = sid.value();
82  if (!FreshErrorsExist(index)) {
83  //puts a default constructed product in the event
84  iEvent.emplace(token_);
85  } else {
86  auto mlSummary = LoggedErrorsSummary(index);
87  std::vector<edm::ErrorSummaryEntry> summary;
88  summary.reserve(mlSummary.size());
89  for (auto& entry : mlSummary) {
91  e.category = std::move(entry.category);
92  e.module = std::move(entry.module);
93  e.severity = edm::ELseverityLevel(entry.severity.getLevel());
94  e.count = entry.count;
95  summary.emplace_back(std::move(e));
96  }
97  iEvent.emplace(token_, summary);
98  }
99  }
100 
101  // ------------ method called once each job just before starting event loop ------------
103 
104  // ------------ method called once each job just after ending the event loop ------------
106 
107  // ------------ method called once each job for validation ------------
110  desc.addUntracked<std::vector<std::string>>("excludeModules", std::vector<std::string>{})
111  ->setComment("List of module labels to exclude from consumes.");
112  desc.addUntracked<std::vector<std::string>>("includeModules", std::vector<std::string>{})
113  ->setComment("List of the only module labels to include in consumes. The empty list will include all.");
114  descriptions.add("logErrorHarvester", desc);
115  }
116 } // namespace edm
117 
118 //define this as a plug-in
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition: BranchDescription.h:81
edm::PRODUCT_TYPE
Definition: ProductKindOfType.h:5
TriggerResults.h
edm::LogErrorHarvester::token_
EDPutTokenT< std::vector< ErrorSummaryEntry > > token_
Definition: LogErrorHarvester.cc:50
edm
HLT enums.
Definition: AlignableModifier.h:19
mps_splice.entry
entry
Definition: mps_splice.py:68
edm::EDPutTokenT
Definition: EDPutToken.h:33
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::EndPathStatus
Definition: EndPathStatus.h:5
EndPathStatus.h
LoggedErrorsSummary.h
edm::StreamID::value
unsigned int value() const
Definition: StreamID.h:43
edm::PathStatus
HLTPathStatus PathStatus
Definition: PathStatus.h:7
edm::ErrorSummaryEntry
Definition: ErrorSummaryEntry.h:36
edm::DisableLoggedErrorsSummary
bool DisableLoggedErrorsSummary()
Definition: MessageSender.cc:156
MakerMacros.h
edm::LogErrorHarvester
Definition: LogErrorHarvester.cc:41
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::BranchDescription::processName
std::string const & processName() const
Definition: BranchDescription.h:73
edm::LogErrorHarvester::beginJob
void beginJob() override
Definition: LogErrorHarvester.cc:102
edm::LogErrorHarvester::endJob
void endJob() override
Definition: LogErrorHarvester.cc:105
edm::BranchDescription::unwrappedTypeID
TypeID unwrappedTypeID() const
Definition: BranchDescription.h:98
edm::InEvent
Definition: BranchType.h:11
ParameterSetDescription.h
edm::LogErrorHarvester::LogErrorHarvester
LogErrorHarvester(ParameterSet const &)
Definition: LogErrorHarvester.cc:53
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
edm::EnableLoggedErrorsSummary
bool EnableLoggedErrorsSummary()
Definition: MessageSender.cc:151
Event.h
PathStatus.h
edm::LogErrorHarvester::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: LogErrorHarvester.cc:108
EDPutToken.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
Reconstruction_cff.includeModules
includeModules
Definition: Reconstruction_cff.py:209
edm::BranchDescription::branchType
BranchType const & branchType() const
Definition: BranchDescription.h:122
edm::EventSetup
Definition: EventSetup.h:58
edm::LogErrorHarvester::produce
void produce(StreamID, Event &, EventSetup const &) const override
Definition: LogErrorHarvester.cc:80
edm::LoggedErrorsSummary
std::vector< messagelogger::ErrorSummaryEntry > LoggedErrorsSummary(unsigned int iStreamID)
Definition: MessageSender.cc:166
SequenceTypes.ignore
def ignore(seq)
Definition: SequenceTypes.py:630
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::TypeID
Definition: TypeID.h:22
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ELseverityLevel
Definition: ELseverityLevel.h:26
ErrorSummaryEntry.h
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::BranchDescription
Definition: BranchDescription.h:32
edm::FreshErrorsExist
bool FreshErrorsExist(unsigned int iStreamID)
Definition: MessageSender.cc:161
EDProducer.h
edm::TypeToGet
Definition: TypeToGet.h:32
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37