diff --git a/FWCore/MessageService/plugins/MessageLogger.cc b/FWCore/MessageService/plugins/MessageLogger.cc index 682d862d71466..a914262c1e320 100644 --- a/FWCore/MessageService/plugins/MessageLogger.cc +++ b/FWCore/MessageService/plugins/MessageLogger.cc @@ -23,6 +23,7 @@ #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" @@ -30,6 +31,7 @@ #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" @@ -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); @@ -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; @@ -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(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, @@ -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(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 @@ -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 // diff --git a/FWCore/MessageService/plugins/MessageLogger.h b/FWCore/MessageService/plugins/MessageLogger.h index c236a3b4405e4..ec18f2f8e8299 100644 --- a/FWCore/MessageService/plugins/MessageLogger.h +++ b/FWCore/MessageService/plugins/MessageLogger.h @@ -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&); @@ -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);