Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more module transitions to MessageLogger #36801

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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