Skip to content

Commit

Permalink
Merge pull request #36801 from Dr15Jones/moreTransitionsMessageLogger
Browse files Browse the repository at this point in the history
Add more module transitions to MessageLogger
  • Loading branch information
cmsbuild authored Jan 26, 2022
2 parents 70c9065 + b1520ab commit 5b05326
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
42 changes: 42 additions & 0 deletions FWCore/MessageService/plugins/MessageLogger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@

#include "DataFormats/Provenance/interface/ModuleDescription.h"

#include "FWCore/Framework/interface/ComponentDescription.h"
#include "FWCore/MessageLogger/interface/JobReport.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
#include "FWCore/ServiceRegistry/interface/SystemBounds.h"
#include "FWCore/ServiceRegistry/interface/StreamContext.h"
#include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
#include "FWCore/ServiceRegistry/interface/ESModuleCallingContext.h"
#include "FWCore/ServiceRegistry/interface/GlobalContext.h"
#include "FWCore/ServiceRegistry/interface/PathContext.h"

Expand Down Expand Up @@ -284,10 +286,14 @@ namespace edm {
iRegistry.watchPostModuleGlobalBeginRun(this, &MessageLogger::postModuleGlobalBeginRun);
iRegistry.watchPreModuleGlobalEndRun(this, &MessageLogger::preModuleGlobalEndRun);
iRegistry.watchPostModuleGlobalEndRun(this, &MessageLogger::postModuleGlobalEndRun);
iRegistry.watchPreModuleWriteRun(this, &MessageLogger::preModuleWriteRun);
iRegistry.watchPostModuleWriteRun(this, &MessageLogger::postModuleWriteRun);
iRegistry.watchPreModuleGlobalBeginLumi(this, &MessageLogger::preModuleGlobalBeginLumi);
iRegistry.watchPostModuleGlobalBeginLumi(this, &MessageLogger::postModuleGlobalBeginLumi);
iRegistry.watchPreModuleGlobalEndLumi(this, &MessageLogger::preModuleGlobalEndLumi);
iRegistry.watchPostModuleGlobalEndLumi(this, &MessageLogger::postModuleGlobalEndLumi);
iRegistry.watchPreModuleWriteLumi(this, &MessageLogger::preModuleWriteLumi);
iRegistry.watchPostModuleWriteLumi(this, &MessageLogger::postModuleWriteLumi);

iRegistry.watchPreEvent(this, &MessageLogger::preEvent);
iRegistry.watchPostEvent(this, &MessageLogger::postEvent);
Expand Down Expand Up @@ -320,6 +326,9 @@ namespace edm {
iRegistry.watchPrePathEvent(this, &MessageLogger::prePathEvent);
iRegistry.watchPostPathEvent(this, &MessageLogger::postPathEvent);

iRegistry.watchPreESModule(this, &MessageLogger::preESModule);
iRegistry.watchPostESModule(this, &MessageLogger::postESModule);

MessageDrop* messageDrop = MessageDrop::instance();
nonModule_debugEnabled = messageDrop->debugEnabled;
nonModule_infoEnabled = messageDrop->infoEnabled;
Expand Down Expand Up @@ -702,6 +711,15 @@ namespace edm {
unEstablishModule(mod, "AfterModGlobalEndLumi");
}

void MessageLogger::preModuleWriteLumi(GlobalContext const& context, ModuleCallingContext const& mod) {
establishModule(lumiInfoBegin_ + context.luminosityBlockIndex().value(),
mod,
s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kWriteLuminosityBlock)]);
}
void MessageLogger::postModuleWriteLumi(GlobalContext const& stream, ModuleCallingContext const& mod) {
unEstablishModule(mod, "AfterModWriteLumi");
}

void MessageLogger::preModuleGlobalEndRun(GlobalContext const& context, ModuleCallingContext const& mod) {
establishModule(runInfoBegin_ + context.runIndex().value(),
mod,
Expand All @@ -711,6 +729,15 @@ namespace edm {
unEstablishModule(mod, "AfterModGlobalEndRun");
}

void MessageLogger::preModuleWriteRun(GlobalContext const& context, ModuleCallingContext const& mod) {
establishModule(runInfoBegin_ + context.runIndex().value(),
mod,
s_globalTransitionNames[static_cast<int>(GlobalContext::Transition::kWriteRun)]);
}
void MessageLogger::postModuleWriteRun(GlobalContext const& stream, ModuleCallingContext const& mod) {
unEstablishModule(mod, "AfterModWriteRun");
}

void MessageLogger::preModuleEndStream(StreamContext const&, ModuleCallingContext const& mcc) {
ModuleDescription const& desc = *mcc.moduleDescription();
establishModule(desc, "@endStream"); // ChangeLog 13
Expand All @@ -728,6 +755,21 @@ namespace edm {
unEstablishModule(iDescription, "AfterModEndJob");
}

void MessageLogger::preESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const& context) {
MessageDrop* messageDrop = MessageDrop::instance();
auto desc = context.componentDescription();
// std::cerr << "establishModule( " << desc.moduleName() << ")\n";
// Change Log 17
auto label = &desc->label_;
if (label->empty() or (*label)[0] == '\0') {
label = &desc->type_;
}
messageDrop->setModuleWithPhase(desc->type_, *label, desc->id_, "@callESModule");
}
void MessageLogger::postESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const&) {
MessageDrop* messageDrop = MessageDrop::instance();
messageDrop->setSinglet("@finishedCallESModule"); // Change Log 17
}
//
// callbacks that don't know about the module
//
Expand Down
7 changes: 7 additions & 0 deletions FWCore/MessageService/plugins/MessageLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@ namespace edm {
void postModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&);
void preModuleGlobalEndRun(GlobalContext const&, ModuleCallingContext const&);
void postModuleGlobalEndRun(GlobalContext const&, ModuleCallingContext const&);
void preModuleWriteRun(GlobalContext const&, ModuleCallingContext const&);
void postModuleWriteRun(GlobalContext const&, ModuleCallingContext const&);

void preModuleGlobalBeginLumi(GlobalContext const&, ModuleCallingContext const&);
void postModuleGlobalBeginLumi(GlobalContext const&, ModuleCallingContext const&);
void preModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&);
void postModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&);
void preModuleWriteLumi(GlobalContext const&, ModuleCallingContext const&);
void postModuleWriteLumi(GlobalContext const&, ModuleCallingContext const&);

void preBeginProcessBlock(GlobalContext const&);
void postBeginProcessBlock(GlobalContext const&);
Expand All @@ -150,6 +154,9 @@ namespace edm {
void prePathEvent(StreamContext const&, PathContext const&);
void postPathEvent(StreamContext const&, PathContext const&, HLTPathStatus const&);

void preESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const&);
void postESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const&);

// set up the module name in the message drop, and the enable/suppress info
void establishModule(const ModuleDescription& desc, const char* whichPhase);
void unEstablishModule(const ModuleDescription& desc, const char* whichPhase);
Expand Down

0 comments on commit 5b05326

Please sign in to comment.