From af3125e0a3f5f6a654666f00b2b777be0ac0de3f Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Mon, 16 Mar 2020 23:09:13 +0100 Subject: [PATCH 01/25] Add ProcessBlock feature to Framework This is only the first of a series of PRs implementing this feature. Future PRs will add persistency and the ability to access this information from Events, Runs, and Lumis. --- .../Provenance/interface/BranchDescription.h | 6 +- DataFormats/Provenance/interface/BranchType.h | 4 - .../Provenance/interface/ProductRegistry.h | 10 +- .../interface/ProductResolverIndexHelper.h | 2 +- DataFormats/Provenance/src/BranchType.cc | 57 +- DataFormats/Provenance/src/ProductRegistry.cc | 22 +- FWCore/Framework/interface/BranchActionType.h | 5 +- FWCore/Framework/interface/EDAnalyzer.h | 4 + FWCore/Framework/interface/EDConsumerBase.h | 14 +- FWCore/Framework/interface/EDFilter.h | 4 + FWCore/Framework/interface/EDProducer.h | 4 + FWCore/Framework/interface/EventProcessor.h | 5 + FWCore/Framework/interface/EventSetupImpl.h | 9 + FWCore/Framework/interface/Frameworkfwd.h | 2 + .../interface/FrameworkfwdMostUsed.h | 1 + FWCore/Framework/interface/InputSource.h | 3 + FWCore/Framework/interface/OccurrenceTraits.h | 108 +++ FWCore/Framework/interface/Principal.h | 2 + FWCore/Framework/interface/ProcessBlock.h | 232 +++++ .../interface/ProcessBlockPrincipal.h | 44 + FWCore/Framework/interface/ProducerBase.h | 7 +- .../interface/ProductRegistryHelper.h | 7 +- FWCore/Framework/interface/Schedule.h | 5 + FWCore/Framework/interface/SubProcess.h | 18 +- .../Framework/interface/global/EDAnalyzer.h | 1 + .../interface/global/EDAnalyzerBase.h | 7 + FWCore/Framework/interface/global/EDFilter.h | 8 + .../Framework/interface/global/EDFilterBase.h | 9 + .../Framework/interface/global/EDProducer.h | 8 + .../interface/global/EDProducerBase.h | 9 + .../Framework/interface/global/OutputModule.h | 1 + .../interface/global/OutputModuleBase.h | 5 + .../global/analyzerAbilityToImplementor.h | 5 + .../global/filterAbilityToImplementor.h | 15 + .../Framework/interface/global/implementors.h | 64 ++ .../global/producerAbilityToImplementor.h | 15 + .../Framework/interface/limited/EDAnalyzer.h | 1 + .../interface/limited/EDAnalyzerBase.h | 7 + FWCore/Framework/interface/limited/EDFilter.h | 8 + .../interface/limited/EDFilterBase.h | 9 + .../Framework/interface/limited/EDProducer.h | 8 + .../interface/limited/EDProducerBase.h | 9 + .../interface/limited/OutputModule.h | 1 + .../interface/limited/OutputModuleBase.h | 5 + .../limited/analyzerAbilityToImplementor.h | 5 + .../limited/filterAbilityToImplementor.h | 15 + .../interface/limited/implementors.h | 64 ++ .../limited/producerAbilityToImplementor.h | 15 + FWCore/Framework/interface/moduleAbilities.h | 39 +- .../Framework/interface/moduleAbilityEnums.h | 3 + FWCore/Framework/interface/one/EDAnalyzer.h | 1 + .../Framework/interface/one/EDAnalyzerBase.h | 7 + FWCore/Framework/interface/one/EDFilter.h | 8 + FWCore/Framework/interface/one/EDFilterBase.h | 9 + FWCore/Framework/interface/one/EDProducer.h | 8 + .../Framework/interface/one/EDProducerBase.h | 9 + FWCore/Framework/interface/one/OutputModule.h | 1 + .../interface/one/OutputModuleBase.h | 5 + .../one/analyzerAbilityToImplementor.h | 5 + .../one/filterAbilityToImplementor.h | 15 + FWCore/Framework/interface/one/implementors.h | 64 ++ .../one/producerAbilityToImplementor.h | 15 + .../interface/stream/AbilityChecker.h | 18 + .../interface/stream/AbilityToImplementor.h | 15 + .../interface/stream/EDAnalyzerAdaptor.h | 40 +- .../interface/stream/EDAnalyzerAdaptorBase.h | 4 + FWCore/Framework/interface/stream/EDFilter.h | 7 + .../Framework/interface/stream/EDProducer.h | 7 + .../interface/stream/ProducingModuleAdaptor.h | 64 +- .../stream/ProducingModuleAdaptorBase.h | 8 + .../interface/stream/callAbilities.h | 67 ++ .../Framework/interface/stream/implementors.h | 36 + FWCore/Framework/src/EDConsumerBase.cc | 9 + FWCore/Framework/src/EventProcessor.cc | 120 +++ FWCore/Framework/src/InputSource.cc | 2 + .../Framework/src/OutputModuleCommunicator.h | 9 +- .../src/OutputModuleCommunicatorT.cc | 43 +- .../Framework/src/OutputModuleCommunicatorT.h | 5 + FWCore/Framework/src/Principal.cc | 36 +- FWCore/Framework/src/PrincipalCache.cc | 7 + FWCore/Framework/src/PrincipalCache.h | 13 +- FWCore/Framework/src/ProcessBlock.cc | 54 ++ FWCore/Framework/src/ProcessBlockPrincipal.cc | 31 + FWCore/Framework/src/ProductRegistryHelper.cc | 15 +- FWCore/Framework/src/ProductResolvers.cc | 6 +- FWCore/Framework/src/Schedule.cc | 43 + FWCore/Framework/src/ScheduleItems.cc | 5 + FWCore/Framework/src/SubProcess.cc | 87 +- FWCore/Framework/src/TransitionProcessors.icc | 35 +- FWCore/Framework/src/Worker.cc | 11 +- FWCore/Framework/src/Worker.h | 104 ++- FWCore/Framework/src/WorkerManager.cc | 4 + FWCore/Framework/src/WorkerT.cc | 23 + FWCore/Framework/src/WorkerT.h | 4 + FWCore/Framework/src/global/EDAnalyzerBase.cc | 26 +- FWCore/Framework/src/global/EDFilterBase.cc | 33 + FWCore/Framework/src/global/EDProducerBase.cc | 33 + .../Framework/src/global/OutputModuleBase.cc | 13 + .../src/global/filterImplementors.cc | 2 + .../src/global/implementorsMethods.h | 10 + .../src/global/producerImplementors.cc | 2 + FWCore/Framework/src/globalTransitionAsync.h | 75 +- .../Framework/src/limited/EDAnalyzerBase.cc | 25 + FWCore/Framework/src/limited/EDFilterBase.cc | 33 + .../Framework/src/limited/EDProducerBase.cc | 33 + .../Framework/src/limited/OutputModuleBase.cc | 13 + .../src/limited/filterImplementors.cc | 2 + .../src/limited/implementorsMethods.h | 10 + .../src/limited/producerImplementors.cc | 2 + FWCore/Framework/src/one/EDAnalyzerBase.cc | 26 + FWCore/Framework/src/one/EDFilterBase.cc | 33 + FWCore/Framework/src/one/EDProducerBase.cc | 33 + FWCore/Framework/src/one/OutputModuleBase.cc | 5 + .../Framework/src/one/filterImplementors.cc | 2 + .../Framework/src/one/implementorsMethods.h | 10 + .../Framework/src/one/producerImplementors.cc | 2 + FWCore/Framework/test/MockEventProcessor.cc | 4 + FWCore/Framework/test/MockEventProcessor.h | 4 + .../test/stubs/TestGlobalAnalyzers.cc | 86 +- .../Framework/test/stubs/TestGlobalFilters.cc | 187 +++- .../test/stubs/TestGlobalProducers.cc | 183 +++- .../test/stubs/TestLimitedAnalyzers.cc | 88 +- .../test/stubs/TestLimitedFilters.cc | 192 +++- .../test/stubs/TestLimitedProducers.cc | 192 +++- .../Framework/test/stubs/TestOneAnalyzers.cc | 87 +- FWCore/Framework/test/stubs/TestOneFilters.cc | 191 +++- .../Framework/test/stubs/TestOneProducers.cc | 187 +++- .../test/stubs/TestStreamAnalyzers.cc | 108 ++- .../Framework/test/stubs/TestStreamFilters.cc | 231 ++++- .../test/stubs/TestStreamProducers.cc | 236 ++++- .../Framework/test/stubs/ToyIntProducers.cc | 125 ++- .../Framework/test/test_global_modules_cfg.py | 98 ++- .../test/test_limited_modules_cfg.py | 111 ++- .../Framework/test/test_non_event_ordering.sh | 6 + ...on_event_ordering_beginProcessBlock_cfg.py | 18 + ..._non_event_ordering_endProcessBlock_cfg.py | 21 + ...st_non_event_ordering_multithreaded_cfg.py | 52 ++ FWCore/Framework/test/test_one_modules_cfg.py | 100 ++- .../Framework/test/test_stream_modules_cfg.py | 100 ++- .../test_deepCall_unscheduled.log | 6 + .../test_onPath_unscheduled.log | 6 + FWCore/Integration/test/TestFindProduct.cc | 83 +- .../Integration/test/testConsumesInfo_cfg.py | 53 +- FWCore/Integration/test/testGetBy1_cfg.py | 31 +- .../Integration/test/testProcessBlock_cfg.py | 14 + .../unit_test_outputs/testConsumesInfo_1.log | 49 +- .../test/unit_test_outputs/testGetBy1.log | 828 ++++++++++++++---- .../test/unit_test_outputs/testGetBy2.log | 38 + .../testSubProcess.grep2.txt | 52 ++ .../MessageService/interface/MessageLogger.h | 14 + FWCore/MessageService/src/MessageLogger.cc | 86 +- .../MessageService/test/UnitTestClient_V.cc | 12 +- FWCore/MessageService/test/UnitTestClient_V.h | 23 +- .../test/unit_test_outputs/u33_all.log | 78 +- .../interface/ActivityRegistry.h | 113 +++ .../ServiceRegistry/interface/GlobalContext.h | 7 +- .../ServiceRegistry/src/ActivityRegistry.cc | 48 + FWCore/ServiceRegistry/src/GlobalContext.cc | 24 + FWCore/Services/plugins/Tracer.cc | 225 ++++- FWCore/TestProcessor/interface/ProcessBlock.h | 62 ++ .../TestProcessor/interface/TestProcessor.h | 32 +- FWCore/TestProcessor/src/ProcessBlock.cc | 24 + FWCore/TestProcessor/src/TestProcessor.cc | 104 ++- .../test/testprocessor_t.cppunit.cc | 58 ++ FWCore/Utilities/interface/BranchType.h | 6 +- .../Utilities/interface/ProcessBlockIndex.h | 47 + FWCore/Utilities/interface/Transition.h | 22 +- FWCore/Utilities/src/ProcessBlockIndex.cc | 10 + IOPool/Input/src/RootFile.cc | 24 +- IOPool/Output/src/PoolOutputModule.cc | 4 + IOPool/Output/src/RootOutputFile.cc | 13 + 171 files changed, 6785 insertions(+), 431 deletions(-) create mode 100644 FWCore/Framework/interface/ProcessBlock.h create mode 100644 FWCore/Framework/interface/ProcessBlockPrincipal.h create mode 100644 FWCore/Framework/src/ProcessBlock.cc create mode 100644 FWCore/Framework/src/ProcessBlockPrincipal.cc create mode 100644 FWCore/Framework/test/test_non_event_ordering_beginProcessBlock_cfg.py create mode 100644 FWCore/Framework/test/test_non_event_ordering_endProcessBlock_cfg.py create mode 100644 FWCore/Framework/test/test_non_event_ordering_multithreaded_cfg.py create mode 100644 FWCore/Integration/test/testProcessBlock_cfg.py create mode 100644 FWCore/TestProcessor/interface/ProcessBlock.h create mode 100644 FWCore/TestProcessor/src/ProcessBlock.cc create mode 100644 FWCore/Utilities/interface/ProcessBlockIndex.h create mode 100644 FWCore/Utilities/src/ProcessBlockIndex.cc diff --git a/DataFormats/Provenance/interface/BranchDescription.h b/DataFormats/Provenance/interface/BranchDescription.h index b5667c04bfa08..aa0281cd9b1f5 100644 --- a/DataFormats/Provenance/interface/BranchDescription.h +++ b/DataFormats/Provenance/interface/BranchDescription.h @@ -52,7 +52,7 @@ namespace edm { BranchDescription(BranchDescription const& aliasForBranch, std::string const& moduleLabelAlias, - std::string const& poruductInstanceAlias); + std::string const& productInstanceAlias); ~BranchDescription() {} @@ -142,10 +142,10 @@ namespace edm { // This is set if and only if produced_ is true. std::string moduleName_; - // The branch name, which is currently derivable fron the other attributes. + // The branch name, which is currently derivable from the other attributes. std::string branchName_; - // The wrapped class name, which is currently derivable fron the other attributes. + // The wrapped class name, which is currently derivable from the other attributes. std::string wrappedName_; // For SwitchProducer alias, the label of the aliased-for label; otherwise empty diff --git a/DataFormats/Provenance/interface/BranchType.h b/DataFormats/Provenance/interface/BranchType.h index 2e2e42b28e919..d116fad2cc4dc 100644 --- a/DataFormats/Provenance/interface/BranchType.h +++ b/DataFormats/Provenance/interface/BranchType.h @@ -27,10 +27,6 @@ namespace edm { std::string const& BranchTypeToProductProvenanceBranchName(BranchType const& BranchType); - std::string const& BranchTypeToMajorIndexName(BranchType const& branchType); - - std::string const& BranchTypeToMinorIndexName(BranchType const& branchType); - std::ostream& operator<<(std::ostream& os, BranchType const& branchType); namespace poolNames { diff --git a/DataFormats/Provenance/interface/ProductRegistry.h b/DataFormats/Provenance/interface/ProductRegistry.h index dc58f87107281..3c6d953241f80 100644 --- a/DataFormats/Provenance/interface/ProductRegistry.h +++ b/DataFormats/Provenance/interface/ProductRegistry.h @@ -37,7 +37,7 @@ namespace edm { ProductRegistry(); - // A constructor from the persistent data memebers from another product registry. + // A constructor from the persistent data members from another product registry. // saves time by not copying the transient components. // The constructed registry will be frozen by default. explicit ProductRegistry(ProductList const& productList, bool toBeFrozen = true); @@ -148,6 +148,12 @@ namespace edm { return get_underlying_safe(runProductLookup_); } std::shared_ptr& runProductLookup() { return get_underlying_safe(runProductLookup_); } + std::shared_ptr processProductLookup() const { + return get_underlying_safe(processProductLookup_); + } + std::shared_ptr& processProductLookup() { + return get_underlying_safe(processProductLookup_); + } bool frozen_; // Is at least one (run), (lumi), (event) persistent product produced this process? @@ -157,10 +163,12 @@ namespace edm { edm::propagate_const> eventProductLookup_; edm::propagate_const> lumiProductLookup_; edm::propagate_const> runProductLookup_; + edm::propagate_const> processProductLookup_; ProductResolverIndex eventNextIndexValue_; ProductResolverIndex lumiNextIndexValue_; ProductResolverIndex runNextIndexValue_; + ProductResolverIndex processNextIndexValue_; std::map branchIDToIndex_; diff --git a/DataFormats/Provenance/interface/ProductResolverIndexHelper.h b/DataFormats/Provenance/interface/ProductResolverIndexHelper.h index 48cda9bc0eae3..e904584f14f95 100644 --- a/DataFormats/Provenance/interface/ProductResolverIndexHelper.h +++ b/DataFormats/Provenance/interface/ProductResolverIndexHelper.h @@ -94,7 +94,7 @@ namespace edm { // the arguments or a set of matching indexes using the Matches // class. A returned index can have a value that indicates that it // is invalid or ambiguous and the client should check for these - // values before using the index (see ProductIndexHolder.h). + // values before using the index (see ProductResolverIndex.h). // If no matches are found or the ProductResolverIndexHelper // has not been frozen yet, then an invalid index or a Matches diff --git a/DataFormats/Provenance/src/BranchType.cc b/DataFormats/Provenance/src/BranchType.cc index c200ca01ac356..e7ebf9b5b337f 100644 --- a/DataFormats/Provenance/src/BranchType.cc +++ b/DataFormats/Provenance/src/BranchType.cc @@ -1,4 +1,5 @@ #include "DataFormats/Provenance/interface/BranchType.h" +#include "FWCore/Utilities/interface/EDMException.h" #include namespace edm { @@ -17,6 +18,7 @@ namespace edm { std::string const productProvenance = "ProductProvenance"; // Prefixes + std::string const process = "ProcessBlock"; std::string const run = "Run"; std::string const lumi = "LuminosityBlock"; std::string const event = "Event"; @@ -50,15 +52,6 @@ namespace edm { std::string const lumiProductProvenance = lumi + productProvenance; std::string const eventProductProvenance = event + productProvenance; - std::string const majorIndex = ".id_.run_"; - std::string const runMajorIndex = runAuxiliary + majorIndex; - std::string const lumiMajorIndex = lumiAuxiliary + majorIndex; - std::string const eventMajorIndex = eventAuxiliary + majorIndex; - - std::string const runMinorIndex; // empty - std::string const lumiMinorIndex = lumiAuxiliary + ".id_.luminosityBlock_"; - std::string const eventMinorIndex = eventAuxiliary + ".id_.event_"; - std::string const runAux = run + aux; std::string const lumiAux = lumi + aux; std::string const eventAux = event + aux; @@ -96,54 +89,80 @@ namespace edm { } // namespace std::string const& BranchTypeToString(BranchType const& branchType) { - return ((branchType == InEvent) ? event : ((branchType == InRun) ? run : lumi)); + return ((branchType == InEvent) ? event + : ((branchType == InRun) ? run : ((branchType == InLumi) ? lumi : process))); } std::string const& BranchTypeToProductTreeName(BranchType const& branchType) { + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToProductTreeName"); + } return ((branchType == InEvent) ? events : ((branchType == InRun) ? runs : lumis)); } std::string const& BranchTypeToMetaDataTreeName(BranchType const& branchType) { + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToMetaDataTreeName"); + } return ((branchType == InEvent) ? eventMeta : ((branchType == InRun) ? runMeta : lumiMeta)); } std::string const& BranchTypeToInfoTreeName(BranchType const& branchType) { // backward compatibility + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToInfoTreeName"); + } return ((branchType == InEvent) ? eventInfo : ((branchType == InRun) ? runInfo : lumiInfo)); // backward compatibility } // backward compatibility std::string const& BranchTypeToAuxiliaryBranchName(BranchType const& branchType) { + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToAuxiliaryBranchName"); + } return ((branchType == InEvent) ? eventAuxiliary : ((branchType == InRun) ? runAuxiliary : lumiAuxiliary)); } - std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) { // backward compatibility + std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) { // backward compatibility + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToAuxBranchName"); + } return ((branchType == InEvent) ? eventAux : ((branchType == InRun) ? runAux : lumiAux)); // backward compatibility } // backward compatibility std::string const& BranchTypeToProductStatusBranchName(BranchType const& branchType) { // backward compatibility + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToProductStatusBranchName"); + } return ((branchType == InEvent) ? eventProductStatus : ((branchType == InRun) ? runProductStatus : lumiProductStatus)); // backward compatibility } // backward compatibility std::string const& BranchTypeToBranchEntryInfoBranchName(BranchType const& branchType) { + if (branchType >= InProcess) { + throw Exception(errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToBranchEntryInfoBranchName"); + } return ((branchType == InEvent) ? eventEventEntryInfo : ((branchType == InRun) ? runEventEntryInfo : lumiEventEntryInfo)); } std::string const& BranchTypeToProductProvenanceBranchName(BranchType const& branchType) { + if (branchType >= InProcess) { + throw Exception( + errors::LogicError, + "branchType argument out of legal range for the function BranchTypeToProductProvenanceBranchName"); + } return ((branchType == InEvent) ? eventProductProvenance : ((branchType == InRun) ? runProductProvenance : lumiProductProvenance)); } - std::string const& BranchTypeToMajorIndexName(BranchType const& branchType) { - return ((branchType == InEvent) ? eventMajorIndex : ((branchType == InRun) ? runMajorIndex : lumiMajorIndex)); - } - - std::string const& BranchTypeToMinorIndexName(BranchType const& branchType) { - return ((branchType == InEvent) ? eventMinorIndex : ((branchType == InRun) ? runMinorIndex : lumiMinorIndex)); - } - namespace poolNames { // EntryDescription tree (1 entry per recorded distinct value of EntryDescription) diff --git a/DataFormats/Provenance/src/ProductRegistry.cc b/DataFormats/Provenance/src/ProductRegistry.cc index 5a2ab9abba1f0..12616d06f1d95 100644 --- a/DataFormats/Provenance/src/ProductRegistry.cc +++ b/DataFormats/Provenance/src/ProductRegistry.cc @@ -38,9 +38,11 @@ namespace edm { eventProductLookup_(new ProductResolverIndexHelper), lumiProductLookup_(new ProductResolverIndexHelper), runProductLookup_(new ProductResolverIndexHelper), + processProductLookup_(new ProductResolverIndexHelper), eventNextIndexValue_(0), lumiNextIndexValue_(0), runNextIndexValue_(0), + processNextIndexValue_(0), branchIDToIndex_() { for (bool& isProduced : productProduced_) @@ -57,10 +59,12 @@ namespace edm { eventProductLookup_ = std::make_unique(); lumiProductLookup_ = std::make_unique(); runProductLookup_ = std::make_unique(); + processProductLookup_ = std::make_unique(); eventNextIndexValue_ = 0; lumiNextIndexValue_ = 0; runNextIndexValue_ = 0; + processNextIndexValue_ = 0; branchIDToIndex_.clear(); } @@ -151,7 +155,9 @@ namespace edm { return transient_.eventProductLookup(); if (branchType == InLumi) return transient_.lumiProductLookup(); - return transient_.runProductLookup(); + if (branchType == InRun) + return transient_.runProductLookup(); + return transient_.processProductLookup(); } std::shared_ptr ProductRegistry::productLookup(BranchType branchType) { @@ -159,7 +165,9 @@ namespace edm { return transient_.eventProductLookup(); if (branchType == InLumi) return transient_.lumiProductLookup(); - return transient_.runProductLookup(); + if (branchType == InRun) + return transient_.runProductLookup(); + return transient_.processProductLookup(); } void ProductRegistry::setFrozen(bool initializeLookupInfo) { @@ -454,10 +462,12 @@ namespace edm { productLookup(InEvent)->setFrozen(); productLookup(InLumi)->setFrozen(); productLookup(InRun)->setFrozen(); + productLookup(InProcess)->setFrozen(); transient_.eventNextIndexValue_ = productLookup(InEvent)->nextIndexValue(); transient_.lumiNextIndexValue_ = productLookup(InLumi)->nextIndexValue(); transient_.runNextIndexValue_ = productLookup(InRun)->nextIndexValue(); + transient_.processNextIndexValue_ = productLookup(InProcess)->nextIndexValue(); for (auto const& product : productList_) { auto const& desc = product.second; @@ -580,7 +590,9 @@ namespace edm { return transient_.eventNextIndexValue_; if (branchType == InLumi) return transient_.lumiNextIndexValue_; - return transient_.runNextIndexValue_; + if (branchType == InRun) + return transient_.runNextIndexValue_; + return transient_.processNextIndexValue_; } ProductResolverIndex& ProductRegistry::nextIndexValue(BranchType branchType) { @@ -588,6 +600,8 @@ namespace edm { return transient_.eventNextIndexValue_; if (branchType == InLumi) return transient_.lumiNextIndexValue_; - return transient_.runNextIndexValue_; + if (branchType == InRun) + return transient_.runNextIndexValue_; + return transient_.processNextIndexValue_; } } // namespace edm diff --git a/FWCore/Framework/interface/BranchActionType.h b/FWCore/Framework/interface/BranchActionType.h index eaa968b30081c..cf4279faf66fa 100644 --- a/FWCore/Framework/interface/BranchActionType.h +++ b/FWCore/Framework/interface/BranchActionType.h @@ -2,7 +2,7 @@ #define Framework_BranchActionType_h /*---------------------------------------------------------------------- - + BranchActionType: BranchAction ----------------------------------------------------------------------*/ @@ -12,7 +12,8 @@ namespace edm { BranchActionGlobalBegin = 0, BranchActionStreamBegin = 1, BranchActionStreamEnd = 2, - BranchActionGlobalEnd = 3 + BranchActionGlobalEnd = 3, + BranchActionGlobalOther = 4 }; } #endif diff --git a/FWCore/Framework/interface/EDAnalyzer.h b/FWCore/Framework/interface/EDAnalyzer.h index c640f5afdeaa3..cf23d2d6f600d 100644 --- a/FWCore/Framework/interface/EDAnalyzer.h +++ b/FWCore/Framework/interface/EDAnalyzer.h @@ -46,6 +46,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + static bool wantsProcessBlocks() { return false; } static bool wantsGlobalRuns() { return true; } static bool wantsGlobalLuminosityBlocks() { return true; } static bool wantsStreamRuns() { return false; } @@ -69,6 +70,9 @@ namespace edm { void doPreallocate(PreallocationConfiguration const&) {} void doBeginJob(); void doEndJob(); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} bool doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc); bool doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc); bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, diff --git a/FWCore/Framework/interface/EDConsumerBase.h b/FWCore/Framework/interface/EDConsumerBase.h index 34cebdbc0698e..2698899e1f123 100644 --- a/FWCore/Framework/interface/EDConsumerBase.h +++ b/FWCore/Framework/interface/EDConsumerBase.h @@ -108,11 +108,14 @@ namespace edm { std::vector consumesInfo() const; ESProxyIndex const* esGetTokenIndices(edm::Transition iTrans) const { - auto const& v = esItemsToGetFromTransition_[static_cast(iTrans)]; - if (v.empty()) { - return nullptr; + if (iTrans < edm::Transition::NumberOfEventSetupTransitions) { + auto const& v = esItemsToGetFromTransition_[static_cast(iTrans)]; + if (v.empty()) { + return nullptr; + } + return &(esItemsToGetFromTransition_[static_cast(iTrans)].front()); } - return &(esItemsToGetFromTransition_[static_cast(iTrans)].front()); + return nullptr; } std::vector const& esGetTokenIndicesVector(edm::Transition iTrans) const { @@ -202,6 +205,7 @@ namespace edm { void throwBranchMismatch(BranchType, EDGetToken) const; void throwBadToken(edm::TypeID const& iType, EDGetToken iToken) const; void throwConsumesCallAfterFrozen(TypeToGet const&, InputTag const&) const; + void throwESConsumesInProcessBlock() const; edm::InputTag const& checkIfEmpty(edm::InputTag const& tag); // ---------- member data -------------------------------- @@ -253,7 +257,7 @@ namespace edm { // inserts in the middle of the data structure. enum { kESLookupInfo, kESProxyIndex }; edm::SoATuple m_esTokenInfo; - std::array, static_cast(edm::Transition::NumberOfTransitions)> + std::array, static_cast(edm::Transition::NumberOfEventSetupTransitions)> esItemsToGetFromTransition_; std::array, static_cast(edm::Transition::NumberOfTransitions)> esRecordsToGetFromTransition_; diff --git a/FWCore/Framework/interface/EDFilter.h b/FWCore/Framework/interface/EDFilter.h index 7a7c7c9593e32..446786f3d8506 100644 --- a/FWCore/Framework/interface/EDFilter.h +++ b/FWCore/Framework/interface/EDFilter.h @@ -55,6 +55,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + static bool wantsProcessBlocks() { return false; } static bool wantsGlobalRuns() { return true; } static bool wantsGlobalLuminosityBlocks() { return true; } static bool wantsStreamRuns() { return false; } @@ -76,6 +77,9 @@ namespace edm { void doPreallocate(PreallocationConfiguration const&) {} void doBeginJob(); void doEndJob(); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, diff --git a/FWCore/Framework/interface/EDProducer.h b/FWCore/Framework/interface/EDProducer.h index 70c5d9ae8b5c9..01b15bcbe7a19 100644 --- a/FWCore/Framework/interface/EDProducer.h +++ b/FWCore/Framework/interface/EDProducer.h @@ -51,6 +51,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + static bool wantsProcessBlocks() { return false; } static bool wantsGlobalRuns() { return true; } static bool wantsGlobalLuminosityBlocks() { return true; } static bool wantsStreamRuns() { return false; } @@ -72,6 +73,9 @@ namespace edm { void doPreallocate(PreallocationConfiguration const&) {} void doBeginJob(); void doEndJob(); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, diff --git a/FWCore/Framework/interface/EventProcessor.h b/FWCore/Framework/interface/EventProcessor.h index bca1f98a2c360..0f482e347c62b 100644 --- a/FWCore/Framework/interface/EventProcessor.h +++ b/FWCore/Framework/interface/EventProcessor.h @@ -216,6 +216,10 @@ namespace edm { void doErrorStuff(); + void beginProcessBlock(bool& beginProcessBlockSucceeded); + void inputProcessBlocks(); + void endProcessBlock(bool cleaningUpAfterException, bool beginProcessBlockSucceeded); + void beginRun(ProcessHistoryID const& phid, RunNumber_t run, bool& globalBeginSucceeded, @@ -242,6 +246,7 @@ namespace edm { std::pair readAndMergeRun(); void readLuminosityBlock(LuminosityBlockProcessingStatus&); int readAndMergeLumi(LuminosityBlockProcessingStatus&); + void writeProcessBlockAsync(WaitingTaskHolder, bool isInputProcessBlock = false); void writeRunAsync(WaitingTaskHolder, ProcessHistoryID const& phid, RunNumber_t run, diff --git a/FWCore/Framework/interface/EventSetupImpl.h b/FWCore/Framework/interface/EventSetupImpl.h index 59f0ddb9493c4..6b46177bf61f7 100644 --- a/FWCore/Framework/interface/EventSetupImpl.h +++ b/FWCore/Framework/interface/EventSetupImpl.h @@ -34,6 +34,9 @@ class testEventsetup; namespace edm { class ESInputTag; + class Schedule; + class ServiceToken; + class WaitingTaskHolder; namespace eventsetup { class EventSetupProvider; @@ -70,6 +73,12 @@ namespace edm { friend class eventsetup::EventSetupRecordProvider; friend class ::testEventsetup; + template + friend void beginGlobalTransitionAsync(WaitingTaskHolder, Schedule&, P&, ServiceToken const&, SC&); + + template + friend void endGlobalTransitionAsync(WaitingTaskHolder, Schedule&, P&, ServiceToken const&, SC&, bool); + protected: void addRecordImpl(const eventsetup::EventSetupRecordImpl& iRecord); diff --git a/FWCore/Framework/interface/Frameworkfwd.h b/FWCore/Framework/interface/Frameworkfwd.h index b393699a7a2e2..45b619fa2d0c4 100644 --- a/FWCore/Framework/interface/Frameworkfwd.h +++ b/FWCore/Framework/interface/Frameworkfwd.h @@ -35,6 +35,8 @@ namespace edm { class Principal; class PrincipalCache; class PrincipalGetAdapter; + class ProcessBlock; + class ProcessBlockPrincipal; class ProcessNameSelector; class ProductRegistryHelper; class Run; diff --git a/FWCore/Framework/interface/FrameworkfwdMostUsed.h b/FWCore/Framework/interface/FrameworkfwdMostUsed.h index ef317cdcd15be..3e8afc93ecb87 100644 --- a/FWCore/Framework/interface/FrameworkfwdMostUsed.h +++ b/FWCore/Framework/interface/FrameworkfwdMostUsed.h @@ -12,6 +12,7 @@ namespace edm { class EventSetup; class LuminosityBlock; class ParameterSet; + class ProcessBlock; class Run; class StreamID; } // namespace edm diff --git a/FWCore/Framework/interface/InputSource.h b/FWCore/Framework/interface/InputSource.h index 916cd69eb9b4f..be660e49bc4f6 100644 --- a/FWCore/Framework/interface/InputSource.h +++ b/FWCore/Framework/interface/InputSource.h @@ -120,6 +120,9 @@ namespace edm { /// Read next luminosity block (same as a prior lumi) void readAndMergeLumi(LuminosityBlockPrincipal& lbp); + /// Read next process block + bool readProcessBlock(); + /// Read next file std::unique_ptr readFile(); diff --git a/FWCore/Framework/interface/OccurrenceTraits.h b/FWCore/Framework/interface/OccurrenceTraits.h index b1455ffc395ba..4fa674bb91413 100644 --- a/FWCore/Framework/interface/OccurrenceTraits.h +++ b/FWCore/Framework/interface/OccurrenceTraits.h @@ -12,6 +12,8 @@ #include "FWCore/Framework/interface/BranchActionType.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" +#include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/GlobalContext.h" @@ -380,5 +382,111 @@ namespace edm { } static const char* transitionName() { return "end global LuminosityBlock"; } }; + + template <> + class OccurrenceTraits { + public: + using MyPrincipal = ProcessBlockPrincipal; + using Context = GlobalContext; + static bool constexpr isEvent_ = false; + + static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { + return GlobalContext(GlobalContext::Transition::kBeginProcessBlock, + LuminosityBlockID(), + RunIndex::invalidRunIndex(), + LuminosityBlockIndex::invalidLuminosityBlockIndex(), + Timestamp::invalidTimestamp(), + processContext); + } + + static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) { + a->preBeginProcessBlockSignal_(*globalContext); + } + static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) { + a->postBeginProcessBlockSignal_(*globalContext); + } + static void preModuleSignal(ActivityRegistry* a, + GlobalContext const* globalContext, + ModuleCallingContext const* moduleCallingContext) { + a->preModuleBeginProcessBlockSignal_(*globalContext, *moduleCallingContext); + } + static void postModuleSignal(ActivityRegistry* a, + GlobalContext const* globalContext, + ModuleCallingContext const* moduleCallingContext) { + a->postModuleBeginProcessBlockSignal_(*globalContext, *moduleCallingContext); + } + static const char* transitionName() { return "begin ProcessBlock"; } + }; + + template <> + class OccurrenceTraits { + public: + using MyPrincipal = ProcessBlockPrincipal; + using Context = GlobalContext; + static bool constexpr isEvent_ = false; + + static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { + return GlobalContext(GlobalContext::Transition::kAccessInputProcessBlock, + LuminosityBlockID(), + RunIndex::invalidRunIndex(), + LuminosityBlockIndex::invalidLuminosityBlockIndex(), + Timestamp::invalidTimestamp(), + processContext); + } + + static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) { + a->preAccessInputProcessBlockSignal_(*globalContext); + } + static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) { + a->postAccessInputProcessBlockSignal_(*globalContext); + } + static void preModuleSignal(ActivityRegistry* a, + GlobalContext const* globalContext, + ModuleCallingContext const* moduleCallingContext) { + a->preModuleAccessInputProcessBlockSignal_(*globalContext, *moduleCallingContext); + } + static void postModuleSignal(ActivityRegistry* a, + GlobalContext const* globalContext, + ModuleCallingContext const* moduleCallingContext) { + a->postModuleAccessInputProcessBlockSignal_(*globalContext, *moduleCallingContext); + } + static const char* transitionName() { return "access input ProcessBlock"; } + }; + + template <> + class OccurrenceTraits { + public: + using MyPrincipal = ProcessBlockPrincipal; + using Context = GlobalContext; + static bool constexpr isEvent_ = false; + + static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { + return GlobalContext(GlobalContext::Transition::kEndProcessBlock, + LuminosityBlockID(), + RunIndex::invalidRunIndex(), + LuminosityBlockIndex::invalidLuminosityBlockIndex(), + Timestamp::invalidTimestamp(), + processContext); + } + + static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) { + a->preEndProcessBlockSignal_(*globalContext); + } + static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) { + a->postEndProcessBlockSignal_(*globalContext); + } + static void preModuleSignal(ActivityRegistry* a, + GlobalContext const* globalContext, + ModuleCallingContext const* moduleCallingContext) { + a->preModuleEndProcessBlockSignal_(*globalContext, *moduleCallingContext); + } + static void postModuleSignal(ActivityRegistry* a, + GlobalContext const* globalContext, + ModuleCallingContext const* moduleCallingContext) { + a->postModuleEndProcessBlockSignal_(*globalContext, *moduleCallingContext); + } + static const char* transitionName() { return "end ProcessBlock"; } + }; + } // namespace edm #endif diff --git a/FWCore/Framework/interface/Principal.h b/FWCore/Framework/interface/Principal.h index 9251abbf4ac21..492e62925b93d 100644 --- a/FWCore/Framework/interface/Principal.h +++ b/FWCore/Framework/interface/Principal.h @@ -80,7 +80,9 @@ namespace edm { void adjustIndexesAfterProductRegistryAddition(); + void fillPrincipal(DelayedReader* reader); void fillPrincipal(ProcessHistoryID const& hist, ProcessHistory const* phr, DelayedReader* reader); + void fillPrincipal(std::string const& processNameOfBlock, DelayedReader* reader); void clearPrincipal(); diff --git a/FWCore/Framework/interface/ProcessBlock.h b/FWCore/Framework/interface/ProcessBlock.h new file mode 100644 index 0000000000000..a231ad7bd4c70 --- /dev/null +++ b/FWCore/Framework/interface/ProcessBlock.h @@ -0,0 +1,232 @@ +#ifndef FWCore_Framework_ProcessBlock_h +#define FWCore_Framework_ProcessBlock_h + +/** \class edm::ProcessBlock + +\author W. David Dagenhart, created 19 March, 2020 + +*/ + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Wrapper.h" +#include "DataFormats/Common/interface/WrapperBase.h" +#include "FWCore/Framework/interface/PrincipalGetAdapter.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/EDPutToken.h" +#include "FWCore/Utilities/interface/ProductResolverIndex.h" +#include "FWCore/Utilities/interface/propagate_const.h" + +#include +#include +#include +#include + +namespace edm { + + class ModuleCallingContext; + class ModuleDescription; + class ProcessBlockPrincipal; + class ProducerBase; + + namespace stream { + template + class ProducingModuleAdaptorBase; + } + + class ProcessBlock { + public: + ProcessBlock(ProcessBlockPrincipal const&, ModuleDescription const&, ModuleCallingContext const*, bool isAtEnd); + + template + bool getByToken(EDGetToken token, Handle& result) const; + + template + bool getByToken(EDGetTokenT token, Handle& result) const; + + template + Handle getHandle(EDGetTokenT token) const; + + template + PROD const& get(EDGetTokenT token) const noexcept(false); + + //Used in conjunction with EDGetToken + void setConsumer(EDConsumerBase const* iConsumer) { provRecorder_.setConsumer(iConsumer); } + + void setProducer(ProducerBase const* iProducer); + + /**If you are caching data from the ProcessBlock, you should also keep + this number. If this number changes then you know that + the data you have cached is invalid. + The value of '0' will never be returned so you can use that to + denote that you have not yet checked the value. + */ + using CacheIdentifier_t = unsigned long; + CacheIdentifier_t cacheIdentifier() const; + + template + void put(EDPutTokenT token, std::unique_ptr product); + + template + void put(EDPutToken token, std::unique_ptr product); + + template + void emplace(EDPutTokenT token, Args&&... args); + + template + void emplace(EDPutToken token, Args&&... args); + + ModuleCallingContext const* moduleCallingContext() const { return moduleCallingContext_; } + + private: + ProcessBlockPrincipal const& processBlockPrincipal() const; + + template + void putImpl(EDPutToken::value_type token, std::unique_ptr product); + + template + void emplaceImpl(EDPutToken::value_type token, Args&&... args); + + friend class ProducerBase; + template + friend class stream::ProducingModuleAdaptorBase; + + void commit_(std::vector const& iShouldPut); + + using ProductPtrVec = std::vector>>; + ProductPtrVec& putProducts() { return putProducts_; } + ProductPtrVec const& putProducts() const { return putProducts_; } + + PrincipalGetAdapter provRecorder_; + ProductPtrVec putProducts_; + ModuleCallingContext const* moduleCallingContext_; + }; + + template + bool ProcessBlock::getByToken(EDGetToken token, Handle& result) const { + result.clear(); + BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)), PRODUCT_TYPE, token, moduleCallingContext_); + result = convert_handle(std::move(bh)); // throws on conversion error + if (result.failedToGet()) { + return false; + } + return true; + } + + template + bool ProcessBlock::getByToken(EDGetTokenT token, Handle& result) const { + result.clear(); + BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)), PRODUCT_TYPE, token, moduleCallingContext_); + result = convert_handle(std::move(bh)); // throws on conversion error + if (result.failedToGet()) { + return false; + } + return true; + } + + template + Handle ProcessBlock::getHandle(EDGetTokenT token) const { + BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)), PRODUCT_TYPE, token, moduleCallingContext_); + return convert_handle(std::move(bh)); + } + + template + PROD const& ProcessBlock::get(EDGetTokenT token) const noexcept(false) { + BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)), PRODUCT_TYPE, token, moduleCallingContext_); + return *convert_handle(std::move(bh)); + } + + template + void ProcessBlock::put(EDPutTokenT token, std::unique_ptr product) { + if (UNLIKELY(product.get() == 0)) { // null pointer is illegal + TypeID typeID(typeid(PROD)); + principal_get_adapter_detail::throwOnPutOfNullProduct( + "ProcessBlock", typeID, provRecorder_.productInstanceLabel(token)); + } + if (UNLIKELY(token.isUninitialized())) { + principal_get_adapter_detail::throwOnPutOfUninitializedToken("ProcessBlock", typeid(PROD)); + } + putImpl(token.index(), std::move(product)); + } + + template + void ProcessBlock::put(EDPutToken token, std::unique_ptr product) { + if (UNLIKELY(product.get() == 0)) { // null pointer is illegal + TypeID typeID(typeid(PROD)); + principal_get_adapter_detail::throwOnPutOfNullProduct( + "ProcessBlock", typeID, provRecorder_.productInstanceLabel(token)); + } + if (UNLIKELY(token.isUninitialized())) { + principal_get_adapter_detail::throwOnPutOfUninitializedToken("ProcessBlock", typeid(PROD)); + } + if (UNLIKELY(provRecorder_.getTypeIDForPutTokenIndex(token.index()) != TypeID{typeid(PROD)})) { + principal_get_adapter_detail::throwOnPutOfWrongType(typeid(PROD), + provRecorder_.getTypeIDForPutTokenIndex(token.index())); + } + putImpl(token.index(), std::move(product)); + } + + template + void ProcessBlock::emplace(EDPutTokenT token, Args&&... args) { + if (UNLIKELY(token.isUninitialized())) { + principal_get_adapter_detail::throwOnPutOfUninitializedToken("ProcessBlock", typeid(PROD)); + } + emplaceImpl(token.index(), std::forward(args)...); + } + + template + void ProcessBlock::emplace(EDPutToken token, Args&&... args) { + if (UNLIKELY(token.isUninitialized())) { + principal_get_adapter_detail::throwOnPutOfUninitializedToken("ProcessBlock", typeid(PROD)); + } + if (UNLIKELY(provRecorder_.getTypeIDForPutTokenIndex(token.index()) != TypeID{typeid(PROD)})) { + principal_get_adapter_detail::throwOnPutOfWrongType(typeid(PROD), + provRecorder_.getTypeIDForPutTokenIndex(token.index())); + } + emplaceImpl(token.index(), std::forward(args)...); + } + + template + void ProcessBlock::putImpl(EDPutToken::value_type index, std::unique_ptr product) { + // The following will call post_insert if T has such a function, + // and do nothing if T has no such function. + std::conditional_t::value, DoPostInsert, DoNotPostInsert> maybe_inserter; + maybe_inserter(product.get()); + + assert(index < putProducts().size()); + + std::unique_ptr> wp(new Wrapper(std::move(product))); + putProducts()[index] = std::move(wp); + } + + template + void ProcessBlock::emplaceImpl(EDPutToken::value_type index, Args&&... args) { + assert(index < putProducts().size()); + + std::unique_ptr> wp(new Wrapper(WrapperBase::Emplace{}, std::forward(args)...)); + + // The following will call post_insert if T has such a function, + // and do nothing if T has no such function. + std::conditional_t::value, DoPostInsert, DoNotPostInsert> maybe_inserter; + maybe_inserter(&(wp->bareProduct())); + + putProducts()[index] = std::move(wp); + } + + template + T const& get(ProcessBlock const& processBlock, EDGetToken const& token) { + Handle handle; + processBlock.getByToken(token, handle); + // throw if the handle is not valid + return *handle.product(); + } + + template + T const& get(ProcessBlock const& processBlock, EDGetTokenT const& token) { + Handle handle; + processBlock.getByToken(token, handle); + // throw if the handle is not valid + return *handle.product(); + } + +} // namespace edm +#endif // FWCore_Framework_ProcessBlock_h diff --git a/FWCore/Framework/interface/ProcessBlockPrincipal.h b/FWCore/Framework/interface/ProcessBlockPrincipal.h new file mode 100644 index 0000000000000..e79876699717e --- /dev/null +++ b/FWCore/Framework/interface/ProcessBlockPrincipal.h @@ -0,0 +1,44 @@ +#ifndef FWCore_Framework_ProcessBlockPrincipal_h +#define FWCore_Framework_ProcessBlockPrincipal_h + +/** \class edm::ProcessBlockPrincipal + +\author W. David Dagenhart, created 19 March, 2020 + +*/ + +#include "FWCore/Framework/interface/Principal.h" +#include "FWCore/Utilities/interface/ProductResolverIndex.h" + +#include +#include + +namespace edm { + + class ProcessConfiguration; + class ProductRegistry; + class WrapperBase; + + class ProcessBlockPrincipal : public Principal { + public: + ProcessBlockPrincipal(std::shared_ptr, + ProcessConfiguration const&, + bool isForPrimaryProcess = true); + + void fillProcessBlockPrincipal(std::string const& processName, DelayedReader* reader = nullptr); + + std::string const& processName() const { return processName_; } + + void put(ProductResolverIndex index, std::unique_ptr edp) const; + + // Should only be 1 ProcessBlock needed at a time (no concurrent ProcessBlocks) + unsigned int index() { return 0; } + + private: + unsigned int transitionIndex_() const override; + + std::string processName_; + }; +} // namespace edm + +#endif // FWCore_Framework_ProcessBlockPrincipal_h diff --git a/FWCore/Framework/interface/ProducerBase.h b/FWCore/Framework/interface/ProducerBase.h index cfd10b374ddac..98eff23835fbb 100644 --- a/FWCore/Framework/interface/ProducerBase.h +++ b/FWCore/Framework/interface/ProducerBase.h @@ -2,7 +2,7 @@ #define FWCore_Framework_ProducerBase_h /*---------------------------------------------------------------------- - + EDProducer: The base class of all "modules" that will insert new EDProducts into an Event. @@ -24,6 +24,7 @@ namespace edm { class ProductRegistry; class Event; class LuminosityBlock; + class ProcessBlock; class Run; class EDProducer; @@ -49,6 +50,10 @@ namespace edm { template struct PrincipalTraits; template <> + struct PrincipalTraits { + static constexpr int kBranchType = InProcess; + }; + template <> struct PrincipalTraits { static constexpr int kBranchType = InRun; }; diff --git a/FWCore/Framework/interface/ProductRegistryHelper.h b/FWCore/Framework/interface/ProductRegistryHelper.h index 0d642d94e1028..b13dcd19de735 100644 --- a/FWCore/Framework/interface/ProductRegistryHelper.h +++ b/FWCore/Framework/interface/ProductRegistryHelper.h @@ -2,8 +2,8 @@ #define FWCore_Framework_ProductRegistryHelper_h /*---------------------------------------------------------------------- - -ProductRegistryHelper: + +ProductRegistryHelper: ----------------------------------------------------------------------*/ @@ -163,6 +163,9 @@ namespace edm { return BranchAliasSetter{typeLabelList_.back(), EDPutToken{index}}; } + virtual bool hasAbilityToProduceInBeginProcessBlocks() const { return false; } + virtual bool hasAbilityToProduceInEndProcessBlocks() const { return false; } + virtual bool hasAbilityToProduceInBeginRuns() const { return false; } virtual bool hasAbilityToProduceInEndRuns() const { return false; } diff --git a/FWCore/Framework/interface/Schedule.h b/FWCore/Framework/interface/Schedule.h index 6bd0e65646231..fdd04be031140 100644 --- a/FWCore/Framework/interface/Schedule.h +++ b/FWCore/Framework/interface/Schedule.h @@ -180,6 +180,11 @@ namespace edm { ActivityRegistry*, MergeableRunProductMetadata const*); + void writeProcessBlockAsync(WaitingTaskHolder iTask, + ProcessBlockPrincipal const&, + ProcessContext const*, + ActivityRegistry*); + // Call closeFile() on all OutputModules. void closeOutputFiles(); diff --git a/FWCore/Framework/interface/SubProcess.h b/FWCore/Framework/interface/SubProcess.h index 6ae1442e89d82..ee6b8c0bdd706 100644 --- a/FWCore/Framework/interface/SubProcess.h +++ b/FWCore/Framework/interface/SubProcess.h @@ -79,6 +79,18 @@ namespace edm { EventPrincipal const& principal, std::vector> const*); + template + void doBeginProcessBlockAsync(WaitingTaskHolder iHolder, + ProcessBlockPrincipal const& principal, + IOVSyncValue const&, + std::vector> const*); + + void doEndProcessBlockAsync(WaitingTaskHolder iHolder, + ProcessBlockPrincipal const& principal, + IOVSyncValue const&, + std::vector> const*, + bool cleaningUpAfterException); + void doBeginRunAsync(WaitingTaskHolder iHolder, RunPrincipal const& principal, IOVSyncValue const& ts, @@ -129,12 +141,12 @@ namespace edm { std::vector> const*, bool cleaningUpAfterException); - // Write the luminosity block void writeLumiAsync(WaitingTaskHolder, LuminosityBlockPrincipal&); void deleteLumiFromCache(LuminosityBlockPrincipal&); - // Write the run + void writeProcessBlockAsync(edm::WaitingTaskHolder task, bool isInputProcessBlock); + void writeRunAsync(WaitingTaskHolder, ProcessHistoryID const& parentPhID, int runNumber, @@ -142,6 +154,8 @@ namespace edm { void deleteRunFromCache(ProcessHistoryID const& parentPhID, int runNumber); + void clearProcessBlockPrincipal(bool isInputProcessBlock = false); + // Call closeFile() on all OutputModules. void closeOutputFiles() { ServiceRegistry::Operate operate(serviceToken_); diff --git a/FWCore/Framework/interface/global/EDAnalyzer.h b/FWCore/Framework/interface/global/EDAnalyzer.h index 559fa8764e442..e118dccaf7a5b 100644 --- a/FWCore/Framework/interface/global/EDAnalyzer.h +++ b/FWCore/Framework/interface/global/EDAnalyzer.h @@ -39,6 +39,7 @@ namespace edm { virtual ~EDAnalyzer() {} #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/global/EDAnalyzerBase.h b/FWCore/Framework/interface/global/EDAnalyzerBase.h index 1d609d7499c22..13fb456ab729d 100644 --- a/FWCore/Framework/interface/global/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/global/EDAnalyzerBase.h @@ -62,6 +62,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -95,6 +96,9 @@ namespace edm { EventSetupImpl const& c, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -129,6 +133,9 @@ namespace edm { virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); diff --git a/FWCore/Framework/interface/global/EDFilter.h b/FWCore/Framework/interface/global/EDFilter.h index b722e9e0c3a0e..73fd40c268c25 100644 --- a/FWCore/Framework/interface/global/EDFilter.h +++ b/FWCore/Framework/interface/global/EDFilter.h @@ -45,12 +45,20 @@ namespace edm { virtual ~EDFilter() = default; #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/global/EDFilterBase.h b/FWCore/Framework/interface/global/EDFilterBase.h index 4bd50733e6b78..39bf65894139a 100644 --- a/FWCore/Framework/interface/global/EDFilterBase.h +++ b/FWCore/Framework/interface/global/EDFilterBase.h @@ -65,6 +65,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -99,6 +100,9 @@ namespace edm { EventSetupImpl const& c, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -135,6 +139,9 @@ namespace edm { virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); @@ -144,6 +151,8 @@ namespace edm { virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c); virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c); + virtual void doBeginProcessBlockProduce_(ProcessBlock&); + virtual void doEndProcessBlockProduce_(ProcessBlock&); virtual void doBeginRunProduce_(Run& rp, EventSetup const& c); virtual void doEndRunProduce_(Run& rp, EventSetup const& c); virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/global/EDProducer.h b/FWCore/Framework/interface/global/EDProducer.h index b94ef5eb356a3..93e3d168aafaa 100644 --- a/FWCore/Framework/interface/global/EDProducer.h +++ b/FWCore/Framework/interface/global/EDProducer.h @@ -40,12 +40,20 @@ namespace edm { EDProducer() = default; // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/global/EDProducerBase.h b/FWCore/Framework/interface/global/EDProducerBase.h index 16aa41b5e0384..8e6cbcb6fbafb 100644 --- a/FWCore/Framework/interface/global/EDProducerBase.h +++ b/FWCore/Framework/interface/global/EDProducerBase.h @@ -68,6 +68,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -97,6 +98,9 @@ namespace edm { EventSetupImpl const& c, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -138,6 +142,9 @@ namespace edm { virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); @@ -147,6 +154,8 @@ namespace edm { virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c); virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c); + virtual void doBeginProcessBlockProduce_(ProcessBlock&); + virtual void doEndProcessBlockProduce_(ProcessBlock&); virtual void doBeginRunProduce_(Run& rp, EventSetup const& c); virtual void doEndRunProduce_(Run& rp, EventSetup const& c); virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/global/OutputModule.h b/FWCore/Framework/interface/global/OutputModule.h index ae628a66c4b7e..3ed732150c52a 100644 --- a/FWCore/Framework/interface/global/OutputModule.h +++ b/FWCore/Framework/interface/global/OutputModule.h @@ -38,6 +38,7 @@ namespace edm { #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/global/OutputModuleBase.h b/FWCore/Framework/interface/global/OutputModuleBase.h index cd47c235d00c1..75d554a4e4a04 100644 --- a/FWCore/Framework/interface/global/OutputModuleBase.h +++ b/FWCore/Framework/interface/global/OutputModuleBase.h @@ -110,6 +110,7 @@ namespace edm { bool wantsGlobalRuns() const { return true; } bool wantsGlobalLuminosityBlocks() const { return true; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; virtual bool wantsStreamLuminosityBlocks() const = 0; @@ -142,6 +143,9 @@ namespace edm { ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {} + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} bool doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); bool doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -210,6 +214,7 @@ namespace edm { void updateBranchIDListsWithKeptAliases(); + void doWriteProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} void doWriteRun(RunPrincipal const& rp, ModuleCallingContext const*, MergeableRunProductMetadata const*); void doWriteLuminosityBlock(LuminosityBlockPrincipal const& lbp, ModuleCallingContext const*); void doOpenFile(FileBlock const& fb); diff --git a/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h b/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h index d77857f1367e4..d4ee7577e0cc6 100644 --- a/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h +++ b/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h @@ -37,6 +37,11 @@ namespace edm { typedef edm::global::impl::StreamCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::global::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::global::impl::RunCacheHolder Type; diff --git a/FWCore/Framework/interface/global/filterAbilityToImplementor.h b/FWCore/Framework/interface/global/filterAbilityToImplementor.h index 943ee242001a0..9c623e6c39ea8 100644 --- a/FWCore/Framework/interface/global/filterAbilityToImplementor.h +++ b/FWCore/Framework/interface/global/filterAbilityToImplementor.h @@ -37,6 +37,11 @@ namespace edm { typedef edm::global::impl::StreamCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::global::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::global::impl::RunCacheHolder Type; @@ -57,6 +62,16 @@ namespace edm { typedef edm::global::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::global::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::global::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::global::impl::BeginRunProducer Type; diff --git a/FWCore/Framework/interface/global/implementors.h b/FWCore/Framework/interface/global/implementors.h index 7ba9fb477cd83..0671783d94bcf 100644 --- a/FWCore/Framework/interface/global/implementors.h +++ b/FWCore/Framework/interface/global/implementors.h @@ -26,6 +26,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Utilities/interface/StreamID.h" +#include "FWCore/Utilities/interface/ProcessBlockIndex.h" #include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Utilities/interface/propagate_const.h" @@ -86,6 +87,41 @@ namespace edm { std::vector caches_; }; + template + class ProcessBlockCacheHolder : public virtual T { + public: + ProcessBlockCacheHolder() = default; + ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; + ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; + ~ProcessBlockCacheHolder() override {} + + protected: + // Not implemented yet + // const C* processBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } + + private: + void doBeginProcessBlock_(ProcessBlock const& pb) final { beginProcessBlock(pb); } + + // Not yet fully implemented, will never get called + void doAccessInputProcessBlock_(ProcessBlock const& pb) final { + caches_.push_back(accessInputProcessBlock(pb)); + } + + void doEndProcessBlock_(ProcessBlock const& pb) final { + endProcessBlock(pb); + caches_.clear(); + } + + virtual void beginProcessBlock(ProcessBlock const&) const {} + + // Not yet fully implemented, will never get called + virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) const { return std::shared_ptr(); } + + virtual void endProcessBlock(ProcessBlock const&) const {} + + std::vector> caches_; + }; + template class RunCacheHolder : public virtual T { public: @@ -217,6 +253,34 @@ namespace edm { std::mutex mutex_; }; + template + class BeginProcessBlockProducer : public virtual T { + public: + BeginProcessBlockProducer() = default; + BeginProcessBlockProducer(BeginProcessBlockProducer const&) = delete; + BeginProcessBlockProducer& operator=(BeginProcessBlockProducer const&) = delete; + ~BeginProcessBlockProducer() noexcept(false) override{}; + + private: + void doBeginProcessBlockProduce_(ProcessBlock&) final; + + virtual void beginProcessBlockProduce(edm::ProcessBlock&) const = 0; + }; + + template + class EndProcessBlockProducer : public virtual T { + public: + EndProcessBlockProducer() = default; + EndProcessBlockProducer(EndProcessBlockProducer const&) = delete; + EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete; + ~EndProcessBlockProducer() noexcept(false) override{}; + + private: + void doEndProcessBlockProduce_(ProcessBlock&) final; + + virtual void endProcessBlockProduce(edm::ProcessBlock&) const = 0; + }; + template class BeginRunProducer : public virtual T { public: diff --git a/FWCore/Framework/interface/global/producerAbilityToImplementor.h b/FWCore/Framework/interface/global/producerAbilityToImplementor.h index bfe2464408790..85bec4ef26f85 100644 --- a/FWCore/Framework/interface/global/producerAbilityToImplementor.h +++ b/FWCore/Framework/interface/global/producerAbilityToImplementor.h @@ -37,6 +37,11 @@ namespace edm { typedef edm::global::impl::StreamCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::global::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::global::impl::RunCacheHolder Type; @@ -57,6 +62,16 @@ namespace edm { typedef edm::global::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::global::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::global::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::global::impl::BeginRunProducer Type; diff --git a/FWCore/Framework/interface/limited/EDAnalyzer.h b/FWCore/Framework/interface/limited/EDAnalyzer.h index ab8aafee32b80..bb16d6463df4d 100644 --- a/FWCore/Framework/interface/limited/EDAnalyzer.h +++ b/FWCore/Framework/interface/limited/EDAnalyzer.h @@ -40,6 +40,7 @@ namespace edm { virtual ~EDAnalyzer() {} #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } diff --git a/FWCore/Framework/interface/limited/EDAnalyzerBase.h b/FWCore/Framework/interface/limited/EDAnalyzerBase.h index 32d270429ecf0..d957cbd3bb466 100644 --- a/FWCore/Framework/interface/limited/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/limited/EDAnalyzerBase.h @@ -63,6 +63,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -100,6 +101,9 @@ namespace edm { EventSetupImpl const& c, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -134,6 +138,9 @@ namespace edm { virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); diff --git a/FWCore/Framework/interface/limited/EDFilter.h b/FWCore/Framework/interface/limited/EDFilter.h index a0a971f5f15d5..74970f64a516b 100644 --- a/FWCore/Framework/interface/limited/EDFilter.h +++ b/FWCore/Framework/interface/limited/EDFilter.h @@ -52,11 +52,19 @@ namespace edm { virtual ~EDFilter() = default; #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/limited/EDFilterBase.h b/FWCore/Framework/interface/limited/EDFilterBase.h index aed1ae650bc86..09067559c3f2f 100644 --- a/FWCore/Framework/interface/limited/EDFilterBase.h +++ b/FWCore/Framework/interface/limited/EDFilterBase.h @@ -65,6 +65,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -98,6 +99,9 @@ namespace edm { EventSetupImpl const& c, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -134,6 +138,9 @@ namespace edm { virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); @@ -143,6 +150,8 @@ namespace edm { virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c); virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c); + virtual void doBeginProcessBlockProduce_(ProcessBlock&); + virtual void doEndProcessBlockProduce_(ProcessBlock&); virtual void doBeginRunProduce_(Run& rp, EventSetup const& c); virtual void doEndRunProduce_(Run& rp, EventSetup const& c); virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/limited/EDProducer.h b/FWCore/Framework/interface/limited/EDProducer.h index a3ab4ee347e4b..9650d02cb69e6 100644 --- a/FWCore/Framework/interface/limited/EDProducer.h +++ b/FWCore/Framework/interface/limited/EDProducer.h @@ -47,11 +47,19 @@ namespace edm { T>::Type(iPSet)... {} // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/limited/EDProducerBase.h b/FWCore/Framework/interface/limited/EDProducerBase.h index 52273fef82382..80e186c234a96 100644 --- a/FWCore/Framework/interface/limited/EDProducerBase.h +++ b/FWCore/Framework/interface/limited/EDProducerBase.h @@ -68,6 +68,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -96,6 +97,9 @@ namespace edm { EventSetupImpl const& c, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -137,6 +141,9 @@ namespace edm { virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); @@ -146,6 +153,8 @@ namespace edm { virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c); virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c); + virtual void doBeginProcessBlockProduce_(ProcessBlock&); + virtual void doEndProcessBlockProduce_(ProcessBlock&); virtual void doBeginRunProduce_(Run& rp, EventSetup const& c); virtual void doEndRunProduce_(Run& rp, EventSetup const& c); virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/limited/OutputModule.h b/FWCore/Framework/interface/limited/OutputModule.h index ce4f461395309..f96ce9de886f7 100644 --- a/FWCore/Framework/interface/limited/OutputModule.h +++ b/FWCore/Framework/interface/limited/OutputModule.h @@ -38,6 +38,7 @@ namespace edm { #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/limited/OutputModuleBase.h b/FWCore/Framework/interface/limited/OutputModuleBase.h index b1fc2c730d622..c2109db01b2c1 100644 --- a/FWCore/Framework/interface/limited/OutputModuleBase.h +++ b/FWCore/Framework/interface/limited/OutputModuleBase.h @@ -110,6 +110,7 @@ namespace edm { //Output modules always need writeRun and writeLumi to be called bool wantsGlobalRuns() const { return true; } bool wantsGlobalLuminosityBlocks() const { return true; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; virtual bool wantsStreamLuminosityBlocks() const = 0; @@ -146,6 +147,9 @@ namespace edm { ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {} + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} bool doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); bool doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -215,6 +219,7 @@ namespace edm { void updateBranchIDListsWithKeptAliases(); + void doWriteProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} void doWriteRun(RunPrincipal const& rp, ModuleCallingContext const*, MergeableRunProductMetadata const*); void doWriteLuminosityBlock(LuminosityBlockPrincipal const& lbp, ModuleCallingContext const*); void doOpenFile(FileBlock const& fb); diff --git a/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h b/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h index 9db6f73b2ec9d..68b9d330f7c76 100644 --- a/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h +++ b/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h @@ -37,6 +37,11 @@ namespace edm { typedef edm::limited::impl::StreamCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::limited::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::limited::impl::RunCacheHolder Type; diff --git a/FWCore/Framework/interface/limited/filterAbilityToImplementor.h b/FWCore/Framework/interface/limited/filterAbilityToImplementor.h index 7cf3537587376..432000883d4ae 100644 --- a/FWCore/Framework/interface/limited/filterAbilityToImplementor.h +++ b/FWCore/Framework/interface/limited/filterAbilityToImplementor.h @@ -37,6 +37,11 @@ namespace edm { typedef edm::limited::impl::StreamCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::limited::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::limited::impl::RunCacheHolder Type; @@ -57,6 +62,16 @@ namespace edm { typedef edm::limited::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::limited::impl::BeginRunProducer Type; diff --git a/FWCore/Framework/interface/limited/implementors.h b/FWCore/Framework/interface/limited/implementors.h index 2f722cb961b4a..25ca3a2cc51b5 100644 --- a/FWCore/Framework/interface/limited/implementors.h +++ b/FWCore/Framework/interface/limited/implementors.h @@ -26,6 +26,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Utilities/interface/StreamID.h" +#include "FWCore/Utilities/interface/ProcessBlockIndex.h" #include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Utilities/interface/propagate_const.h" @@ -87,6 +88,41 @@ namespace edm { std::vector caches_; }; + template + class ProcessBlockCacheHolder : public virtual T { + public: + ProcessBlockCacheHolder(edm::ParameterSet const& iPSet) : T(iPSet) {} + ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; + ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; + ~ProcessBlockCacheHolder() noexcept(false) override {} + + protected: + // Not implemented yet + // const C* processBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } + + private: + void doBeginProcessBlock_(ProcessBlock const& pb) final { beginProcessBlock(pb); } + + // Not yet fully implemented, will never get called + void doAccessInputProcessBlock_(ProcessBlock const& pb) final { + caches_.push_back(accessInputProcessBlock(pb)); + } + + void doEndProcessBlock_(ProcessBlock const& pb) final { + endProcessBlock(pb); + caches_.clear(); + } + + virtual void beginProcessBlock(ProcessBlock const&) const {} + + // Not yet fully implemented, will never get called + virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) const { return std::shared_ptr(); } + + virtual void endProcessBlock(ProcessBlock const&) const {} + + std::vector> caches_; + }; + template class RunCacheHolder : public virtual T { public: @@ -218,6 +254,34 @@ namespace edm { std::mutex mutex_; }; + template + class BeginProcessBlockProducer : public virtual T { + public: + BeginProcessBlockProducer(edm::ParameterSet const& iPSet) : T(iPSet) {} + BeginProcessBlockProducer(BeginProcessBlockProducer const&) = delete; + BeginProcessBlockProducer& operator=(BeginProcessBlockProducer const&) = delete; + ~BeginProcessBlockProducer() noexcept(false) override{}; + + private: + void doBeginProcessBlockProduce_(ProcessBlock&) final; + + virtual void beginProcessBlockProduce(edm::ProcessBlock&) const = 0; + }; + + template + class EndProcessBlockProducer : public virtual T { + public: + EndProcessBlockProducer(edm::ParameterSet const& iPSet) : T(iPSet) {} + EndProcessBlockProducer(EndProcessBlockProducer const&) = delete; + EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete; + ~EndProcessBlockProducer() noexcept(false) override{}; + + private: + void doEndProcessBlockProduce_(ProcessBlock&) final; + + virtual void endProcessBlockProduce(edm::ProcessBlock&) const = 0; + }; + template class BeginRunProducer : public virtual T { public: diff --git a/FWCore/Framework/interface/limited/producerAbilityToImplementor.h b/FWCore/Framework/interface/limited/producerAbilityToImplementor.h index 6510d0767ed0d..b9ecec5b41049 100644 --- a/FWCore/Framework/interface/limited/producerAbilityToImplementor.h +++ b/FWCore/Framework/interface/limited/producerAbilityToImplementor.h @@ -37,6 +37,11 @@ namespace edm { typedef edm::limited::impl::StreamCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::limited::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::limited::impl::RunCacheHolder Type; @@ -57,6 +62,16 @@ namespace edm { typedef edm::limited::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::limited::impl::BeginRunProducer Type; diff --git a/FWCore/Framework/interface/moduleAbilities.h b/FWCore/Framework/interface/moduleAbilities.h index 8bfc3365be5f9..ee3b324845486 100644 --- a/FWCore/Framework/interface/moduleAbilities.h +++ b/FWCore/Framework/interface/moduleAbilities.h @@ -44,6 +44,12 @@ namespace edm { typedef T Type; }; + template + struct ProcessBlockCache { + static constexpr module::Abilities kAbilities = module::Abilities::kProcessBlockCache; + typedef T Type; + }; + template struct RunCache { static constexpr module::Abilities kAbilities = module::Abilities::kRunCache; @@ -68,6 +74,16 @@ namespace edm { typedef T Type; }; + struct BeginProcessBlockProducer { + static constexpr module::Abilities kAbilities = module::Abilities::kBeginProcessBlockProducer; + typedef module::Empty Type; + }; + + struct EndProcessBlockProducer { + static constexpr module::Abilities kAbilities = module::Abilities::kEndProcessBlockProducer; + typedef module::Empty Type; + }; + struct BeginRunProducer { static constexpr module::Abilities kAbilities = module::Abilities::kBeginRunProducer; typedef module::Empty Type; @@ -122,6 +138,13 @@ namespace edm { typedef edm::module::Empty Type; }; + template + struct WantsProcessBlockTransitions { + static constexpr bool value = CheckAbility::kHasIt or + CheckAbility::kHasIt or + CheckAbility::kHasIt; + }; + template struct WantsGlobalRunTransitions { static constexpr bool value = CheckAbility::kHasIt or @@ -151,9 +174,13 @@ namespace edm { }; template - struct HasAbilityToProduceInRuns { - static constexpr bool value = CheckAbility::kHasIt or - CheckAbility::kHasIt; + struct HasAbilityToProduceInBeginProcessBlocks { + static constexpr bool value = CheckAbility::kHasIt; + }; + + template + struct HasAbilityToProduceInEndProcessBlocks { + static constexpr bool value = CheckAbility::kHasIt; }; template @@ -166,12 +193,6 @@ namespace edm { static constexpr bool value = CheckAbility::kHasIt; }; - template - struct HasAbilityToProduceInLumis { - static constexpr bool value = CheckAbility::kHasIt or - CheckAbility::kHasIt; - }; - template struct HasAbilityToProduceInBeginLumis { static constexpr bool value = CheckAbility::kHasIt; diff --git a/FWCore/Framework/interface/moduleAbilityEnums.h b/FWCore/Framework/interface/moduleAbilityEnums.h index a45dbccb1a59e..184f7b447044d 100644 --- a/FWCore/Framework/interface/moduleAbilityEnums.h +++ b/FWCore/Framework/interface/moduleAbilityEnums.h @@ -30,10 +30,13 @@ namespace edm { enum class Abilities { kGlobalCache, kStreamCache, + kProcessBlockCache, kRunCache, kLuminosityBlockCache, kRunSummaryCache, kLuminosityBlockSummaryCache, + kBeginProcessBlockProducer, + kEndProcessBlockProducer, kBeginRunProducer, kEndRunProducer, kBeginLuminosityBlockProducer, diff --git a/FWCore/Framework/interface/one/EDAnalyzer.h b/FWCore/Framework/interface/one/EDAnalyzer.h index aa27f24b5ff2b..1873819359722 100644 --- a/FWCore/Framework/interface/one/EDAnalyzer.h +++ b/FWCore/Framework/interface/one/EDAnalyzer.h @@ -42,6 +42,7 @@ namespace edm { #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/one/EDAnalyzerBase.h b/FWCore/Framework/interface/one/EDAnalyzerBase.h index 3cb0a6c43a2f0..7eeb7aaaa2363 100644 --- a/FWCore/Framework/interface/one/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/one/EDAnalyzerBase.h @@ -63,6 +63,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } @@ -84,6 +85,9 @@ namespace edm { void doBeginJob(); void doEndJob(); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -107,6 +111,9 @@ namespace edm { virtual void beginJob() {} virtual void endJob() {} + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doEndRun_(Run const& rp, EventSetup const& c); virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/one/EDFilter.h b/FWCore/Framework/interface/one/EDFilter.h index 64992370d2041..5ac4f42e002c3 100644 --- a/FWCore/Framework/interface/one/EDFilter.h +++ b/FWCore/Framework/interface/one/EDFilter.h @@ -39,9 +39,17 @@ namespace edm { //virtual ~EDFilter(); // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/one/EDFilterBase.h b/FWCore/Framework/interface/one/EDFilterBase.h index 2d9a613825c26..9b80b98f54fe7 100644 --- a/FWCore/Framework/interface/one/EDFilterBase.h +++ b/FWCore/Framework/interface/one/EDFilterBase.h @@ -63,6 +63,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } @@ -83,6 +84,9 @@ namespace edm { void doBeginJob(); void doEndJob(); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -110,11 +114,16 @@ namespace edm { virtual void preallocThreads(unsigned int) {} + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doEndRun_(Run const& rp, EventSetup const& c); virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c); virtual void doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlockProduce_(ProcessBlock&); + virtual void doEndProcessBlockProduce_(ProcessBlock&); virtual void doBeginRunProduce_(Run& rp, EventSetup const& c); virtual void doEndRunProduce_(Run& rp, EventSetup const& c); virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/one/EDProducer.h b/FWCore/Framework/interface/one/EDProducer.h index e24967ca8d3ac..ca2faad5a1d02 100644 --- a/FWCore/Framework/interface/one/EDProducer.h +++ b/FWCore/Framework/interface/one/EDProducer.h @@ -43,9 +43,17 @@ namespace edm { // // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/one/EDProducerBase.h b/FWCore/Framework/interface/one/EDProducerBase.h index f0cf701f10e41..c470fb382c5e4 100644 --- a/FWCore/Framework/interface/one/EDProducerBase.h +++ b/FWCore/Framework/interface/one/EDProducerBase.h @@ -63,6 +63,7 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } @@ -83,6 +84,9 @@ namespace edm { void doBeginJob(); void doEndJob(); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*); void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -110,11 +114,16 @@ namespace edm { virtual void preallocThreads(unsigned int) {} + virtual void doBeginProcessBlock_(ProcessBlock const&); + virtual void doAccessInputProcessBlock_(ProcessBlock const&); + virtual void doEndProcessBlock_(ProcessBlock const&); virtual void doBeginRun_(Run const& rp, EventSetup const& c); virtual void doEndRun_(Run const& rp, EventSetup const& c); virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c); virtual void doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c); + virtual void doBeginProcessBlockProduce_(ProcessBlock&); + virtual void doEndProcessBlockProduce_(ProcessBlock&); virtual void doBeginRunProduce_(Run& rp, EventSetup const& c); virtual void doEndRunProduce_(Run& rp, EventSetup const& c); virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c); diff --git a/FWCore/Framework/interface/one/OutputModule.h b/FWCore/Framework/interface/one/OutputModule.h index 0cfff45568ded..0653422881ff3 100644 --- a/FWCore/Framework/interface/one/OutputModule.h +++ b/FWCore/Framework/interface/one/OutputModule.h @@ -40,6 +40,7 @@ namespace edm { #endif // ---------- const member functions --------------------- + bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/one/OutputModuleBase.h b/FWCore/Framework/interface/one/OutputModuleBase.h index 9a0f6c70fa926..b7d49d4189e92 100644 --- a/FWCore/Framework/interface/one/OutputModuleBase.h +++ b/FWCore/Framework/interface/one/OutputModuleBase.h @@ -104,6 +104,7 @@ namespace edm { static void prevalidate(ConfigurationDescriptions&); //Output modules always need writeRun and writeLumi to be called + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } @@ -134,6 +135,9 @@ namespace edm { void doBeginJob(); void doEndJob(); bool doEvent(EventPrincipal const& ep, EventSetupImpl const& c, ActivityRegistry*, ModuleCallingContext const*); + void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} + void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} bool doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); bool doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*); bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, @@ -208,6 +212,7 @@ namespace edm { virtual SharedResourcesAcquirer createAcquirer(); + void doWriteProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) {} void doWriteRun(RunPrincipal const& rp, ModuleCallingContext const*, MergeableRunProductMetadata const*); void doWriteLuminosityBlock(LuminosityBlockPrincipal const& lbp, ModuleCallingContext const*); void doOpenFile(FileBlock const& fb); diff --git a/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h b/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h index 3806e0695d12d..58e8bfd4cd134 100644 --- a/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h +++ b/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h @@ -49,6 +49,11 @@ namespace edm { typedef edm::one::impl::LuminosityBlockWatcher Type; }; + template + struct AbilityToImplementor> { + typedef edm::one::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::one::impl::RunCacheHolder Type; diff --git a/FWCore/Framework/interface/one/filterAbilityToImplementor.h b/FWCore/Framework/interface/one/filterAbilityToImplementor.h index 9998502c3e523..3e7e0446dc16a 100644 --- a/FWCore/Framework/interface/one/filterAbilityToImplementor.h +++ b/FWCore/Framework/interface/one/filterAbilityToImplementor.h @@ -49,6 +49,16 @@ namespace edm { typedef edm::one::impl::LuminosityBlockWatcher Type; }; + template <> + struct AbilityToImplementor { + typedef edm::one::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::one::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::one::impl::BeginRunProducer Type; @@ -69,6 +79,11 @@ namespace edm { typedef edm::one::impl::EndLuminosityBlockProducer Type; }; + template + struct AbilityToImplementor> { + typedef edm::one::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::one::impl::RunCacheHolder Type; diff --git a/FWCore/Framework/interface/one/implementors.h b/FWCore/Framework/interface/one/implementors.h index 52b58236039ef..455b43777b5d3 100644 --- a/FWCore/Framework/interface/one/implementors.h +++ b/FWCore/Framework/interface/one/implementors.h @@ -26,6 +26,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Concurrency/interface/SerialTaskQueue.h" +#include "FWCore/Utilities/interface/ProcessBlockIndex.h" #include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Utilities/interface/propagate_const.h" @@ -102,6 +103,34 @@ namespace edm { virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) = 0; }; + template + class BeginProcessBlockProducer : public virtual T { + public: + BeginProcessBlockProducer() = default; + BeginProcessBlockProducer(BeginProcessBlockProducer const&) = delete; + BeginProcessBlockProducer& operator=(BeginProcessBlockProducer const&) = delete; + ~BeginProcessBlockProducer() noexcept(false) override{}; + + private: + void doBeginProcessBlockProduce_(ProcessBlock&) final; + + virtual void beginProcessBlockProduce(edm::ProcessBlock&) = 0; + }; + + template + class EndProcessBlockProducer : public virtual T { + public: + EndProcessBlockProducer() = default; + EndProcessBlockProducer(EndProcessBlockProducer const&) = delete; + EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete; + ~EndProcessBlockProducer() noexcept(false) override{}; + + private: + void doEndProcessBlockProduce_(ProcessBlock&) final; + + virtual void endProcessBlockProduce(edm::ProcessBlock&) = 0; + }; + template class BeginRunProducer : public virtual T { public: @@ -158,6 +187,41 @@ namespace edm { virtual void endLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&) = 0; }; + template + class ProcessBlockCacheHolder : public virtual T { + public: + ProcessBlockCacheHolder() = default; + ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; + ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; + ~ProcessBlockCacheHolder() override {} + + protected: + // Not implemented yet + // const C* processBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } + + private: + void doBeginProcessBlock_(ProcessBlock const& pb) final { beginProcessBlock(pb); } + + // Not yet fully implemented, will never get called + void doAccessInputProcessBlock_(ProcessBlock const& pb) final { + caches_.push_back(accessInputProcessBlock(pb)); + } + + void doEndProcessBlock_(ProcessBlock const& pb) final { + endProcessBlock(pb); + caches_.clear(); + } + + virtual void beginProcessBlock(ProcessBlock const&) {} + + // Not yet fully implemented, will never get called + virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) { return std::shared_ptr(); } + + virtual void endProcessBlock(ProcessBlock const&) {} + + std::vector> caches_; + }; + template class RunCacheHolder : public virtual T { public: diff --git a/FWCore/Framework/interface/one/producerAbilityToImplementor.h b/FWCore/Framework/interface/one/producerAbilityToImplementor.h index b7862c50f2fd2..53f3e98065a9a 100644 --- a/FWCore/Framework/interface/one/producerAbilityToImplementor.h +++ b/FWCore/Framework/interface/one/producerAbilityToImplementor.h @@ -49,6 +49,16 @@ namespace edm { typedef edm::one::impl::LuminosityBlockWatcher Type; }; + template <> + struct AbilityToImplementor { + typedef edm::one::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::one::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::one::impl::BeginRunProducer Type; @@ -69,6 +79,11 @@ namespace edm { typedef edm::one::impl::EndLuminosityBlockProducer Type; }; + template + struct AbilityToImplementor> { + typedef edm::one::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::one::impl::RunCacheHolder Type; diff --git a/FWCore/Framework/interface/stream/AbilityChecker.h b/FWCore/Framework/interface/stream/AbilityChecker.h index 2c38012ba3ec0..db89a9267eb3f 100644 --- a/FWCore/Framework/interface/stream/AbilityChecker.h +++ b/FWCore/Framework/interface/stream/AbilityChecker.h @@ -37,6 +37,11 @@ namespace edm { static constexpr bool kGlobalCache = true; }; + template + struct HasAbility, U...> : public HasAbility { + static constexpr bool kProcessBlockCache = true; + }; + template struct HasAbility, U...> : public HasAbility { static constexpr bool kRunCache = true; @@ -57,6 +62,16 @@ namespace edm { static constexpr bool kLuminosityBlockSummaryCache = true; }; + template + struct HasAbility : public HasAbility { + static constexpr bool kBeginProcessBlockProducer = true; + }; + + template + struct HasAbility : public HasAbility { + static constexpr bool kEndProcessBlockProducer = true; + }; + template struct HasAbility : public HasAbility { static constexpr bool kBeginRunProducer = true; @@ -90,10 +105,13 @@ namespace edm { template <> struct HasAbility { static constexpr bool kGlobalCache = false; + static constexpr bool kProcessBlockCache = false; static constexpr bool kRunCache = false; static constexpr bool kLuminosityBlockCache = false; static constexpr bool kRunSummaryCache = false; static constexpr bool kLuminosityBlockSummaryCache = false; + static constexpr bool kBeginProcessBlockProducer = false; + static constexpr bool kEndProcessBlockProducer = false; static constexpr bool kBeginRunProducer = false; static constexpr bool kEndRunProducer = false; static constexpr bool kBeginLuminosityBlockProducer = false; diff --git a/FWCore/Framework/interface/stream/AbilityToImplementor.h b/FWCore/Framework/interface/stream/AbilityToImplementor.h index 9387299e5b2be..850236ed469a2 100644 --- a/FWCore/Framework/interface/stream/AbilityToImplementor.h +++ b/FWCore/Framework/interface/stream/AbilityToImplementor.h @@ -35,6 +35,11 @@ namespace edm { typedef edm::stream::impl::GlobalCacheHolder Type; }; + template + struct AbilityToImplementor> { + typedef edm::stream::impl::ProcessBlockCacheHolder Type; + }; + template struct AbilityToImplementor> { typedef edm::stream::impl::RunCacheHolder Type; @@ -55,6 +60,16 @@ namespace edm { typedef edm::stream::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::stream::impl::BeginProcessBlockProducer Type; + }; + + template <> + struct AbilityToImplementor { + typedef edm::stream::impl::EndProcessBlockProducer Type; + }; + template <> struct AbilityToImplementor { typedef edm::stream::impl::BeginRunProducer Type; diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h index f44938f34e0bd..685950e5c1e52 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h @@ -21,6 +21,7 @@ // system include files // user include files +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/RunPrincipal.h" @@ -63,17 +64,19 @@ namespace edm { static void fillDescriptions(ConfigurationDescriptions& descriptions) { T::fillDescriptions(descriptions); } static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); } + bool wantsProcessBlocks() const final { return T::HasAbility::kProcessBlockCache; } bool wantsGlobalRuns() const final { return T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache; } bool wantsGlobalLuminosityBlocks() const final { return T::HasAbility::kLuminosityBlockCache or T::HasAbility::kLuminosityBlockSummaryCache; } private: - typedef CallGlobal MyGlobal; - typedef CallGlobalRun MyGlobalRun; - typedef CallGlobalRunSummary MyGlobalRunSummary; - typedef CallGlobalLuminosityBlock MyGlobalLuminosityBlock; - typedef CallGlobalLuminosityBlockSummary MyGlobalLuminosityBlockSummary; + using MyGlobal = CallGlobal; + using MyGlobalProcessBlock = CallGlobalProcessBlock; + using MyGlobalRun = CallGlobalRun; + using MyGlobalRunSummary = CallGlobalRunSummary; + using MyGlobalLuminosityBlock = CallGlobalLuminosityBlock; + using MyGlobalLuminosityBlockSummary = CallGlobalLuminosityBlockSummary; void setupStreamModules() final { this->createStreamModules([this]() -> EDAnalyzerBase* { @@ -109,6 +112,33 @@ namespace edm { MyGlobalLuminosityBlockSummary::streamEndLuminosityBlockSummary(iProd, iLumi, iES, s); } + void doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { + if constexpr (T::HasAbility::kProcessBlockCache) { + ProcessBlock processBlock(pbp, moduleDescription(), mcc, false); + processBlock.setConsumer(consumer()); + ProcessBlock const& cnstProcessBlock = processBlock; + MyGlobalProcessBlock::beginProcessBlock(cnstProcessBlock, m_global.get()); + } + } + + void doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { + if constexpr (T::HasAbility::kProcessBlockCache) { + ProcessBlock processBlock(pbp, moduleDescription(), mcc, false); + processBlock.setConsumer(consumer()); + ProcessBlock const& cnstProcessBlock = processBlock; + MyGlobalProcessBlock::accessInputProcessBlock(cnstProcessBlock, m_global.get()); + } + } + + void doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { + if constexpr (T::HasAbility::kProcessBlockCache) { + ProcessBlock processBlock(pbp, moduleDescription(), mcc, true); + processBlock.setConsumer(consumer()); + ProcessBlock const& cnstProcessBlock = processBlock; + MyGlobalProcessBlock::endProcessBlock(cnstProcessBlock, m_global.get()); + } + } + void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) final { if constexpr (T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache) { Run r(rp, moduleDescription(), mcc, false); diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h index f061c8f264bff..86c10e557e6e7 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h @@ -78,6 +78,7 @@ namespace edm { // ---------- member functions --------------------------- const ModuleDescription& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return true; } @@ -155,6 +156,9 @@ namespace edm { edm::LuminosityBlock const&, edm::EventSetup const&) = 0; + virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0; + virtual void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0; + virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0; virtual void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0; virtual void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0; virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, diff --git a/FWCore/Framework/interface/stream/EDFilter.h b/FWCore/Framework/interface/stream/EDFilter.h index c299c86a6b135..ab3237414f0bf 100644 --- a/FWCore/Framework/interface/stream/EDFilter.h +++ b/FWCore/Framework/interface/stream/EDFilter.h @@ -58,6 +58,13 @@ namespace edm { // ---------- member functions --------------------------- + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/stream/EDProducer.h b/FWCore/Framework/interface/stream/EDProducer.h index 7b04feaff7013..69f751735fdcb 100644 --- a/FWCore/Framework/interface/stream/EDProducer.h +++ b/FWCore/Framework/interface/stream/EDProducer.h @@ -52,6 +52,13 @@ namespace edm { typedef AbilityChecker HasAbility; + bool hasAbilityToProduceInBeginProcessBlocks() const final { + return HasAbilityToProduceInBeginProcessBlocks::value; + } + bool hasAbilityToProduceInEndProcessBlocks() const final { + return HasAbilityToProduceInEndProcessBlocks::value; + } + bool hasAbilityToProduceInBeginRuns() const final { return HasAbilityToProduceInBeginRuns::value; } bool hasAbilityToProduceInEndRuns() const final { return HasAbilityToProduceInEndRuns::value; } diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h index adc80a4ba725a..ebd9f75d2f89f 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h @@ -21,6 +21,7 @@ // system include files // user include files +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/RunPrincipal.h" @@ -51,6 +52,10 @@ namespace edm { static void fillDescriptions(ConfigurationDescriptions& descriptions) { T::fillDescriptions(descriptions); } static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); } + bool wantsProcessBlocks() const final { + return T::HasAbility::kProcessBlockCache or T::HasAbility::kBeginProcessBlockProducer or + T::HasAbility::kEndProcessBlockProducer; + } bool wantsGlobalRuns() const final { return T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache or T::HasAbility::kBeginRunProducer or T::HasAbility::kEndRunProducer; @@ -65,15 +70,18 @@ namespace edm { bool hasAccumulator() const final { return T::HasAbility::kAccumulator; } private: - typedef CallGlobal MyGlobal; - typedef CallGlobalRun MyGlobalRun; - typedef CallGlobalRunSummary MyGlobalRunSummary; - typedef CallBeginRunProduce MyBeginRunProduce; - typedef CallEndRunProduce MyEndRunProduce; - typedef CallGlobalLuminosityBlock MyGlobalLuminosityBlock; - typedef CallGlobalLuminosityBlockSummary MyGlobalLuminosityBlockSummary; - typedef CallBeginLuminosityBlockProduce MyBeginLuminosityBlockProduce; - typedef CallEndLuminosityBlockProduce MyEndLuminosityBlockProduce; + using MyGlobal = CallGlobal; + using MyGlobalProcessBlock = CallGlobalProcessBlock; + using MyBeginProcessBlockProduce = CallBeginProcessBlockProduce; + using MyEndProcessBlockProduce = CallEndProcessBlockProduce; + using MyGlobalRun = CallGlobalRun; + using MyGlobalRunSummary = CallGlobalRunSummary; + using MyBeginRunProduce = CallBeginRunProduce; + using MyEndRunProduce = CallEndRunProduce; + using MyGlobalLuminosityBlock = CallGlobalLuminosityBlock; + using MyGlobalLuminosityBlockSummary = CallGlobalLuminosityBlockSummary; + using MyBeginLuminosityBlockProduce = CallBeginLuminosityBlockProduce; + using MyEndLuminosityBlockProduce = CallEndLuminosityBlockProduce; void setupStreamModules() final { this->createStreamModules([this]() -> M* { @@ -108,6 +116,43 @@ namespace edm { MyGlobalLuminosityBlockSummary::streamEndLuminosityBlockSummary(iProd, iLumi, iES, s); } + void doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { + if constexpr (T::HasAbility::kProcessBlockCache or T::HasAbility::kBeginProcessBlockProducer) { + ProcessBlock processBlock(pbp, this->moduleDescription(), mcc, false); + ProcessBlock const& cnstProcessBlock = processBlock; + processBlock.setConsumer(this->consumer()); + MyGlobalProcessBlock::beginProcessBlock(cnstProcessBlock, m_global.get()); + if constexpr (T::HasAbility::kBeginProcessBlockProducer) { + processBlock.setProducer(this->producer()); + MyBeginProcessBlockProduce::produce(processBlock, m_global.get()); + this->commit(processBlock); + } + } + } + + void doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { + if constexpr (T::HasAbility::kProcessBlockCache) { + ProcessBlock processBlock(pbp, this->moduleDescription(), mcc, false); + ProcessBlock const& cnstProcessBlock = processBlock; + processBlock.setConsumer(this->consumer()); + MyGlobalProcessBlock::accessInputProcessBlock(cnstProcessBlock, m_global.get()); + } + } + + void doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { + if constexpr (T::HasAbility::kProcessBlockCache or T::HasAbility::kEndProcessBlockProducer) { + ProcessBlock processBlock(pbp, this->moduleDescription(), mcc, true); + ProcessBlock const& cnstProcessBlock = processBlock; + processBlock.setConsumer(this->consumer()); + MyGlobalProcessBlock::endProcessBlock(cnstProcessBlock, m_global.get()); + if constexpr (T::HasAbility::kEndProcessBlockProducer) { + processBlock.setProducer(this->producer()); + MyEndProcessBlockProduce::produce(processBlock, m_global.get()); + this->commit(processBlock); + } + } + } + void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) final { if constexpr (T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache or T::HasAbility::kBeginRunProducer) { Run r(rp, this->moduleDescription(), mcc, false); @@ -128,6 +173,7 @@ namespace edm { } } } + void doEndRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) final { if constexpr (T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache or T::HasAbility::kEndRunProducer) { Run r(rp, this->moduleDescription(), mcc, true); diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h index 478dabb91bfbd..b3c45c2b1f89c 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h @@ -35,6 +35,7 @@ #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Utilities/interface/ESIndices.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/ServiceRegistry/interface/ConsumesInfo.h" @@ -79,6 +80,7 @@ namespace edm { // ---------- member functions --------------------------- const ModuleDescription& moduleDescription() const { return moduleDescription_; } + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool hasAcquire() const = 0; @@ -125,6 +127,9 @@ namespace edm { } } + void commit(ProcessBlock& iProcessBlock) { + iProcessBlock.commit_(m_streamModules[0]->indiciesForPutProducts(InProcess)); + } void commit(Run& iRun) { iRun.commit_(m_streamModules[0]->indiciesForPutProducts(InRun)); } void commit(LuminosityBlock& iLumi) { iLumi.commit_(m_streamModules[0]->indiciesForPutProducts(InLumi)); } template @@ -165,6 +170,9 @@ namespace edm { ModuleCallingContext const*); virtual void streamEndLuminosityBlockSummary(T*, edm::LuminosityBlock const&, edm::EventSetup const&) = 0; + virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0; + virtual void doAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0; + virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0; virtual void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0; virtual void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0; virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, diff --git a/FWCore/Framework/interface/stream/callAbilities.h b/FWCore/Framework/interface/stream/callAbilities.h index ed5c3c5b5806c..ced088596c2ce 100644 --- a/FWCore/Framework/interface/stream/callAbilities.h +++ b/FWCore/Framework/interface/stream/callAbilities.h @@ -29,6 +29,7 @@ namespace edm { class Run; class EventSetup; class LuminosityBlock; + class ProcessBlock; namespace stream { //******************************** // CallGlobal @@ -62,6 +63,36 @@ namespace edm { template using CallGlobal = CallGlobalImpl; + + //******************************** + // CallGlobalProcessBlock + //******************************** + template + struct CallGlobalProcessBlockImpl { + static void beginProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache const* iGC) { + T::beginProcessBlock(iProcessBlock, iGC); + } + + static void accessInputProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache const* iGC) { + // This is not fully implemented yet and will never be called + T::accessInputProcessBlock(iProcessBlock, iGC); + } + + static void endProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache const* iGC) { + T::endProcessBlock(iProcessBlock, iGC); + } + }; + + template + struct CallGlobalProcessBlockImpl { + static void beginProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache const*) {} + static void accessInputProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache const*) {} + static void endProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache const*) {} + }; + + template + using CallGlobalProcessBlock = CallGlobalProcessBlockImpl; + //******************************** // CallGlobalRun //******************************** @@ -222,6 +253,42 @@ namespace edm { using CallGlobalLuminosityBlockSummary = CallGlobalLuminosityBlockSummaryImpl; + //******************************** + // CallBeginProcessBlockProduce + //******************************** + template + struct CallBeginProcessBlockProduceImpl { + static void produce(edm::ProcessBlock& processBlock, typename T::GlobalCache const* globalCache) { + T::beginProcessBlockProduce(processBlock, globalCache); + } + }; + + template + struct CallBeginProcessBlockProduceImpl { + static void produce(edm::ProcessBlock&, typename T::GlobalCache const*) {} + }; + + template + using CallBeginProcessBlockProduce = CallBeginProcessBlockProduceImpl; + + //******************************** + // CallEndProcessBlockProduce + //******************************** + template + struct CallEndProcessBlockProduceImpl { + static void produce(edm::ProcessBlock& processBlock, typename T::GlobalCache const* globalCache) { + T::endProcessBlockProduce(processBlock, globalCache); + } + }; + + template + struct CallEndProcessBlockProduceImpl { + static void produce(edm::ProcessBlock&, typename T::GlobalCache const*) {} + }; + + template + using CallEndProcessBlockProduce = CallEndProcessBlockProduceImpl; + //******************************** // CallBeginRunProduce //******************************** diff --git a/FWCore/Framework/interface/stream/implementors.h b/FWCore/Framework/interface/stream/implementors.h index deb58412e5f61..1d1b3c0c404c6 100644 --- a/FWCore/Framework/interface/stream/implementors.h +++ b/FWCore/Framework/interface/stream/implementors.h @@ -53,6 +53,21 @@ namespace edm { C const* cache_; }; + template + class ProcessBlockCacheHolder { + public: + ProcessBlockCacheHolder() = default; + ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; + ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; + //void setProcessBlockCache(C const* iCache) { cache_ = iCache; } + + protected: + //C const* processBlockCache() const { return cache_; } + + private: + //C const* cache_; + }; + template class RunCacheHolder { public: @@ -107,6 +122,27 @@ namespace edm { virtual void endLuminosityBlockSummary(edm::LuminosityBlock const&, edm::EventSetup const&, C*) const = 0; }; + class BeginProcessBlockProducer { + public: + BeginProcessBlockProducer() = default; + BeginProcessBlockProducer(BeginProcessBlockProducer const&) = delete; + BeginProcessBlockProducer& operator=(BeginProcessBlockProducer const&) = delete; + + ///requires the following be defined in the inheriting class + ///static void beginProcessBlockProduce(edm::ProcessBlock&, GlobalCache const* ); + }; + + class EndProcessBlockProducer { + public: + EndProcessBlockProducer() = default; + EndProcessBlockProducer(EndProcessBlockProducer const&) = delete; + EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete; + + private: + ///requires the following be defined in the inheriting class + /// static void endProcessBlockProduce(edm::ProcessBlock&, GlobalCache const* ) + }; + class BeginRunProducer { public: BeginRunProducer() = default; diff --git a/FWCore/Framework/src/EDConsumerBase.cc b/FWCore/Framework/src/EDConsumerBase.cc index 5146c3ffbf924..e14dce4430ba0 100644 --- a/FWCore/Framework/src/EDConsumerBase.cc +++ b/FWCore/Framework/src/EDConsumerBase.cc @@ -251,6 +251,9 @@ ESTokenIndex EDConsumerBase::recordESConsumes(Transition iTrans, m_esTokenInfo.emplace_back( ESTokenLookupInfo{iRecord, eventsetup::DataKey{iDataType, iTag.data().c_str()}, startOfComponentName}, ESProxyIndex{-1}); + if (iTrans >= edm::Transition::NumberOfEventSetupTransitions) { + throwESConsumesInProcessBlock(); + } auto indexForToken = esItemsToGetFromTransition_[static_cast(iTrans)].size(); esItemsToGetFromTransition_[static_cast(iTrans)].emplace_back(-1 * (index + 1)); esRecordsToGetFromTransition_[static_cast(iTrans)].emplace_back(); @@ -412,6 +415,12 @@ void EDConsumerBase::throwConsumesCallAfterFrozen(TypeToGet const& typeToGet, In << "and " << inputTag << "\n"; } +void EDConsumerBase::throwESConsumesInProcessBlock() const { + throw cms::Exception("LogicError") + << "A module declared it consumes an EventSetup product during a ProcessBlock transition.\n" + << "EventSetup products can only be consumed in Event, Lumi, or Run transitions.\n"; +} + namespace { struct CharStarComp { bool operator()(const char* iLHS, const char* iRHS) const { return strcmp(iLHS, iRHS) < 0; } diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 6749eb18b3fa2..ca36c4875f934 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -22,6 +22,7 @@ #include "FWCore/Framework/interface/MergeableRunProductMetadata.h" #include "FWCore/Framework/interface/ModuleChanger.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/ProcessingController.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/Schedule.h" @@ -483,6 +484,14 @@ namespace edm { principalCache_.insert(std::move(lp)); } + { + auto pb = std::make_unique(preg(), *processConfiguration_); + principalCache_.insert(std::move(pb)); + + auto pbForInput = std::make_unique(preg(), *processConfiguration_); + principalCache_.insertForInput(std::move(pb)); + } + // fill the subprocesses, if there are any subProcesses_.reserve(subProcessVParameterSet.size()); for (auto& subProcessPSet : subProcessVParameterSet) { @@ -862,6 +871,98 @@ namespace edm { << "This likely indicates a bug in an input module or corrupted input or both\n"; } + void EventProcessor::beginProcessBlock(bool& beginProcessBlockSucceeded) { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName()); + + typedef OccurrenceTraits Traits; + auto globalWaitTask = make_empty_waiting_task(); + globalWaitTask->increment_ref_count(); + + beginGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + + globalWaitTask->wait_for_all(); + if (globalWaitTask->exceptionPtr() != nullptr) { + std::rethrow_exception(*(globalWaitTask->exceptionPtr())); + } + beginProcessBlockSucceeded = true; + } + + void EventProcessor::inputProcessBlocks() { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.inputProcessBlockPrincipal(); + // For now the input source always returns false from readProcessBlock, + // so this does nothing at all. + // Eventually the ProcessBlockPrincipal needs to be properly filled + // and cleared. The delayed reader needs to be set. The correct process name + // needs to be supplied. + while (input_->readProcessBlock()) { + DelayedReader* reader = nullptr; + processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName(), reader); + + typedef OccurrenceTraits Traits; + auto globalWaitTask = make_empty_waiting_task(); + globalWaitTask->increment_ref_count(); + + beginGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + + globalWaitTask->wait_for_all(); + if (globalWaitTask->exceptionPtr() != nullptr) { + std::rethrow_exception(*(globalWaitTask->exceptionPtr())); + } + + auto writeWaitTask = edm::make_empty_waiting_task(); + writeWaitTask->increment_ref_count(); + bool isInputProcessBlock = true; + writeProcessBlockAsync(edm::WaitingTaskHolder{writeWaitTask.get()}, isInputProcessBlock); + writeWaitTask->wait_for_all(); + if (writeWaitTask->exceptionPtr()) { + std::rethrow_exception(*writeWaitTask->exceptionPtr()); + } + + processBlockPrincipal.clearPrincipal(); + for (auto& s : subProcesses_) { + s.clearProcessBlockPrincipal(isInputProcessBlock); + } + } + } + + void EventProcessor::endProcessBlock(bool cleaningUpAfterException, bool beginProcessBlockSucceeded) { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + + typedef OccurrenceTraits Traits; + auto globalWaitTask = make_empty_waiting_task(); + globalWaitTask->increment_ref_count(); + + endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), + *schedule_, + processBlockPrincipal, + serviceToken_, + subProcesses_, + cleaningUpAfterException); + + globalWaitTask->wait_for_all(); + if (globalWaitTask->exceptionPtr() != nullptr) { + std::rethrow_exception(*(globalWaitTask->exceptionPtr())); + } + + if (beginProcessBlockSucceeded) { + auto writeWaitTask = edm::make_empty_waiting_task(); + writeWaitTask->increment_ref_count(); + writeProcessBlockAsync(edm::WaitingTaskHolder{writeWaitTask.get()}); + writeWaitTask->wait_for_all(); + if (writeWaitTask->exceptionPtr()) { + std::rethrow_exception(*writeWaitTask->exceptionPtr()); + } + } + + processBlockPrincipal.clearPrincipal(); + for (auto& s : subProcesses_) { + s.clearProcessBlockPrincipal(); + } + } + void EventProcessor::beginRun(ProcessHistoryID const& phid, RunNumber_t run, bool& globalBeginSucceeded, @@ -1510,6 +1611,25 @@ namespace edm { return input_->luminosityBlock(); } + void EventProcessor::writeProcessBlockAsync(WaitingTaskHolder task, bool isInputProcessBlock) { + auto subsT = edm::make_waiting_task(tbb::task::allocate_root(), + [this, task, isInputProcessBlock](std::exception_ptr const* iExcept) mutable { + if (iExcept) { + task.doneWaiting(*iExcept); + } else { + ServiceRegistry::Operate op(serviceToken_); + for (auto& s : subProcesses_) { + s.writeProcessBlockAsync(task, isInputProcessBlock); + } + } + }); + ServiceRegistry::Operate op(serviceToken_); + schedule_->writeProcessBlockAsync(WaitingTaskHolder(subsT), + principalCache_.processBlockPrincipal(isInputProcessBlock), + &processContext_, + actReg_.get()); + } + void EventProcessor::writeRunAsync(WaitingTaskHolder task, ProcessHistoryID const& phid, RunNumber_t run, diff --git a/FWCore/Framework/src/InputSource.cc b/FWCore/Framework/src/InputSource.cc index da5807c023004..64bbcfef683c1 100644 --- a/FWCore/Framework/src/InputSource.cc +++ b/FWCore/Framework/src/InputSource.cc @@ -266,6 +266,8 @@ namespace edm { } } + bool InputSource::readProcessBlock() { return false; } + void InputSource::readRun_(RunPrincipal& runPrincipal) { // Note: For the moment, we do not support saving and restoring the state of the // random number generator if random numbers are generated during processing of runs diff --git a/FWCore/Framework/src/OutputModuleCommunicator.h b/FWCore/Framework/src/OutputModuleCommunicator.h index 3c33a1d105982..f7cdabe27ad1e 100644 --- a/FWCore/Framework/src/OutputModuleCommunicator.h +++ b/FWCore/Framework/src/OutputModuleCommunicator.h @@ -51,14 +51,19 @@ namespace edm { virtual void openFile(FileBlock const& fb) = 0; + virtual void writeProcessBlockAsync(WaitingTaskHolder iTask, + ProcessBlockPrincipal const&, + ProcessContext const*, + ActivityRegistry*) = 0; + virtual void writeRunAsync(WaitingTaskHolder iTask, - RunPrincipal const& rp, + RunPrincipal const&, ProcessContext const*, ActivityRegistry*, MergeableRunProductMetadata const*) = 0; virtual void writeLumiAsync(WaitingTaskHolder iTask, - LuminosityBlockPrincipal const& lbp, + LuminosityBlockPrincipal const&, ProcessContext const*, ActivityRegistry*) = 0; diff --git a/FWCore/Framework/src/OutputModuleCommunicatorT.cc b/FWCore/Framework/src/OutputModuleCommunicatorT.cc index faa199da33e98..60a983404dbfb 100644 --- a/FWCore/Framework/src/OutputModuleCommunicatorT.cc +++ b/FWCore/Framework/src/OutputModuleCommunicatorT.cc @@ -58,6 +58,45 @@ namespace edm { module().doOpenFile(fb); } + template + void OutputModuleCommunicatorT::writeProcessBlockAsync(WaitingTaskHolder iTask, + ProcessBlockPrincipal const& processBlockPrincipal, + ProcessContext const* processContext, + ActivityRegistry* activityRegistry) { + auto token = ServiceRegistry::instance().presentToken(); + GlobalContext globalContext(GlobalContext::Transition::kWriteProcessBlock, + LuminosityBlockID(), + RunIndex::invalidRunIndex(), + LuminosityBlockIndex::invalidLuminosityBlockIndex(), + Timestamp::invalidTimestamp(), + processContext); + auto t = [&mod = module(), + &processBlockPrincipal, + globalContext, + token, + desc = &description(), + activityRegistry, + iTask]() mutable { + std::exception_ptr ex; + // Caught exception is propagated via WaitingTaskHolder + CMS_SA_ALLOW try { + ServiceRegistry::Operate op(token); + ParentContext parentContext(&globalContext); + ModuleCallingContext mcc(desc); + ModuleContextSentry moduleContextSentry(&mcc, parentContext); + activityRegistry->preModuleWriteProcessBlockSignal_(globalContext, mcc); + auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) { + ar->postModuleWriteProcessBlockSignal_(globalContext, mcc); + })); + mod.doWriteProcessBlock(processBlockPrincipal, &mcc); + } catch (...) { + ex = std::current_exception(); + } + iTask.doneWaiting(ex); + }; + async(module(), std::move(t)); + } + template void OutputModuleCommunicatorT::writeRunAsync(WaitingTaskHolder iTask, edm::RunPrincipal const& rp, @@ -71,7 +110,7 @@ namespace edm { LuminosityBlockIndex::invalidLuminosityBlockIndex(), rp.endTime(), processContext); - auto t = [& mod = module(), + auto t = [&mod = module(), &rp, globalContext, token, @@ -111,7 +150,7 @@ namespace edm { lbp.index(), lbp.beginTime(), processContext); - auto t = [& mod = module(), &lbp, activityRegistry, token, globalContext, desc = &description(), iTask]() mutable { + auto t = [&mod = module(), &lbp, activityRegistry, token, globalContext, desc = &description(), iTask]() mutable { std::exception_ptr ex; // Caught exception is propagated via WaitingTaskHolder CMS_SA_ALLOW try { diff --git a/FWCore/Framework/src/OutputModuleCommunicatorT.h b/FWCore/Framework/src/OutputModuleCommunicatorT.h index 08f3af5c9e574..5ed35b3042deb 100644 --- a/FWCore/Framework/src/OutputModuleCommunicatorT.h +++ b/FWCore/Framework/src/OutputModuleCommunicatorT.h @@ -42,6 +42,11 @@ namespace edm { void openFile(edm::FileBlock const& fb) override; + void writeProcessBlockAsync(WaitingTaskHolder iTask, + ProcessBlockPrincipal const&, + ProcessContext const*, + ActivityRegistry*) override; + void writeRunAsync(WaitingTaskHolder iTask, edm::RunPrincipal const& rp, ProcessContext const*, diff --git a/FWCore/Framework/src/Principal.cc b/FWCore/Framework/src/Principal.cc index 4883aa113261b..bb3629ba7d7ed 100644 --- a/FWCore/Framework/src/Principal.cc +++ b/FWCore/Framework/src/Principal.cc @@ -390,15 +390,19 @@ namespace edm { applyToResolvers([&iConfigure](ProductResolverBase* iResolver) { iResolver->setupUnscheduled(iConfigure); }); } - // Set the principal for the Event, Lumi, or Run. - void Principal::fillPrincipal(ProcessHistoryID const& hist, - ProcessHistory const* processHistory, - DelayedReader* reader) { + void Principal::fillPrincipal(DelayedReader* reader) { //increment identifier here since clearPrincipal isn't called for Run/Lumi cacheIdentifier_ = nextIdentifier(); if (reader) { reader_ = reader; } + } + + // Set the principal for the Event, Lumi, or Run. + void Principal::fillPrincipal(ProcessHistoryID const& hist, + ProcessHistory const* processHistory, + DelayedReader* reader) { + fillPrincipal(reader); if (historyAppender_ && productRegistry().anyProductProduced()) { if ((not processHistoryPtr_) || (processHistoryIDBeforeConfig_ != hist)) { @@ -471,6 +475,20 @@ namespace edm { } } + // Set the principal for the ProcessBlock + void Principal::fillPrincipal(std::string const& processNameOfBlock, DelayedReader* reader) { + fillPrincipal(reader); + + std::vector const& lookupProcessNames = productLookup_->lookupProcessNames(); + auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock); + lookupProcessOrder_.assign(lookupProcessNames.size(), 0); + if (!lookupProcessOrder_.empty()) { + if (iter != lookupProcessNames.end()) { + lookupProcessOrder_[0] = iter - lookupProcessNames.begin(); + } + } + } + ProductResolverBase* Principal::getExistingProduct(BranchID const& branchID) { return const_cast(const_cast(this)->getExistingProduct(branchID)); } @@ -543,6 +561,10 @@ namespace edm { EDConsumerBase const* consumer, SharedResourcesAcquirer* sra, ModuleCallingContext const* mcc) const { + // Not implemented for ProcessBlocks, it might work though, not tested + // The other getByLabel function is used for ProcessBlocks by TestProcessor + assert(branchType_ != InProcess); + ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc); if (result == nullptr) { return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr { @@ -616,6 +638,9 @@ namespace edm { EDConsumerBase const* consumer, SharedResourcesAcquirer* sra, ModuleCallingContext const* mcc) const { + // Not implemented for ProcessBlocks + assert(branchType_ != InProcess); + assert(results.empty()); if (UNLIKELY(consumer and (not consumer->registeredToConsumeMany(typeID, branchType())))) { @@ -789,6 +814,9 @@ namespace edm { ProductData const* Principal::findProductByTag(TypeID const& typeID, InputTag const& tag, ModuleCallingContext const* mcc) const { + // Not implemented for ProcessBlocks + assert(branchType_ != InProcess); + ProductData const* productData = findProductByLabel(PRODUCT_TYPE, typeID, tag, nullptr, nullptr, mcc); return productData; } diff --git a/FWCore/Framework/src/PrincipalCache.cc b/FWCore/Framework/src/PrincipalCache.cc index 706c9252b0f22..eadcfc5e785c8 100644 --- a/FWCore/Framework/src/PrincipalCache.cc +++ b/FWCore/Framework/src/PrincipalCache.cc @@ -2,6 +2,7 @@ #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/src/PreallocationConfiguration.h" #include "FWCore/Utilities/interface/EDMException.h" @@ -92,6 +93,12 @@ namespace edm { runPrincipal_ = rp; } + void PrincipalCache::insert(std::unique_ptr pb) { processBlockPrincipal_ = std::move(pb); } + + void PrincipalCache::insertForInput(std::unique_ptr pb) { + inputProcessBlockPrincipal_ = std::move(pb); + } + void PrincipalCache::insert(std::unique_ptr lbp) { lumiHolder_.add(std::move(lbp)); } void PrincipalCache::insert(std::shared_ptr ep) { diff --git a/FWCore/Framework/src/PrincipalCache.h b/FWCore/Framework/src/PrincipalCache.h index 2c431415a5267..b7181ed7c9c52 100644 --- a/FWCore/Framework/src/PrincipalCache.h +++ b/FWCore/Framework/src/PrincipalCache.h @@ -36,6 +36,7 @@ Original Author: W. David Dagenhart namespace edm { + class ProcessBlockPrincipal; class RunPrincipal; class LuminosityBlockPrincipal; class EventPrincipal; @@ -50,6 +51,12 @@ namespace edm { ~PrincipalCache(); PrincipalCache(PrincipalCache&&) = default; + ProcessBlockPrincipal& processBlockPrincipal() const { return *processBlockPrincipal_; } + ProcessBlockPrincipal& inputProcessBlockPrincipal() const { return *inputProcessBlockPrincipal_; } + ProcessBlockPrincipal& processBlockPrincipal(bool input) const { + return input ? *inputProcessBlockPrincipal_ : *processBlockPrincipal_; + } + RunPrincipal& runPrincipal(ProcessHistoryID const& phid, RunNumber_t run) const; std::shared_ptr const& runPrincipalPtr(ProcessHistoryID const& phid, RunNumber_t run) const; RunPrincipal& runPrincipal() const; @@ -63,6 +70,8 @@ namespace edm { void merge(std::shared_ptr aux, std::shared_ptr reg); void setNumberOfConcurrentPrincipals(PreallocationConfiguration const&); + void insert(std::unique_ptr); + void insertForInput(std::unique_ptr); void insert(std::shared_ptr rp); void insert(std::unique_ptr lbp); void insert(std::shared_ptr ep); @@ -81,8 +90,10 @@ namespace edm { void throwRunMissing() const; void throwLumiMissing() const; - // These are explicitly cleared when finished with the run, + // These are explicitly cleared when finished with the processblock, run, // lumi, or event + std::unique_ptr processBlockPrincipal_; + std::unique_ptr inputProcessBlockPrincipal_; std::shared_ptr runPrincipal_; edm::ReusableObjectHolder lumiHolder_; std::vector> eventPrincipals_; diff --git a/FWCore/Framework/src/ProcessBlock.cc b/FWCore/Framework/src/ProcessBlock.cc new file mode 100644 index 0000000000000..107a43412c39a --- /dev/null +++ b/FWCore/Framework/src/ProcessBlock.cc @@ -0,0 +1,54 @@ +#include "FWCore/Framework/interface/ProcessBlock.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" + +namespace edm { + + ProcessBlock::ProcessBlock(ProcessBlockPrincipal const& pbp, + ModuleDescription const& md, + ModuleCallingContext const* moduleCallingContext, + bool isAtEnd) + : provRecorder_(pbp, md, isAtEnd), moduleCallingContext_(moduleCallingContext) {} + + void ProcessBlock::setProducer(ProducerBase const* iProducer) { + provRecorder_.setProducer(iProducer); + //set appropriate size + putProducts_.resize(provRecorder_.putTokenIndexToProductResolverIndex().size()); + } + + ProcessBlock::CacheIdentifier_t ProcessBlock::cacheIdentifier() const { + return processBlockPrincipal().cacheIdentifier(); + } + + ProcessBlockPrincipal const& ProcessBlock::processBlockPrincipal() const { + return dynamic_cast(provRecorder_.principal()); + } + + void ProcessBlock::commit_(std::vector const& iShouldPut) { + ProcessBlockPrincipal const& pbp = processBlockPrincipal(); + size_t nPut = 0; + for (size_t i = 0; i < putProducts().size(); ++i) { + auto& product = get_underlying_safe(putProducts()[i]); + if (product) { + pbp.put(provRecorder_.putTokenIndexToProductResolverIndex()[i], std::move(product)); + ++nPut; + } + } + + auto sz = iShouldPut.size(); + if (sz != 0 and sz != nPut) { + //some were missed + auto& principal = provRecorder_.principal(); + for (auto index : iShouldPut) { + auto resolver = principal.getProductResolverByIndex(index); + if (not resolver->productResolved() and isEndTransition(provRecorder_.transition()) == + resolver->branchDescription().availableOnlyAtEndTransition()) { + resolver->putProduct(std::unique_ptr()); + } + } + } + + // the cleanup is all or none + putProducts().clear(); + } + +} // namespace edm diff --git a/FWCore/Framework/src/ProcessBlockPrincipal.cc b/FWCore/Framework/src/ProcessBlockPrincipal.cc new file mode 100644 index 0000000000000..281f1408873c9 --- /dev/null +++ b/FWCore/Framework/src/ProcessBlockPrincipal.cc @@ -0,0 +1,31 @@ +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" + +#include "DataFormats/Provenance/interface/ProductRegistry.h" +#include "DataFormats/Provenance/interface/BranchType.h" + +#include + +namespace edm { + + ProcessBlockPrincipal::ProcessBlockPrincipal(std::shared_ptr reg, + ProcessConfiguration const& pc, + bool isForPrimaryProcess) + : Principal(reg, reg->productLookup(InProcess), pc, InProcess, nullptr, isForPrimaryProcess) {} + + void ProcessBlockPrincipal::fillProcessBlockPrincipal(std::string const& processNameOfBlock, DelayedReader* reader) { + processName_ = processNameOfBlock; + fillPrincipal(processNameOfBlock, reader); + } + + void ProcessBlockPrincipal::put(ProductResolverIndex index, std::unique_ptr edp) const { + auto phb = getProductResolverByIndex(index); + phb->putProduct(std::move(edp)); + } + + unsigned int ProcessBlockPrincipal::transitionIndex_() const { + // Concurrent ProcessBlocks does not make any sense so just always + // return 0 here. + return 0; + } + +} // namespace edm diff --git a/FWCore/Framework/src/ProductRegistryHelper.cc b/FWCore/Framework/src/ProductRegistryHelper.cc index f86de6f62d356..6f62f3baa5bd1 100644 --- a/FWCore/Framework/src/ProductRegistryHelper.cc +++ b/FWCore/Framework/src/ProductRegistryHelper.cc @@ -20,12 +20,12 @@ namespace edm { ProductRegistryHelper::TypeLabelList const& ProductRegistryHelper::typeLabelList() const { return typeLabelList_; } namespace { - void throwProducesWithoutAbility(const char* runOrLumi, std::string const& productTypeName) { + void throwProducesWithoutAbility(const char* transitionName, std::string const& productTypeName) { throw edm::Exception(edm::errors::LogicError) - << "Module declares it can produce a product of type \'" << productTypeName << "\'\nin a " << runOrLumi - << ", but does not have the ability to produce in " << runOrLumi << "s.\n" - << "You must add a template parameter of type Begin" << runOrLumi << "Producer\n" - << "or End" << runOrLumi << "Producer to the EDProducer or EDFilter base class\n" + << "Module declares it can produce a product of type \'" << productTypeName << "\'\nin a " << transitionName + << ", but does not have the ability to produce in " << transitionName << "s.\n" + << "You must add a template parameter of type " << transitionName << "Producer\n" + << "or " << transitionName << "Producer to the EDProducer or EDFilter base class\n" << "of the module. Or you could remove the call to the function \'produces\'\n" << "(Note legacy modules are not ever allowed to produce in Runs or Lumis)\n"; } @@ -50,6 +50,11 @@ namespace edm { throwProducesWithoutAbility("BeginLuminosityBlock", p->typeID_.userClassName()); } else if (p->transition_ == Transition::EndLuminosityBlock && not iProd->hasAbilityToProduceInEndLumis()) { throwProducesWithoutAbility("EndLuminosityBlock", p->typeID_.userClassName()); + } else if (p->transition_ == Transition::BeginProcessBlock && + not iProd->hasAbilityToProduceInBeginProcessBlocks()) { + throwProducesWithoutAbility("BeginProcessBlock", p->typeID_.userClassName()); + } else if (p->transition_ == Transition::EndProcessBlock && not iProd->hasAbilityToProduceInEndProcessBlocks()) { + throwProducesWithoutAbility("EndProcessBlock", p->typeID_.userClassName()); } if (!checkDictionary(missingDictionaries, p->typeID_)) { checkDictionaryOfWrappedType(missingDictionaries, p->typeID_); diff --git a/FWCore/Framework/src/ProductResolvers.cc b/FWCore/Framework/src/ProductResolvers.cc index 7d9540ddeeeae..b4017ec679099 100644 --- a/FWCore/Framework/src/ProductResolvers.cc +++ b/FWCore/Framework/src/ProductResolvers.cc @@ -163,17 +163,17 @@ namespace edm { ModuleCallingContext const* mcc) const { return resolveProductImpl([this, &principal, mcc]() { auto branchType = principal.branchType(); - if (branchType != InEvent) { + if (branchType == InLumi || branchType == InRun) { //delayed get has not been allowed with Run or Lumis // The file may already be closed so the reader is invalid return; } - if (mcc and (branchType == InEvent) and aux_) { + if (mcc and (branchType == InEvent || branchType == InProcess) and aux_) { aux_->preModuleDelayedGetSignal_.emit(*(mcc->getStreamContext()), *mcc); } auto sentry(make_sentry(mcc, [this, branchType](ModuleCallingContext const* iContext) { - if (branchType == InEvent and aux_) { + if ((branchType == InEvent || branchType == InProcess) and aux_) { aux_->postModuleDelayedGetSignal_.emit(*(iContext->getStreamContext()), *iContext); } })); diff --git a/FWCore/Framework/src/Schedule.cc b/FWCore/Framework/src/Schedule.cc index c8371bb5fecb8..5c61061c2841c 100644 --- a/FWCore/Framework/src/Schedule.cc +++ b/FWCore/Framework/src/Schedule.cc @@ -1183,6 +1183,45 @@ namespace edm { } } + void Schedule::writeProcessBlockAsync(WaitingTaskHolder task, + ProcessBlockPrincipal const& pbp, + ProcessContext const* processContext, + ActivityRegistry* activityRegistry) { + auto token = ServiceRegistry::instance().presentToken(); + GlobalContext globalContext(GlobalContext::Transition::kWriteProcessBlock, + LuminosityBlockID(), + RunIndex::invalidRunIndex(), + LuminosityBlockIndex::invalidLuminosityBlockIndex(), + Timestamp::invalidTimestamp(), + processContext); + + auto t = + make_waiting_task(tbb::task::allocate_root(), + [task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable { + // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions + CMS_SA_ALLOW try { + //services can depend on other services + ServiceRegistry::Operate op(token); + + activityRegistry->postWriteProcessBlockSignal_(globalContext); + } catch (...) { + } + std::exception_ptr ptr; + if (iExcept) { + ptr = *iExcept; + } + task.doneWaiting(ptr); + }); + // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions + CMS_SA_ALLOW try { activityRegistry->preWriteProcessBlockSignal_(globalContext); } catch (...) { + } + WaitingTaskHolder tHolder(t); + + for (auto& c : all_output_communicators_) { + c->writeProcessBlockAsync(tHolder, pbp, processContext, activityRegistry); + } + } + void Schedule::writeLumiAsync(WaitingTaskHolder task, LuminosityBlockPrincipal const& lbp, ProcessContext const* processContext, @@ -1288,18 +1327,22 @@ namespace edm { { //Need to updateLookup in order to make getByToken work + auto const processBlockLookup = iRegistry.productLookup(InProcess); auto const runLookup = iRegistry.productLookup(InRun); auto const lumiLookup = iRegistry.productLookup(InLumi); auto const eventLookup = iRegistry.productLookup(InEvent); + found->updateLookup(InProcess, *runLookup); found->updateLookup(InRun, *runLookup); found->updateLookup(InLumi, *lumiLookup); found->updateLookup(InEvent, *eventLookup); found->updateLookup(iIndices); auto const& processName = newMod->moduleDescription().processName(); + auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName); auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName); auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName); auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName); + found->resolvePutIndicies(InProcess, processBlockModuleToIndicies); found->resolvePutIndicies(InRun, runModuleToIndicies); found->resolvePutIndicies(InLumi, lumiModuleToIndicies); found->resolvePutIndicies(InEvent, eventModuleToIndicies); diff --git a/FWCore/Framework/src/ScheduleItems.cc b/FWCore/Framework/src/ScheduleItems.cc index 0d43a58809180..289c5067dee29 100644 --- a/FWCore/Framework/src/ScheduleItems.cc +++ b/FWCore/Framework/src/ScheduleItems.cc @@ -48,6 +48,11 @@ namespace edm { // Mark dropped branches as dropped in the product registry. std::set keptBranches; + SelectedProducts const& keptVectorP = om.keptProducts()[InProcess]; + for (auto const& item : keptVectorP) { + BranchDescription const& desc = *item.first; + keptBranches.insert(desc.branchID()); + } SelectedProducts const& keptVectorR = om.keptProducts()[InRun]; for (auto const& item : keptVectorR) { BranchDescription const& desc = *item.first; diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index bf16df9024a58..449638c9e0942 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/ProductResolverBase.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" #include "FWCore/Framework/interface/OutputModuleDescription.h" #include "FWCore/Framework/interface/RunPrincipal.h" @@ -189,6 +190,14 @@ namespace edm { principalCache_.insert(std::move(lbpp)); } + { + auto pb = std::make_unique(preg_, *processConfiguration_, false); + principalCache_.insert(std::move(pb)); + + auto pbForInput = std::make_unique(preg_, *processConfiguration_, false); + principalCache_.insertForInput(std::move(pb)); + } + inUseLumiPrincipals_.resize(preallocConfig.numberOfLuminosityBlocks()); subProcesses_.reserve(subProcessVParameterSet.size()); @@ -403,6 +412,53 @@ namespace edm { serviceToken_); } + template <> + void SubProcess::doBeginProcessBlockAsync>( + WaitingTaskHolder iHolder, + ProcessBlockPrincipal const& principal, + IOVSyncValue const&, + std::vector> const*) { + ServiceRegistry::Operate operate(serviceToken_); + + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.inputProcessBlockPrincipal(); + processBlockPrincipal.fillProcessBlockPrincipal(principal.processName(), principal.reader()); + propagateProducts(InProcess, principal, processBlockPrincipal); + + typedef OccurrenceTraits Traits; + beginGlobalTransitionAsync( + std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + } + + template <> + void SubProcess::doBeginProcessBlockAsync>( + WaitingTaskHolder iHolder, + ProcessBlockPrincipal const& principal, + IOVSyncValue const&, + std::vector> const*) { + ServiceRegistry::Operate operate(serviceToken_); + + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName()); + propagateProducts(InProcess, principal, processBlockPrincipal); + + typedef OccurrenceTraits Traits; + beginGlobalTransitionAsync( + std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + } + + void SubProcess::doEndProcessBlockAsync(WaitingTaskHolder iHolder, + ProcessBlockPrincipal const& principal, + IOVSyncValue const&, + std::vector> const*, + bool cleaningUpAfterException) { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + propagateProducts(InProcess, principal, processBlockPrincipal); + + typedef OccurrenceTraits Traits; + endGlobalTransitionAsync( + std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_, cleaningUpAfterException); + } + void SubProcess::doBeginRunAsync(WaitingTaskHolder iHolder, RunPrincipal const& principal, IOVSyncValue const& ts, @@ -453,6 +509,26 @@ namespace edm { cleaningUpAfterException); } + void SubProcess::writeProcessBlockAsync(edm::WaitingTaskHolder task, bool isInputProcessBlock) { + ServiceRegistry::Operate operate(serviceToken_); + + auto subTasks = edm::make_waiting_task( + tbb::task::allocate_root(), [this, task, isInputProcessBlock](std::exception_ptr const* iExcept) mutable { + if (iExcept) { + task.doneWaiting(*iExcept); + } else { + ServiceRegistry::Operate operate(serviceToken_); + for (auto& s : subProcesses_) { + s.writeProcessBlockAsync(task, isInputProcessBlock); + } + } + }); + schedule_->writeProcessBlockAsync(WaitingTaskHolder(subTasks), + principalCache_.processBlockPrincipal(isInputProcessBlock), + &processContext_, + actReg_.get()); + } + void SubProcess::writeRunAsync(edm::WaitingTaskHolder task, ProcessHistoryID const& parentPhID, int runNumber, @@ -490,6 +566,14 @@ namespace edm { [&childPhID, runNumber](auto& subProcess) { subProcess.deleteRunFromCache(childPhID, runNumber); }); } + void SubProcess::clearProcessBlockPrincipal(bool isInputProcessBlock) { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(isInputProcessBlock); + processBlockPrincipal.clearPrincipal(); + for (auto& s : subProcesses_) { + s.clearProcessBlockPrincipal(isInputProcessBlock); + } + } + void SubProcess::doBeginLuminosityBlockAsync( WaitingTaskHolder iHolder, LuminosityBlockPrincipal const& principal, @@ -668,8 +752,7 @@ namespace edm { if (parentProductResolver != nullptr) { ProductResolverBase* productResolver = principal.getModifiableProductResolver(desc.branchID()); if (productResolver != nullptr) { - //Propagate the per event(run)(lumi) data for this product to the subprocess. - //First, the product itself. + //Propagate the per event(run)(lumi)(processBlock) data for this product to the subprocess. productResolver->connectTo(*parentProductResolver, &parentPrincipal); } } diff --git a/FWCore/Framework/src/TransitionProcessors.icc b/FWCore/Framework/src/TransitionProcessors.icc index 7e09c39186f8d..4daeb810c1c61 100644 --- a/FWCore/Framework/src/TransitionProcessors.icc +++ b/FWCore/Framework/src/TransitionProcessors.icc @@ -19,9 +19,14 @@ struct FileResources { ~FileResources() { // See the message in catch clause CMS_SA_ALLOW try { - ep_.respondToCloseInputFile(); - ep_.closeInputFile(cleaningUpAfterException_); - ep_.closeOutputFiles(); + // Don't try to execute the following sequence of functions twice. + // If the sequence was already attempted and failed, then do nothing. + if (!closingSequenceAlreadyFailed_) { + ep_.respondToCloseInputFile(); + ep_.closeInputFile(cleaningUpAfterException_); + ep_.endProcessBlock(cleaningUpAfterException_, beginProcessBlockSucceeded_); + ep_.closeOutputFiles(); + } } catch (...) { if (cleaningUpAfterException_ or not ep_.setDeferredException(std::current_exception())) { std::string message( @@ -35,6 +40,8 @@ struct FileResources { EventProcessor& ep_; bool cleaningUpAfterException_ = true; + bool closingSequenceAlreadyFailed_ = false; + bool beginProcessBlockSucceeded_ = false; }; struct RunResources { @@ -228,6 +235,9 @@ private: iEP.openOutputFiles(); filesOpen_ = std::make_unique(iEP); + + iEP.beginProcessBlock(filesOpen_->beginProcessBlockSucceeded_); + iEP.inputProcessBlocks(); } bool shouldWeCloseOutput(EventProcessor& iEP) { @@ -242,18 +252,33 @@ private: iEP.readFile(); iEP.respondToOpenInputFile(); + + iEP.inputProcessBlocks(); } void gotoNewInputAndOutputFiles(EventProcessor& iEP) { - iEP.respondToCloseInputFile(); - iEP.closeInputFile(false); + // If this is still true when we hit the destructor for + // the filesOpen_ object, then we will know an exception + // was thrown on one of the following 5 lines. + filesOpen_->closingSequenceAlreadyFailed_ = true; + iEP.respondToCloseInputFile(); + bool cleaningUpAfterException = false; + iEP.closeInputFile(cleaningUpAfterException); + iEP.endProcessBlock(cleaningUpAfterException, filesOpen_->beginProcessBlockSucceeded_); iEP.closeOutputFiles(); + // Initialize these for the next output file + filesOpen_->closingSequenceAlreadyFailed_ = false; + filesOpen_->beginProcessBlockSucceeded_ = false; + iEP.readFile(); iEP.respondToOpenInputFile(); iEP.openOutputFiles(); + + iEP.beginProcessBlock(filesOpen_->beginProcessBlockSucceeded_); + iEP.inputProcessBlocks(); } std::unique_ptr filesOpen_; diff --git a/FWCore/Framework/src/Worker.cc b/FWCore/Framework/src/Worker.cc index 33a4b7b827c47..2f49328b2004a 100644 --- a/FWCore/Framework/src/Worker.cc +++ b/FWCore/Framework/src/Worker.cc @@ -156,10 +156,7 @@ namespace edm { } } - bool Worker::shouldRethrowException(std::exception_ptr iPtr, - ParentContext const& parentContext, - bool isEvent, - TransitionIDValueBase const& iID) const { + bool Worker::shouldRethrowException(std::exception_ptr iPtr, ParentContext const& parentContext, bool isEvent) const { // NOTE: the warning printed as a result of ignoring or failing // a module will only be printed during the full true processing // pass of this module @@ -460,8 +457,7 @@ namespace edm { convertException::wrap([&]() { this->implDoAcquire(ep, es, &moduleCallingContext_, holder); }); } catch (cms::Exception& ex) { exceptionContext(ex, &moduleCallingContext_); - TransitionIDValue idValue(ep); - if (shouldRethrowException(std::current_exception(), parentContext, true, idValue)) { + if (shouldRethrowException(std::current_exception(), parentContext, true)) { timesRun_.fetch_add(1, std::memory_order_relaxed); throw; } @@ -477,8 +473,7 @@ namespace edm { std::exception_ptr exceptionPtr; if (iEPtr) { assert(*iEPtr); - TransitionIDValue idValue(ep); - if (shouldRethrowException(*iEPtr, parentContext, true, idValue)) { + if (shouldRethrowException(*iEPtr, parentContext, true)) { exceptionPtr = *iEPtr; } moduleCallingContext_.setContext(ModuleCallingContext::State::kInvalid, ParentContext(), nullptr); diff --git a/FWCore/Framework/src/Worker.h b/FWCore/Framework/src/Worker.h index 63c3abcb78e36..0894ce507ce0d 100644 --- a/FWCore/Framework/src/Worker.h +++ b/FWCore/Framework/src/Worker.h @@ -119,6 +119,7 @@ namespace edm { Worker(Worker const&) = delete; // Disallow copying and moving Worker& operator=(Worker const&) = delete; // Disallow copying and moving + virtual bool wantsProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -251,6 +252,9 @@ namespace edm { WaitingTaskWithArenaHolder& holder) = 0; virtual bool implDoPrePrefetchSelection(StreamID id, EventPrincipal const& ep, ModuleCallingContext const* mcc) = 0; + virtual bool implDoBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const* mcc) = 0; + virtual bool implDoAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const* mcc) = 0; + virtual bool implDoEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const* mcc) = 0; virtual bool implDoBegin(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc) = 0; virtual bool implDoStreamBegin(StreamID id, RunPrincipal const& rp, @@ -314,35 +318,7 @@ namespace edm { static void exceptionContext(cms::Exception& ex, ModuleCallingContext const* mcc); - /*This base class is used to hide the differences between the ID used - for Event, LuminosityBlock and Run. Using the base class allows us - to only convert the ID to string form if it is actually needed in - the call to shouldRethrowException. - */ - class TransitionIDValueBase { - public: - virtual std::string value() const = 0; - virtual ~TransitionIDValueBase() {} - }; - - template - class TransitionIDValue : public TransitionIDValueBase { - public: - TransitionIDValue(T const& iP) : p_(iP) {} - std::string value() const override { - std::ostringstream iost; - iost << p_.id(); - return iost.str(); - } - - private: - T const& p_; - }; - - bool shouldRethrowException(std::exception_ptr iPtr, - ParentContext const& parentContext, - bool isEvent, - TransitionIDValueBase const& iID) const; + bool shouldRethrowException(std::exception_ptr iPtr, ParentContext const& parentContext, bool isEvent) const; template bool setPassed() { @@ -479,8 +455,8 @@ namespace edm { ServiceRegistry::Operate operateRunModule(serviceToken); //If needed, we pause the queue in begin transition and resume it - // at the end transition. This guarantees that the module - // only processes one transition at a time + // at the end transition. This can guarantee that the module + // only processes one run or lumi at a time EnableQueueGuard enableQueueGuard{workerhelper::CallImpl::enableGlobalQueue(worker)}; std::exception_ptr* ptr = nullptr; worker->template runModuleAfterAsyncPrefetch(ptr, principal, es, streamID, parentContext, sContext); @@ -836,6 +812,63 @@ namespace edm { static SerialTaskQueue* pauseGlobalQueue(Worker* iWorker) { return nullptr; } static SerialTaskQueue* enableGlobalQueue(Worker*) { return nullptr; } }; + template <> + class CallImpl> { + public: + typedef OccurrenceTraits Arg; + static bool call(Worker* iWorker, + StreamID, + ProcessBlockPrincipal const& pbp, + EventSetupImpl const&, + ActivityRegistry* actReg, + ModuleCallingContext const* mcc, + Arg::Context const* context) { + ModuleSignalSentry cpp(actReg, context, mcc); + return iWorker->implDoBeginProcessBlock(pbp, mcc); + } + static bool wantsTransition(Worker const* iWorker) { return iWorker->wantsProcessBlocks(); } + static bool needToRunSelection(Worker const* iWorker) { return false; } + static SerialTaskQueue* pauseGlobalQueue(Worker* iWorker) { return nullptr; } + static SerialTaskQueue* enableGlobalQueue(Worker*) { return nullptr; } + }; + template <> + class CallImpl> { + public: + typedef OccurrenceTraits Arg; + static bool call(Worker* iWorker, + StreamID, + ProcessBlockPrincipal const& pbp, + EventSetupImpl const&, + ActivityRegistry* actReg, + ModuleCallingContext const* mcc, + Arg::Context const* context) { + ModuleSignalSentry cpp(actReg, context, mcc); + return iWorker->implDoAccessInputProcessBlock(pbp, mcc); + } + static bool wantsTransition(Worker const* iWorker) { return iWorker->wantsProcessBlocks(); } + static bool needToRunSelection(Worker const* iWorker) { return false; } + static SerialTaskQueue* pauseGlobalQueue(Worker* iWorker) { return nullptr; } + static SerialTaskQueue* enableGlobalQueue(Worker*) { return nullptr; } + }; + template <> + class CallImpl> { + public: + typedef OccurrenceTraits Arg; + static bool call(Worker* iWorker, + StreamID, + ProcessBlockPrincipal const& pbp, + EventSetupImpl const&, + ActivityRegistry* actReg, + ModuleCallingContext const* mcc, + Arg::Context const* context) { + ModuleSignalSentry cpp(actReg, context, mcc); + return iWorker->implDoEndProcessBlock(pbp, mcc); + } + static bool wantsTransition(Worker const* iWorker) { return iWorker->wantsProcessBlocks(); } + static bool needToRunSelection(Worker const* iWorker) { return false; } + static SerialTaskQueue* pauseGlobalQueue(Worker* iWorker) { return nullptr; } + static SerialTaskQueue* enableGlobalQueue(Worker*) { return nullptr; } + }; } // namespace workerhelper template @@ -923,8 +956,7 @@ namespace edm { std::exception_ptr exceptionPtr; if (iEPtr) { assert(*iEPtr); - TransitionIDValue idValue(ep); - if (shouldRethrowException(*iEPtr, parentContext, T::isEvent_, idValue)) { + if (shouldRethrowException(*iEPtr, parentContext, T::isEvent_)) { exceptionPtr = *iEPtr; setException(exceptionPtr); } else { @@ -1084,8 +1116,7 @@ namespace edm { waitTask->wait_for_all(); } if (waitTask->exceptionPtr() != nullptr) { - TransitionIDValue idValue(ep); - if (shouldRethrowException(*waitTask->exceptionPtr(), parentContext, T::isEvent_, idValue)) { + if (shouldRethrowException(*waitTask->exceptionPtr(), parentContext, T::isEvent_)) { setException(*waitTask->exceptionPtr()); waitingTasks_.doneWaiting(cached_exception_); std::rethrow_exception(cached_exception_); @@ -1150,8 +1181,7 @@ namespace edm { }); } catch (cms::Exception& ex) { exceptionContext(ex, &moduleCallingContext_); - TransitionIDValue idValue(ep); - if (shouldRethrowException(std::current_exception(), parentContext, T::isEvent_, idValue)) { + if (shouldRethrowException(std::current_exception(), parentContext, T::isEvent_)) { assert(not cached_exception_); setException(std::current_exception()); std::rethrow_exception(cached_exception_); diff --git a/FWCore/Framework/src/WorkerManager.cc b/FWCore/Framework/src/WorkerManager.cc index d880746d18bc7..1384cfc004bcc 100644 --- a/FWCore/Framework/src/WorkerManager.cc +++ b/FWCore/Framework/src/WorkerManager.cc @@ -80,19 +80,23 @@ namespace edm { void WorkerManager::beginJob(ProductRegistry const& iRegistry, eventsetup::ESRecordsToProxyIndices const& iESIndices) { + auto const processBlockLookup = iRegistry.productLookup(InProcess); auto const runLookup = iRegistry.productLookup(InRun); auto const lumiLookup = iRegistry.productLookup(InLumi); auto const eventLookup = iRegistry.productLookup(InEvent); if (!allWorkers_.empty()) { auto const& processName = allWorkers_[0]->description().processName(); + auto processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName); auto runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName); auto lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName); auto eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName); for (auto& worker : allWorkers_) { + worker->updateLookup(InProcess, *processBlockLookup); worker->updateLookup(InRun, *runLookup); worker->updateLookup(InLumi, *lumiLookup); worker->updateLookup(InEvent, *eventLookup); worker->updateLookup(iESIndices); + worker->resolvePutIndicies(InProcess, processBlockModuleToIndicies); worker->resolvePutIndicies(InRun, runModuleToIndicies); worker->resolvePutIndicies(InLumi, lumiModuleToIndicies); worker->resolvePutIndicies(InEvent, eventModuleToIndicies); diff --git a/FWCore/Framework/src/WorkerT.cc b/FWCore/Framework/src/WorkerT.cc index dad7c26ba397c..63828eafe0ca0 100644 --- a/FWCore/Framework/src/WorkerT.cc +++ b/FWCore/Framework/src/WorkerT.cc @@ -117,6 +117,11 @@ namespace edm { template WorkerT::~WorkerT() {} + template + bool WorkerT::wantsProcessBlocks() const { + return module_->wantsProcessBlocks(); + } + template bool WorkerT::wantsGlobalRuns() const { return module_->wantsGlobalRuns(); @@ -310,6 +315,24 @@ namespace edm { iItems = module_->productsUsedBySelection(); } + template + bool WorkerT::implDoBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + module_->doBeginProcessBlock(pbp, mcc); + return true; + } + + template + bool WorkerT::implDoAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + module_->doAccessInputProcessBlock(pbp, mcc); + return true; + } + + template + bool WorkerT::implDoEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + module_->doEndProcessBlock(pbp, mcc); + return true; + } + template inline bool WorkerT::implDoBegin(RunPrincipal const& rp, EventSetupImpl const& c, diff --git a/FWCore/Framework/src/WorkerT.h b/FWCore/Framework/src/WorkerT.h index d87b4cf3dfe29..e7f86c7d6e7c9 100644 --- a/FWCore/Framework/src/WorkerT.h +++ b/FWCore/Framework/src/WorkerT.h @@ -43,6 +43,7 @@ namespace edm { Types moduleType() const override; + bool wantsProcessBlocks() const final; bool wantsGlobalRuns() const final; bool wantsGlobalLuminosityBlocks() const final; bool wantsStreamRuns() const final; @@ -91,6 +92,9 @@ namespace edm { WaitingTaskWithArenaHolder& holder) final; bool implDoPrePrefetchSelection(StreamID id, EventPrincipal const& ep, ModuleCallingContext const* mcc) override; + bool implDoBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) override; + bool implDoAccessInputProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) override; + bool implDoEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) override; bool implDoBegin(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const* mcc) override; bool implDoStreamBegin(StreamID id, RunPrincipal const& rp, diff --git a/FWCore/Framework/src/global/EDAnalyzerBase.cc b/FWCore/Framework/src/global/EDAnalyzerBase.cc index ad05e7ffe2b68..ca6775fd2f28e 100644 --- a/FWCore/Framework/src/global/EDAnalyzerBase.cc +++ b/FWCore/Framework/src/global/EDAnalyzerBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/global/EDAnalyzerBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -69,6 +70,27 @@ namespace edm { void EDAnalyzerBase::doEndJob() { this->endJob(); } + void EDAnalyzerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + } + + void EDAnalyzerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDAnalyzerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + } + void EDAnalyzerBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -189,7 +211,9 @@ namespace edm { void EDAnalyzerBase::doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c) {} - + void EDAnalyzerBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doEndProcessBlock_(ProcessBlock const&) {} void EDAnalyzerBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDAnalyzerBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDAnalyzerBase::doBeginRunSummary_(Run const& rp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/global/EDFilterBase.cc b/FWCore/Framework/src/global/EDFilterBase.cc index 82e10dd31428b..735f8884431b2 100644 --- a/FWCore/Framework/src/global/EDFilterBase.cc +++ b/FWCore/Framework/src/global/EDFilterBase.cc @@ -17,6 +17,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" #include "FWCore/Framework/src/PreallocationConfiguration.h" @@ -93,6 +94,33 @@ namespace edm { void EDFilterBase::doEndJob() { this->endJob(); } + void EDFilterBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doBeginProcessBlockProduce_(processBlock); + commit_(processBlock); + } + + void EDFilterBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDFilterBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doEndProcessBlockProduce_(processBlock); + commit_(processBlock); + } + void EDFilterBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -226,6 +254,9 @@ namespace edm { LuminosityBlock const& lbp, EventSetup const& c) {} + void EDFilterBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDFilterBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDFilterBase::doEndProcessBlock_(ProcessBlock const&) {} void EDFilterBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDFilterBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDFilterBase::doBeginRunSummary_(Run const& rp, EventSetup const& c) {} @@ -236,6 +267,8 @@ namespace edm { void EDFilterBase::doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c) {} void EDFilterBase::doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c) {} + void EDFilterBase::doBeginProcessBlockProduce_(ProcessBlock&) {} + void EDFilterBase::doEndProcessBlockProduce_(ProcessBlock&) {} void EDFilterBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {} void EDFilterBase::doEndRunProduce_(Run& rp, EventSetup const& c) {} void EDFilterBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/global/EDProducerBase.cc b/FWCore/Framework/src/global/EDProducerBase.cc index fdbad02e2fe5a..2b1d238d3c4ba 100644 --- a/FWCore/Framework/src/global/EDProducerBase.cc +++ b/FWCore/Framework/src/global/EDProducerBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/global/EDProducerBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -99,6 +100,33 @@ namespace edm { void EDProducerBase::doEndJob() { this->endJob(); } + void EDProducerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doBeginProcessBlockProduce_(processBlock); + commit_(processBlock); + } + + void EDProducerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDProducerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doEndProcessBlockProduce_(processBlock); + commit_(processBlock); + } + void EDProducerBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -235,6 +263,9 @@ namespace edm { LuminosityBlock const& lbp, EventSetup const& c) {} + void EDProducerBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDProducerBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDProducerBase::doEndProcessBlock_(ProcessBlock const&) {} void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDProducerBase::doBeginRunSummary_(Run const& rp, EventSetup const& c) {} @@ -245,6 +276,8 @@ namespace edm { void EDProducerBase::doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c) {} void EDProducerBase::doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c) {} + void EDProducerBase::doBeginProcessBlockProduce_(ProcessBlock&) {} + void EDProducerBase::doEndProcessBlockProduce_(ProcessBlock&) {} void EDProducerBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {} void EDProducerBase::doEndRunProduce_(Run& rp, EventSetup const& c) {} void EDProducerBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/global/OutputModuleBase.cc b/FWCore/Framework/src/global/OutputModuleBase.cc index dbb6e4200b261..04284e584d5b3 100644 --- a/FWCore/Framework/src/global/OutputModuleBase.cc +++ b/FWCore/Framework/src/global/OutputModuleBase.cc @@ -34,6 +34,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/DebugMacros.h" +#include "FWCore/Reflection/interface/DictionaryTools.h" namespace edm { namespace global { @@ -157,6 +158,13 @@ namespace edm { ProductSelector::checkForDuplicateKeptBranch(desc, trueBranchIDToKeptBranchDesc); EDGetToken token; + + std::vector missingDictionaries; + if (!checkDictionary(missingDictionaries, desc.className(), desc.unwrappedType())) { + std::string context("Calling OutputModuleBase::keepThisBranch, checking dictionaries for kept types"); + throwMissingDictionariesException(missingDictionaries, context); + } + switch (desc.branchType()) { case InEvent: { if (desc.produced()) { @@ -178,6 +186,11 @@ namespace edm { InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName())); break; } + case InProcess: { + token = consumes(TypeToGet{desc.unwrappedTypeID(), PRODUCT_TYPE}, + InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName())); + break; + } default: assert(false); break; diff --git a/FWCore/Framework/src/global/filterImplementors.cc b/FWCore/Framework/src/global/filterImplementors.cc index 7a71bdf4a7dc5..747e6cedcd30d 100644 --- a/FWCore/Framework/src/global/filterImplementors.cc +++ b/FWCore/Framework/src/global/filterImplementors.cc @@ -19,6 +19,8 @@ namespace edm { namespace global { namespace impl { + template class BeginProcessBlockProducer; + template class EndProcessBlockProducer; template class BeginRunProducer; template class EndRunProducer; template class BeginLuminosityBlockProducer; diff --git a/FWCore/Framework/src/global/implementorsMethods.h b/FWCore/Framework/src/global/implementorsMethods.h index 3bdb7d281b5cd..f353384cb61f9 100644 --- a/FWCore/Framework/src/global/implementorsMethods.h +++ b/FWCore/Framework/src/global/implementorsMethods.h @@ -29,6 +29,16 @@ namespace edm { namespace global { namespace impl { + template + void BeginProcessBlockProducer::doBeginProcessBlockProduce_(ProcessBlock& pb) { + this->beginProcessBlockProduce(pb); + } + + template + void EndProcessBlockProducer::doEndProcessBlockProduce_(ProcessBlock& pb) { + this->endProcessBlockProduce(pb); + } + template void BeginRunProducer::doBeginRunProduce_(Run& rp, EventSetup const& c) { this->globalBeginRunProduce(rp, c); diff --git a/FWCore/Framework/src/global/producerImplementors.cc b/FWCore/Framework/src/global/producerImplementors.cc index e35473a036580..58c939153c385 100644 --- a/FWCore/Framework/src/global/producerImplementors.cc +++ b/FWCore/Framework/src/global/producerImplementors.cc @@ -19,6 +19,8 @@ namespace edm { namespace global { namespace impl { + template class BeginProcessBlockProducer; + template class EndProcessBlockProducer; template class BeginRunProducer; template class EndRunProducer; template class BeginLuminosityBlockProducer; diff --git a/FWCore/Framework/src/globalTransitionAsync.h b/FWCore/Framework/src/globalTransitionAsync.h index 6a7ff6a9fd3d5..0c18ea73e387b 100644 --- a/FWCore/Framework/src/globalTransitionAsync.h +++ b/FWCore/Framework/src/globalTransitionAsync.h @@ -19,6 +19,7 @@ // // system include files +#include "FWCore/Framework/interface/EventSetupImpl.h" #include "FWCore/Framework/interface/IOVSyncValue.h" #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/SubProcess.h" @@ -33,11 +34,12 @@ // forward declarations namespace edm { - class EventSetupImpl; class LuminosityBlockPrincipal; + class ProcessBlockPrincipal; class RunPrincipal; //This is code in common between beginStreamRun and beginGlobalLuminosityBlock + template inline void subProcessDoGlobalBeginTransitionAsync( WaitingTaskHolder iHolder, SubProcess& iSubProcess, @@ -47,6 +49,7 @@ namespace edm { iSubProcess.doBeginLuminosityBlockAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls); } + template inline void subProcessDoGlobalBeginTransitionAsync( WaitingTaskHolder iHolder, SubProcess& iSubProcess, @@ -56,6 +59,16 @@ namespace edm { iSubProcess.doBeginRunAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls); } + template + inline void subProcessDoGlobalBeginTransitionAsync( + WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + ProcessBlockPrincipal& iPrincipal, + IOVSyncValue const& iTS, + std::vector> const* iEventSetupImpls) { + iSubProcess.doBeginProcessBlockAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls); + } + inline void subProcessDoGlobalEndTransitionAsync( WaitingTaskHolder iHolder, SubProcess& iSubProcess, @@ -77,6 +90,16 @@ namespace edm { iSubProcess.doEndRunAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); } + inline void subProcessDoGlobalEndTransitionAsync( + WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + ProcessBlockPrincipal& iPrincipal, + IOVSyncValue const& iTS, + std::vector> const* iEventSetupImpls, + bool cleaningUpAfterException) { + iSubProcess.doEndProcessBlockAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); + } + template void beginGlobalTransitionAsync( WaitingTaskHolder iWait, @@ -100,11 +123,11 @@ namespace edm { [iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); WaitingTaskHolder h(delayError); for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalBeginTransitionAsync(h, subProcess, iPrincipal, iTS, iEventSetupImpls); + subProcessDoGlobalBeginTransitionAsync(h, subProcess, iPrincipal, iTS, iEventSetupImpls); } } else { for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalBeginTransitionAsync(iWait, subProcess, iPrincipal, iTS, iEventSetupImpls); + subProcessDoGlobalBeginTransitionAsync(iWait, subProcess, iPrincipal, iTS, iEventSetupImpls); } } }); @@ -113,6 +136,27 @@ namespace edm { iSchedule.processOneGlobalAsync(std::move(h), iPrincipal, iES, token); } + // The only purpose of this function is to create dummy values for the + // EventSetup arguments needed by the generic function beginGlobalTransitionsAsync + template + void beginGlobalTransitionAsync( + WaitingTaskHolder iWait, Schedule& iSchedule, P& iPrincipal, ServiceToken const& token, SC& iSubProcesses) { + // There is no EventSetup for ProcessBlock transitions + // so we just pass in dummy values that are not used. + IOVSyncValue dummyIOVSyncValue; + EventSetupImpl dummyEventSetupImpl; + std::vector> const* dummyEventSetupImpls = nullptr; + + beginGlobalTransitionAsync(std::move(iWait), + iSchedule, + iPrincipal, + dummyIOVSyncValue, + dummyEventSetupImpl, + dummyEventSetupImpls, + token, + iSubProcesses); + } + template void endGlobalTransitionAsync(WaitingTaskHolder iWait, Schedule& iSchedule, @@ -152,6 +196,31 @@ namespace edm { iSchedule.processOneGlobalAsync(std::move(h), iPrincipal, iES, token, cleaningUpAfterException); } + // The only purpose of this function is to create dummy values for the + // EventSetup arguments needed by the generic function endGlobalTransitionsAsync + template + void endGlobalTransitionAsync(WaitingTaskHolder iWait, + Schedule& iSchedule, + P& iPrincipal, + ServiceToken const& token, + SC& iSubProcesses, + bool cleaningUpAfterException) { + // There is no EventSetup for ProcessBlock transitions + // so we just pass in dummy values that are not used. + IOVSyncValue dummyIOVSyncValue; + EventSetupImpl dummyEventSetupImpl; + std::vector> const* dummyEventSetupImpls = nullptr; + + endGlobalTransitionAsync(std::move(iWait), + iSchedule, + iPrincipal, + dummyIOVSyncValue, + dummyEventSetupImpl, + dummyEventSetupImpls, + token, + iSubProcesses, + cleaningUpAfterException); + } }; // namespace edm #endif diff --git a/FWCore/Framework/src/limited/EDAnalyzerBase.cc b/FWCore/Framework/src/limited/EDAnalyzerBase.cc index 3415e1a6fac73..9f171f3324973 100644 --- a/FWCore/Framework/src/limited/EDAnalyzerBase.cc +++ b/FWCore/Framework/src/limited/EDAnalyzerBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/limited/EDAnalyzerBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -70,6 +71,27 @@ namespace edm { void EDAnalyzerBase::doEndJob() { this->endJob(); } + void EDAnalyzerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + } + + void EDAnalyzerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDAnalyzerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + } + void EDAnalyzerBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -191,6 +213,9 @@ namespace edm { LuminosityBlock const& lbp, EventSetup const& c) {} + void EDAnalyzerBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doEndProcessBlock_(ProcessBlock const&) {} void EDAnalyzerBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDAnalyzerBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDAnalyzerBase::doBeginRunSummary_(Run const& rp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/limited/EDFilterBase.cc b/FWCore/Framework/src/limited/EDFilterBase.cc index a46f89989c32b..725a9845efea0 100644 --- a/FWCore/Framework/src/limited/EDFilterBase.cc +++ b/FWCore/Framework/src/limited/EDFilterBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/limited/EDFilterBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -75,6 +76,33 @@ namespace edm { void EDFilterBase::doEndJob() { this->endJob(); } + void EDFilterBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doBeginProcessBlockProduce_(processBlock); + commit_(processBlock); + } + + void EDFilterBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDFilterBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doEndProcessBlockProduce_(processBlock); + commit_(processBlock); + } + void EDFilterBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -208,6 +236,9 @@ namespace edm { LuminosityBlock const& lbp, EventSetup const& c) {} + void EDFilterBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDFilterBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDFilterBase::doEndProcessBlock_(ProcessBlock const&) {} void EDFilterBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDFilterBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDFilterBase::doBeginRunSummary_(Run const& rp, EventSetup const& c) {} @@ -218,6 +249,8 @@ namespace edm { void EDFilterBase::doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c) {} void EDFilterBase::doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c) {} + void EDFilterBase::doBeginProcessBlockProduce_(ProcessBlock&) {} + void EDFilterBase::doEndProcessBlockProduce_(ProcessBlock&) {} void EDFilterBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {} void EDFilterBase::doEndRunProduce_(Run& rp, EventSetup const& c) {} void EDFilterBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/limited/EDProducerBase.cc b/FWCore/Framework/src/limited/EDProducerBase.cc index d0129b601b3a2..7b61e5cf5f396 100644 --- a/FWCore/Framework/src/limited/EDProducerBase.cc +++ b/FWCore/Framework/src/limited/EDProducerBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/limited/EDProducerBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -75,6 +76,33 @@ namespace edm { void EDProducerBase::doEndJob() { this->endJob(); } + void EDProducerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doBeginProcessBlockProduce_(processBlock); + commit_(processBlock); + } + + void EDProducerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDProducerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doEndProcessBlockProduce_(processBlock); + commit_(processBlock); + } + void EDProducerBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -208,6 +236,9 @@ namespace edm { LuminosityBlock const& lbp, EventSetup const& c) {} + void EDProducerBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDProducerBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDProducerBase::doEndProcessBlock_(ProcessBlock const&) {} void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDProducerBase::doBeginRunSummary_(Run const& rp, EventSetup const& c) {} @@ -218,6 +249,8 @@ namespace edm { void EDProducerBase::doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c) {} void EDProducerBase::doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c) {} + void EDProducerBase::doBeginProcessBlockProduce_(ProcessBlock&) {} + void EDProducerBase::doEndProcessBlockProduce_(ProcessBlock&) {} void EDProducerBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {} void EDProducerBase::doEndRunProduce_(Run& rp, EventSetup const& c) {} void EDProducerBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/limited/OutputModuleBase.cc b/FWCore/Framework/src/limited/OutputModuleBase.cc index 46e5d20201e3b..37415fe84c2aa 100644 --- a/FWCore/Framework/src/limited/OutputModuleBase.cc +++ b/FWCore/Framework/src/limited/OutputModuleBase.cc @@ -34,6 +34,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/DebugMacros.h" +#include "FWCore/Reflection/interface/DictionaryTools.h" namespace edm { namespace limited { @@ -158,6 +159,13 @@ namespace edm { ProductSelector::checkForDuplicateKeptBranch(desc, trueBranchIDToKeptBranchDesc); EDGetToken token; + + std::vector missingDictionaries; + if (!checkDictionary(missingDictionaries, desc.className(), desc.unwrappedType())) { + std::string context("Calling OutputModuleBase::keepThisBranch, checking dictionaries for kept types"); + throwMissingDictionariesException(missingDictionaries, context); + } + switch (desc.branchType()) { case InEvent: { if (desc.produced()) { @@ -179,6 +187,11 @@ namespace edm { InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName())); break; } + case InProcess: { + token = consumes(TypeToGet{desc.unwrappedTypeID(), PRODUCT_TYPE}, + InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName())); + break; + } default: assert(false); break; diff --git a/FWCore/Framework/src/limited/filterImplementors.cc b/FWCore/Framework/src/limited/filterImplementors.cc index a36c09e6934cf..f473eda71df44 100644 --- a/FWCore/Framework/src/limited/filterImplementors.cc +++ b/FWCore/Framework/src/limited/filterImplementors.cc @@ -19,6 +19,8 @@ namespace edm { namespace limited { namespace impl { + template class BeginProcessBlockProducer; + template class EndProcessBlockProducer; template class BeginRunProducer; template class EndRunProducer; template class BeginLuminosityBlockProducer; diff --git a/FWCore/Framework/src/limited/implementorsMethods.h b/FWCore/Framework/src/limited/implementorsMethods.h index 49da2e04151b5..bd4a8d463452a 100644 --- a/FWCore/Framework/src/limited/implementorsMethods.h +++ b/FWCore/Framework/src/limited/implementorsMethods.h @@ -28,6 +28,16 @@ namespace edm { namespace limited { namespace impl { + template + void BeginProcessBlockProducer::doBeginProcessBlockProduce_(ProcessBlock& pb) { + this->beginProcessBlockProduce(pb); + } + + template + void EndProcessBlockProducer::doEndProcessBlockProduce_(ProcessBlock& pb) { + this->endProcessBlockProduce(pb); + } + template void BeginRunProducer::doBeginRunProduce_(Run& rp, EventSetup const& c) { this->globalBeginRunProduce(rp, c); diff --git a/FWCore/Framework/src/limited/producerImplementors.cc b/FWCore/Framework/src/limited/producerImplementors.cc index e93b17de86efa..f6d7540f594d6 100644 --- a/FWCore/Framework/src/limited/producerImplementors.cc +++ b/FWCore/Framework/src/limited/producerImplementors.cc @@ -19,6 +19,8 @@ namespace edm { namespace limited { namespace impl { + template class BeginProcessBlockProducer; + template class EndProcessBlockProducer; template class BeginRunProducer; template class EndRunProducer; template class BeginLuminosityBlockProducer; diff --git a/FWCore/Framework/src/one/EDAnalyzerBase.cc b/FWCore/Framework/src/one/EDAnalyzerBase.cc index e67036ba0f501..c86771dc1d7d8 100644 --- a/FWCore/Framework/src/one/EDAnalyzerBase.cc +++ b/FWCore/Framework/src/one/EDAnalyzerBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/one/EDAnalyzerBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -82,6 +83,27 @@ namespace edm { } void EDAnalyzerBase::preallocLumis(unsigned int){}; + void EDAnalyzerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + } + + void EDAnalyzerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDAnalyzerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + } + void EDAnalyzerBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -134,6 +156,10 @@ namespace edm { //respondToCloseInputFile(fb); } + void EDAnalyzerBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doEndProcessBlock_(ProcessBlock const&) {} + void EDAnalyzerBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDAnalyzerBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDAnalyzerBase::doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/one/EDFilterBase.cc b/FWCore/Framework/src/one/EDFilterBase.cc index 4bdd5a705ee32..ec5ceb78b5c8d 100644 --- a/FWCore/Framework/src/one/EDFilterBase.cc +++ b/FWCore/Framework/src/one/EDFilterBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/one/EDFilterBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -82,6 +83,33 @@ namespace edm { } void EDFilterBase::preallocLumis(unsigned int){}; + void EDFilterBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doBeginProcessBlockProduce_(processBlock); + commit_(processBlock); + } + + void EDFilterBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDFilterBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doEndProcessBlockProduce_(processBlock); + commit_(processBlock); + } + void EDFilterBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -146,11 +174,16 @@ namespace edm { //respondToCloseInputFile(fb); } + void EDFilterBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDFilterBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDFilterBase::doEndProcessBlock_(ProcessBlock const&) {} void EDFilterBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDFilterBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDFilterBase::doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {} void EDFilterBase::doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {} + void EDFilterBase::doBeginProcessBlockProduce_(ProcessBlock&) {} + void EDFilterBase::doEndProcessBlockProduce_(ProcessBlock&) {} void EDFilterBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {} void EDFilterBase::doEndRunProduce_(Run& rp, EventSetup const& c) {} void EDFilterBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/one/EDProducerBase.cc b/FWCore/Framework/src/one/EDProducerBase.cc index ecf9702dd734b..ef2c55c43c514 100644 --- a/FWCore/Framework/src/one/EDProducerBase.cc +++ b/FWCore/Framework/src/one/EDProducerBase.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/one/EDProducerBase.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/src/edmodule_mightGet_config.h" @@ -82,6 +83,33 @@ namespace edm { void EDProducerBase::preallocLumis(unsigned int){}; + void EDProducerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doBeginProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doBeginProcessBlockProduce_(processBlock); + commit_(processBlock); + } + + void EDProducerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, false); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doAccessInputProcessBlock_(constProcessBlock); + } + + void EDProducerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) { + ProcessBlock processBlock(pbp, moduleDescription_, mcc, true); + processBlock.setConsumer(this); + ProcessBlock const& constProcessBlock = processBlock; + this->doEndProcessBlock_(constProcessBlock); + processBlock.setProducer(this); + this->doEndProcessBlockProduce_(processBlock); + commit_(processBlock); + } + void EDProducerBase::doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) { Run r(rp, moduleDescription_, mcc, false); r.setConsumer(this); @@ -146,11 +174,16 @@ namespace edm { //respondToCloseInputFile(fb); } + void EDProducerBase::doBeginProcessBlock_(ProcessBlock const&) {} + void EDProducerBase::doAccessInputProcessBlock_(ProcessBlock const&) {} + void EDProducerBase::doEndProcessBlock_(ProcessBlock const&) {} void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {} void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {} void EDProducerBase::doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {} void EDProducerBase::doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {} + void EDProducerBase::doBeginProcessBlockProduce_(ProcessBlock&) {} + void EDProducerBase::doEndProcessBlockProduce_(ProcessBlock&) {} void EDProducerBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {} void EDProducerBase::doEndRunProduce_(Run& rp, EventSetup const& c) {} void EDProducerBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {} diff --git a/FWCore/Framework/src/one/OutputModuleBase.cc b/FWCore/Framework/src/one/OutputModuleBase.cc index 5f316b9f222f8..5f9b398a962e9 100644 --- a/FWCore/Framework/src/one/OutputModuleBase.cc +++ b/FWCore/Framework/src/one/OutputModuleBase.cc @@ -170,6 +170,11 @@ namespace edm { InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName())); break; } + case InProcess: { + token = consumes(TypeToGet{desc.unwrappedTypeID(), PRODUCT_TYPE}, + InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName())); + break; + } default: assert(false); break; diff --git a/FWCore/Framework/src/one/filterImplementors.cc b/FWCore/Framework/src/one/filterImplementors.cc index 950b28e7bc847..e2eda045cb887 100644 --- a/FWCore/Framework/src/one/filterImplementors.cc +++ b/FWCore/Framework/src/one/filterImplementors.cc @@ -22,6 +22,8 @@ namespace edm { template class SharedResourcesUser; template class RunWatcher; template class LuminosityBlockWatcher; + template class BeginProcessBlockProducer; + template class EndProcessBlockProducer; template class BeginRunProducer; template class EndRunProducer; template class BeginLuminosityBlockProducer; diff --git a/FWCore/Framework/src/one/implementorsMethods.h b/FWCore/Framework/src/one/implementorsMethods.h index 71c7e50a4c25a..6c0d99d0875de 100644 --- a/FWCore/Framework/src/one/implementorsMethods.h +++ b/FWCore/Framework/src/one/implementorsMethods.h @@ -64,6 +64,16 @@ namespace edm { this->endLuminosityBlock(rp, c); } + template + void BeginProcessBlockProducer::doBeginProcessBlockProduce_(ProcessBlock& pb) { + this->beginProcessBlockProduce(pb); + } + + template + void EndProcessBlockProducer::doEndProcessBlockProduce_(ProcessBlock& pb) { + this->endProcessBlockProduce(pb); + } + template void BeginRunProducer::doBeginRunProduce_(Run& rp, EventSetup const& c) { this->beginRunProduce(rp, c); diff --git a/FWCore/Framework/src/one/producerImplementors.cc b/FWCore/Framework/src/one/producerImplementors.cc index aebb7195aa7f2..bab7c7059411f 100644 --- a/FWCore/Framework/src/one/producerImplementors.cc +++ b/FWCore/Framework/src/one/producerImplementors.cc @@ -22,6 +22,8 @@ namespace edm { template class SharedResourcesUser; template class RunWatcher; template class LuminosityBlockWatcher; + template class BeginProcessBlockProducer; + template class EndProcessBlockProducer; template class BeginRunProducer; template class EndRunProducer; template class BeginLuminosityBlockProducer; diff --git a/FWCore/Framework/test/MockEventProcessor.cc b/FWCore/Framework/test/MockEventProcessor.cc index 4a6cc2c2105b3..d97c0c13d5409 100644 --- a/FWCore/Framework/test/MockEventProcessor.cc +++ b/FWCore/Framework/test/MockEventProcessor.cc @@ -205,6 +205,10 @@ namespace edm { void MockEventProcessor::doErrorStuff() { output_ << "\tdoErrorStuff\n"; } + void MockEventProcessor::beginProcessBlock(bool& beginProcessBlockSucceeded) {} + void MockEventProcessor::inputProcessBlocks() {} + void MockEventProcessor::endProcessBlock(bool cleaningUpAfterException, bool beginProcessBlockSucceeded) {} + void MockEventProcessor::beginRun(ProcessHistoryID const& phid, RunNumber_t run, bool& globalTransitionSucceeded, diff --git a/FWCore/Framework/test/MockEventProcessor.h b/FWCore/Framework/test/MockEventProcessor.h index c69ad0fc7f718..a169c6e657ca9 100644 --- a/FWCore/Framework/test/MockEventProcessor.h +++ b/FWCore/Framework/test/MockEventProcessor.h @@ -51,6 +51,10 @@ namespace edm { void doErrorStuff(); + void beginProcessBlock(bool& beginProcessBlockSucceeded); + void inputProcessBlocks(); + void endProcessBlock(bool cleaningUpAfterException, bool beginProcessBlockSucceeded); + void beginRun(ProcessHistoryID const& phid, RunNumber_t run, bool& globalTransitionSucceeded, diff --git a/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc b/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc index b443596da3c07..bcbb3708995e4 100644 --- a/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc @@ -1,8 +1,8 @@ /*---------------------------------------------------------------------- -Toy edm::global::EDAnalyzer modules of -edm::*Cache templates +Toy edm::global::EDAnalyzer modules of +edm::*Cache templates for testing purposes only. ----------------------------------------------------------------------*/ @@ -18,6 +18,7 @@ for testing purposes only. #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -300,6 +301,86 @@ namespace edmtest { } }; + class ProcessBlockIntAnalyzer : public edm::global::EDAnalyzer> { + public: + explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { + { + auto tag = p.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = p.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + void analyze(edm::StreamID iID, edm::Event const&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "analyze before beginProcessBlock " << m_count; + } + ++m_count; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + { + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 21; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntAnalyzer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + } // namespace global } // namespace edmtest @@ -308,3 +389,4 @@ DEFINE_FWK_MODULE(edmtest::global::RunIntAnalyzer); DEFINE_FWK_MODULE(edmtest::global::LumiIntAnalyzer); DEFINE_FWK_MODULE(edmtest::global::RunSummaryIntAnalyzer); DEFINE_FWK_MODULE(edmtest::global::LumiSummaryIntAnalyzer); +DEFINE_FWK_MODULE(edmtest::global::ProcessBlockIntAnalyzer); diff --git a/FWCore/Framework/test/stubs/TestGlobalFilters.cc b/FWCore/Framework/test/stubs/TestGlobalFilters.cc index 9ee9181ee7934..280e0769282cd 100644 --- a/FWCore/Framework/test/stubs/TestGlobalFilters.cc +++ b/FWCore/Framework/test/stubs/TestGlobalFilters.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::global::EDFilter modules of +Toy edm::global::EDFilter modules of edm::*Cache templates and edm::*Producer classes for testing purposes only. @@ -18,6 +18,7 @@ for testing purposes only. #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -417,6 +418,187 @@ namespace edmtest { } }; + class ProcessBlockIntFilter : public edm::global::EDFilter> { + public: + explicit ProcessBlockIntFilter(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { + produces(); + { + auto tag = p.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = p.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToGet = 31; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + bool filter(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << m_count; + } + ++m_count; + return true; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter::end transitions " << m_count << " but it was supposed to be " << trans_; + } + { + const unsigned int valueToGet = 31; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 41; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + + class TestBeginProcessBlockFilter : public edm::global::EDFilter { + public: + explicit TestBeginProcessBlockFilter(edm::ParameterSet const& p) + : trans_(p.getParameter("transitions")), + token_(produces("begin")) { + produces(); + + auto tag = p.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void beginProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockFilter transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToPutAndGet = 31; + processBlock.emplace(token_, valueToPutAndGet); + + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + bool filter(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlockProduce " << m_count; + } + ++m_count; + return true; + } + + ~TestBeginProcessBlockFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + + class TestEndProcessBlockFilter : public edm::global::EDFilter { + public: + explicit TestEndProcessBlockFilter(edm::ParameterSet const& p) + : trans_(p.getParameter("transitions")), + token_(produces("end")) { + produces(); + + auto tag = p.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + bool filter(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + ++m_count; + return true; + } + + void endProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestEndProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + const unsigned int valueToPutAndGet = 41; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + ~TestEndProcessBlockFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "~TestEndProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + class TestBeginRunFilter : public edm::global::EDFilter, edm::BeginRunProducer> { public: explicit TestBeginRunFilter(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { @@ -579,6 +761,9 @@ DEFINE_FWK_MODULE(edmtest::global::RunIntFilter); DEFINE_FWK_MODULE(edmtest::global::LumiIntFilter); DEFINE_FWK_MODULE(edmtest::global::RunSummaryIntFilter); DEFINE_FWK_MODULE(edmtest::global::LumiSummaryIntFilter); +DEFINE_FWK_MODULE(edmtest::global::ProcessBlockIntFilter); +DEFINE_FWK_MODULE(edmtest::global::TestBeginProcessBlockFilter); +DEFINE_FWK_MODULE(edmtest::global::TestEndProcessBlockFilter); DEFINE_FWK_MODULE(edmtest::global::TestBeginRunFilter); DEFINE_FWK_MODULE(edmtest::global::TestBeginLumiBlockFilter); DEFINE_FWK_MODULE(edmtest::global::TestEndRunFilter); diff --git a/FWCore/Framework/test/stubs/TestGlobalProducers.cc b/FWCore/Framework/test/stubs/TestGlobalProducers.cc index 63c79f2201f60..2dca928ec0e43 100644 --- a/FWCore/Framework/test/stubs/TestGlobalProducers.cc +++ b/FWCore/Framework/test/stubs/TestGlobalProducers.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::global::EDProducer modules of +Toy edm::global::EDProducer modules of edm::*Cache templates and edm::*Producer classes for testing purposes only. @@ -18,6 +18,7 @@ for testing purposes only. #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -462,6 +463,183 @@ namespace edmtest { } }; + class ProcessBlockIntProducer : public edm::global::EDProducer> { + public: + explicit ProcessBlockIntProducer(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { + produces(); + { + auto tag = p.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = p.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + void produce(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << m_count; + } + ++m_count; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + { + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 21; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + + class TestBeginProcessBlockProducer : public edm::global::EDProducer { + public: + explicit TestBeginProcessBlockProducer(edm::ParameterSet const& p) + : trans_(p.getParameter("transitions")), + token_(produces("begin")) { + produces(); + + auto tag = p.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void beginProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToPutAndGet = 11; + processBlock.emplace(token_, valueToPutAndGet); + + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + void produce(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlockProduce " << m_count; + } + ++m_count; + } + + ~TestBeginProcessBlockProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + + class TestEndProcessBlockProducer : public edm::global::EDProducer { + public: + explicit TestEndProcessBlockProducer(edm::ParameterSet const& p) + : trans_(p.getParameter("transitions")), + token_(produces("end")) { + produces(); + + auto tag = p.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void produce(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { ++m_count; } + + void endProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestEndProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + const unsigned int valueToPutAndGet = 21; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + ~TestEndProcessBlockProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "~TestEndProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + class TestBeginRunProducer : public edm::global::EDProducer, edm::BeginRunProducer> { public: explicit TestBeginRunProducer(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { @@ -634,6 +812,9 @@ DEFINE_FWK_MODULE(edmtest::global::LumiIntProducer); DEFINE_FWK_MODULE(edmtest::global::RunSummaryIntProducer); DEFINE_FWK_MODULE(edmtest::global::LumiSummaryIntProducer); DEFINE_FWK_MODULE(edmtest::global::LumiSummaryLumiProducer); +DEFINE_FWK_MODULE(edmtest::global::ProcessBlockIntProducer); +DEFINE_FWK_MODULE(edmtest::global::TestBeginProcessBlockProducer); +DEFINE_FWK_MODULE(edmtest::global::TestEndProcessBlockProducer); DEFINE_FWK_MODULE(edmtest::global::TestBeginRunProducer); DEFINE_FWK_MODULE(edmtest::global::TestEndRunProducer); DEFINE_FWK_MODULE(edmtest::global::TestBeginLumiBlockProducer); diff --git a/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc b/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc index f40f2a1d93b95..3e4edc75a66a8 100644 --- a/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc @@ -1,8 +1,8 @@ /*---------------------------------------------------------------------- -Toy edm::limited::EDAnalyzer modules of -edm::*Cache templates +Toy edm::limited::EDAnalyzer modules of +edm::*Cache templates for testing purposes only. ----------------------------------------------------------------------*/ @@ -18,6 +18,7 @@ for testing purposes only. #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -315,6 +316,88 @@ namespace edmtest { } }; + class ProcessBlockIntAnalyzer : public edm::limited::EDAnalyzer> { + public: + explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& pset) + : edm::limited::EDAnalyzerBase(pset), + edm::limited::EDAnalyzer>(pset), + trans_(pset.getParameter("transitions")) { + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + void analyze(edm::StreamID iID, edm::Event const&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "analyze before beginProcessBlock " << m_count; + } + ++m_count; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + { + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 21; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntAnalyzer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + } // namespace limited } // namespace edmtest @@ -323,3 +406,4 @@ DEFINE_FWK_MODULE(edmtest::limited::RunIntAnalyzer); DEFINE_FWK_MODULE(edmtest::limited::LumiIntAnalyzer); DEFINE_FWK_MODULE(edmtest::limited::RunSummaryIntAnalyzer); DEFINE_FWK_MODULE(edmtest::limited::LumiSummaryIntAnalyzer); +DEFINE_FWK_MODULE(edmtest::limited::ProcessBlockIntAnalyzer); diff --git a/FWCore/Framework/test/stubs/TestLimitedFilters.cc b/FWCore/Framework/test/stubs/TestLimitedFilters.cc index 363b9c7471a7c..5502c69c3bf3e 100644 --- a/FWCore/Framework/test/stubs/TestLimitedFilters.cc +++ b/FWCore/Framework/test/stubs/TestLimitedFilters.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::limited::EDFilter modules of +Toy edm::limited::EDFilter modules of edm::*Cache templates and edm::*Producer classes for testing purposes only. @@ -18,6 +18,7 @@ for testing purposes only. #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -432,6 +433,192 @@ namespace edmtest { } }; + class ProcessBlockIntFilter : public edm::limited::EDFilter> { + public: + explicit ProcessBlockIntFilter(edm::ParameterSet const& pset) + : edm::limited::EDFilterBase(pset), + edm::limited::EDFilter>(pset), + trans_(pset.getParameter("transitions")) { + produces(); + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToGet = 31; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + bool filter(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << m_count; + } + ++m_count; + return true; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter::end transitions " << m_count << " but it was supposed to be " << trans_; + } + { + const unsigned int valueToGet = 31; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 41; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + + class TestBeginProcessBlockFilter : public edm::limited::EDFilter { + public: + explicit TestBeginProcessBlockFilter(edm::ParameterSet const& pset) + : edm::limited::EDFilterBase(pset), + edm::limited::EDFilter(pset), + trans_(pset.getParameter("transitions")), + token_(produces("begin")) { + produces(); + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void beginProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockFilter transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToPutAndGet = 31; + processBlock.emplace(token_, valueToPutAndGet); + + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + bool filter(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlockProduce " << m_count; + } + ++m_count; + return true; + } + + ~TestBeginProcessBlockFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + + class TestEndProcessBlockFilter : public edm::limited::EDFilter { + public: + explicit TestEndProcessBlockFilter(edm::ParameterSet const& pset) + : edm::limited::EDFilterBase(pset), + edm::limited::EDFilter(pset), + trans_(pset.getParameter("transitions")), + token_(produces("end")) { + produces(); + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + bool filter(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + ++m_count; + return true; + } + + void endProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestEndProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + const unsigned int valueToPutAndGet = 41; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + ~TestEndProcessBlockFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "~TestEndProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + class TestBeginRunFilter : public edm::limited::EDFilter, edm::BeginRunProducer> { public: explicit TestBeginRunFilter(edm::ParameterSet const& p) @@ -606,6 +793,9 @@ DEFINE_FWK_MODULE(edmtest::limited::RunIntFilter); DEFINE_FWK_MODULE(edmtest::limited::LumiIntFilter); DEFINE_FWK_MODULE(edmtest::limited::RunSummaryIntFilter); DEFINE_FWK_MODULE(edmtest::limited::LumiSummaryIntFilter); +DEFINE_FWK_MODULE(edmtest::limited::ProcessBlockIntFilter); +DEFINE_FWK_MODULE(edmtest::limited::TestBeginProcessBlockFilter); +DEFINE_FWK_MODULE(edmtest::limited::TestEndProcessBlockFilter); DEFINE_FWK_MODULE(edmtest::limited::TestBeginRunFilter); DEFINE_FWK_MODULE(edmtest::limited::TestBeginLumiBlockFilter); DEFINE_FWK_MODULE(edmtest::limited::TestEndRunFilter); diff --git a/FWCore/Framework/test/stubs/TestLimitedProducers.cc b/FWCore/Framework/test/stubs/TestLimitedProducers.cc index bf4057697cafb..8679180fb8564 100644 --- a/FWCore/Framework/test/stubs/TestLimitedProducers.cc +++ b/FWCore/Framework/test/stubs/TestLimitedProducers.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::limited::EDProducer modules of +Toy edm::limited::EDProducer modules of edm::*Cache templates and edm::*Producer classes for testing purposes only. @@ -18,6 +18,7 @@ for testing purposes only. #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -478,6 +479,192 @@ namespace edmtest { } }; + class ProcessBlockIntProducer : public edm::limited::EDProducer> { + public: + explicit ProcessBlockIntProducer(edm::ParameterSet const& pset) + : edm::limited::EDProducerBase(pset), + edm::limited::EDProducer>(pset), + trans_(pset.getParameter("transitions")) { + produces(); + + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + void produce(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << m_count; + } + ++m_count; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + { + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 21; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + + class TestBeginProcessBlockProducer : public edm::limited::EDProducer { + public: + explicit TestBeginProcessBlockProducer(edm::ParameterSet const& pset) + : edm::limited::EDProducerBase(pset), + edm::limited::EDProducer(pset), + trans_(pset.getParameter("transitions")), + token_(produces("begin")) { + produces(); + + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void beginProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToPutAndGet = 11; + processBlock.emplace(token_, valueToPutAndGet); + + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + void produce(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlockProduce " << m_count; + } + ++m_count; + } + + ~TestBeginProcessBlockProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + + class TestEndProcessBlockProducer : public edm::limited::EDProducer { + public: + explicit TestEndProcessBlockProducer(edm::ParameterSet const& pset) + : edm::limited::EDProducerBase(pset), + edm::limited::EDProducer(pset), + trans_(pset.getParameter("transitions")), + token_(produces("end")) { + produces(); + + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void produce(edm::StreamID iID, edm::Event&, edm::EventSetup const&) const override { ++m_count; } + + void endProcessBlockProduce(edm::ProcessBlock& processBlock) const override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestEndProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + + const unsigned int valueToPutAndGet = 21; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + ~TestEndProcessBlockProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "~TestEndProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + class TestBeginRunProducer : public edm::limited::EDProducer, edm::BeginRunProducer> { public: explicit TestBeginRunProducer(edm::ParameterSet const& p) @@ -664,6 +851,9 @@ DEFINE_FWK_MODULE(edmtest::limited::LumiIntProducer); DEFINE_FWK_MODULE(edmtest::limited::RunSummaryIntProducer); DEFINE_FWK_MODULE(edmtest::limited::LumiSummaryIntProducer); DEFINE_FWK_MODULE(edmtest::limited::LumiSummaryLumiProducer); +DEFINE_FWK_MODULE(edmtest::limited::ProcessBlockIntProducer); +DEFINE_FWK_MODULE(edmtest::limited::TestBeginProcessBlockProducer); +DEFINE_FWK_MODULE(edmtest::limited::TestEndProcessBlockProducer); DEFINE_FWK_MODULE(edmtest::limited::TestBeginRunProducer); DEFINE_FWK_MODULE(edmtest::limited::TestEndRunProducer); DEFINE_FWK_MODULE(edmtest::limited::TestBeginLumiBlockProducer); diff --git a/FWCore/Framework/test/stubs/TestOneAnalyzers.cc b/FWCore/Framework/test/stubs/TestOneAnalyzers.cc index d60e2a85763a9..cd54442ecc07c 100644 --- a/FWCore/Framework/test/stubs/TestOneAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestOneAnalyzers.cc @@ -1,8 +1,8 @@ /*---------------------------------------------------------------------- -Toy edm::one::EDAnalyzer modules of -edm::one cache templates +Toy edm::one::EDAnalyzer modules of +edm::one cache templates for testing purposes only. ----------------------------------------------------------------------*/ @@ -12,6 +12,7 @@ for testing purposes only. #include #include #include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/src/WorkerT.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/Framework/interface/Run.h" @@ -224,6 +225,87 @@ namespace edmtest { } }; + class ProcessBlockIntAnalyzer : public edm::one::EDAnalyzer> { + public: + explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& pset) : trans_(pset.getParameter("transitions")) { + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + void analyze(edm::Event const&, edm::EventSetup const&) override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "analyze before beginProcessBlock " << m_count; + } + ++m_count; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + + { + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 21; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntAnalyzer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + } // namespace one } // namespace edmtest @@ -232,3 +314,4 @@ DEFINE_FWK_MODULE(edmtest::one::WatchRunsAnalyzer); DEFINE_FWK_MODULE(edmtest::one::WatchLumiBlocksAnalyzer); DEFINE_FWK_MODULE(edmtest::one::RunCacheAnalyzer); DEFINE_FWK_MODULE(edmtest::one::LumiBlockCacheAnalyzer); +DEFINE_FWK_MODULE(edmtest::one::ProcessBlockIntAnalyzer); diff --git a/FWCore/Framework/test/stubs/TestOneFilters.cc b/FWCore/Framework/test/stubs/TestOneFilters.cc index 7439e46de7fe8..a6614bb306d1a 100644 --- a/FWCore/Framework/test/stubs/TestOneFilters.cc +++ b/FWCore/Framework/test/stubs/TestOneFilters.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::one::EDFilter modules of +Toy edm::one::EDFilter modules of edm::one cache classes and edm::*Producer classes for testing purposes only. @@ -12,6 +12,7 @@ for testing purposes only. #include #include #include "FWCore/Framework/interface/one/EDFilter.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/src/WorkerT.h" @@ -228,6 +229,191 @@ namespace edmtest { } }; + class ProcessBlockIntFilter : public edm::one::EDFilter> { + public: + explicit ProcessBlockIntFilter(edm::ParameterSet const& pset) : trans_(pset.getParameter("transitions")) { + produces(); + + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToGet = 31; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + bool filter(edm::Event&, edm::EventSetup const&) override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << m_count; + } + ++m_count; + return true; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter::end transitions " << m_count << " but it was supposed to be " << trans_; + } + + { + const unsigned int valueToGet = 31; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 41; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + + class TestBeginProcessBlockFilter : public edm::one::EDFilter { + public: + explicit TestBeginProcessBlockFilter(edm::ParameterSet const& pset) + : trans_(pset.getParameter("transitions")), + token_(produces("begin")) { + produces(); + + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void beginProcessBlockProduce(edm::ProcessBlock& processBlock) override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockFilter transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToPutAndGet = 31; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + bool filter(edm::Event&, edm::EventSetup const&) override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlockProduce " << m_count; + } + ++m_count; + return true; + } + + ~TestBeginProcessBlockFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + + class TestEndProcessBlockFilter : public edm::one::EDFilter { + public: + explicit TestEndProcessBlockFilter(edm::ParameterSet const& pset) + : trans_(pset.getParameter("transitions")), + token_(produces("end")) { + produces(); + + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + bool filter(edm::Event&, edm::EventSetup const&) override { + ++m_count; + return true; + } + + void endProcessBlockProduce(edm::ProcessBlock& processBlock) override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestEndProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + + const unsigned int valueToPutAndGet = 41; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + ~TestEndProcessBlockFilter() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "~TestEndProcessBlockFilter transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + class BeginRunFilter : public edm::one::EDFilter { public: explicit BeginRunFilter(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { @@ -372,6 +558,9 @@ DEFINE_FWK_MODULE(edmtest::one::WatchRunsFilter); DEFINE_FWK_MODULE(edmtest::one::WatchLumiBlocksFilter); DEFINE_FWK_MODULE(edmtest::one::RunCacheFilter); DEFINE_FWK_MODULE(edmtest::one::LumiBlockCacheFilter); +DEFINE_FWK_MODULE(edmtest::one::ProcessBlockIntFilter); +DEFINE_FWK_MODULE(edmtest::one::TestBeginProcessBlockFilter); +DEFINE_FWK_MODULE(edmtest::one::TestEndProcessBlockFilter); DEFINE_FWK_MODULE(edmtest::one::BeginRunFilter); DEFINE_FWK_MODULE(edmtest::one::BeginLumiBlockFilter); DEFINE_FWK_MODULE(edmtest::one::EndRunFilter); diff --git a/FWCore/Framework/test/stubs/TestOneProducers.cc b/FWCore/Framework/test/stubs/TestOneProducers.cc index a23c11699b7e2..44e5c11509dff 100644 --- a/FWCore/Framework/test/stubs/TestOneProducers.cc +++ b/FWCore/Framework/test/stubs/TestOneProducers.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::one::EDProducer modules of +Toy edm::one::EDProducer modules of edm::one cache classes and edm::*Producer classes for testing purposes only. @@ -19,6 +19,7 @@ for testing purposes only. #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -229,6 +230,187 @@ namespace edmtest { } }; + class ProcessBlockIntProducer : public edm::one::EDProducer> { + public: + explicit ProcessBlockIntProducer(edm::ParameterSet const& pset) : trans_(pset.getParameter("transitions")) { + produces(); + + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getTokenEnd_ = consumes(tag); + } + } + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer::begin transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + + void produce(edm::Event&, edm::EventSetup const&) override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << m_count; + } + ++m_count; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + + { + const unsigned int valueToGet = 11; + if (not getTokenBegin_.isUninitialized()) { + if (processBlock.get(getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 21; + if (not getTokenEnd_.isUninitialized()) { + if (processBlock.get(getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(getTokenEnd_); + } + } + } + } + + ~ProcessBlockIntProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "ProcessBlockIntProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDGetTokenT getTokenBegin_; + edm::EDGetTokenT getTokenEnd_; + }; + + class TestBeginProcessBlockProducer : public edm::one::EDProducer { + public: + explicit TestBeginProcessBlockProducer(edm::ParameterSet const& pset) + : trans_(pset.getParameter("transitions")), + token_(produces("begin")) { + produces(); + + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void beginProcessBlockProduce(edm::ProcessBlock& processBlock) override { + if (m_count != 0) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + + const unsigned int valueToPutAndGet = 11; + processBlock.emplace(token_, valueToPutAndGet); + + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + void produce(edm::Event&, edm::EventSetup const&) override { + if (m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlockProduce " << m_count; + } + ++m_count; + } + + ~TestBeginProcessBlockProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + + class TestEndProcessBlockProducer : public edm::one::EDProducer { + public: + explicit TestEndProcessBlockProducer(edm::ParameterSet const& pset) + : trans_(pset.getParameter("transitions")), + token_(produces("end")) { + produces(); + + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + getToken_ = consumes(tag); + } + } + + void produce(edm::Event&, edm::EventSetup const&) override { ++m_count; } + + void endProcessBlockProduce(edm::ProcessBlock& processBlock) override { + ++m_count; + if (m_count != trans_) { + throw cms::Exception("transitions") + << "TestEndProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + + const unsigned int valueToPutAndGet = 21; + processBlock.emplace(token_, valueToPutAndGet); + if (not getToken_.isUninitialized()) { + if (processBlock.get(getToken_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(getToken_); + } + } + } + + ~TestEndProcessBlockProducer() { + if (m_count != trans_) { + throw cms::Exception("transitions") + << "~TestEndProcessBlockProducer transitions " << m_count << " but it was supposed to be " << trans_; + } + } + + private: + const unsigned int trans_; + mutable std::atomic m_count{0}; + edm::EDPutTokenT token_; + edm::EDGetTokenT getToken_; + }; + class TestBeginRunProducer : public edm::one::EDProducer { public: explicit TestBeginRunProducer(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { @@ -394,6 +576,9 @@ DEFINE_FWK_MODULE(edmtest::one::WatchRunsProducer); DEFINE_FWK_MODULE(edmtest::one::WatchLumiBlocksProducer); DEFINE_FWK_MODULE(edmtest::one::RunCacheProducer); DEFINE_FWK_MODULE(edmtest::one::LumiBlockCacheProducer); +DEFINE_FWK_MODULE(edmtest::one::ProcessBlockIntProducer); +DEFINE_FWK_MODULE(edmtest::one::TestBeginProcessBlockProducer); +DEFINE_FWK_MODULE(edmtest::one::TestEndProcessBlockProducer); DEFINE_FWK_MODULE(edmtest::one::TestBeginRunProducer); DEFINE_FWK_MODULE(edmtest::one::TestBeginLumiBlockProducer); DEFINE_FWK_MODULE(edmtest::one::TestEndRunProducer); diff --git a/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc b/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc index 0e4e9c4546fe9..c59ca78c3d752 100644 --- a/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc @@ -1,8 +1,8 @@ /*---------------------------------------------------------------------- -Toy edm::stream::EDAnalyzer modules of -edm::*Cache templates +Toy edm::stream::EDAnalyzer modules of +edm::*Cache templates for testing purposes only. ----------------------------------------------------------------------*/ @@ -19,6 +19,7 @@ for testing purposes only. #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -37,9 +38,16 @@ namespace edmtest { mutable std::atomic run; mutable std::atomic lumi; }; + struct TestGlobalCacheAn { + CMS_THREAD_SAFE mutable edm::EDGetTokenT getTokenBegin_; + CMS_THREAD_SAFE mutable edm::EDGetTokenT getTokenEnd_; + unsigned int trans_{0}; + CMS_THREAD_SAFE mutable std::atomic m_count{0}; + }; } // namespace cache using Cache = cache::Cache; + using TestGlobalCacheAn = cache::TestGlobalCacheAn; class GlobalIntAnalyzer : public edm::stream::EDAnalyzer> { public: @@ -444,6 +452,101 @@ namespace edmtest { } }; + class ProcessBlockIntAnalyzer + : public edm::stream::EDAnalyzer, edm::GlobalCache> { + public: + explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& pset, TestGlobalCacheAn const* testGlobalCache) { + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenEnd_ = consumes(tag); + } + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheAn const* testGlobalCache) { + if (testGlobalCache->m_count != 0) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::begin transitions " + << testGlobalCache->m_count << " but it was supposed to be " << 0; + } + ++testGlobalCache->m_count; + + const unsigned int valueToGet = 51; + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + + static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCacheAn const*) { + return std::make_shared(); + } + + void analyze(edm::Event const&, edm::EventSetup const&) override { + TestGlobalCacheAn const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << testGlobalCache->m_count; + } + ++testGlobalCache->m_count; + } + + static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheAn const* testGlobalCache) { + ++testGlobalCache->m_count; + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::end transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + { + const unsigned int valueToGet = 51; + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 61; + if (not testGlobalCache->getTokenEnd_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenEnd_); + } + } + } + } + + static void globalEndJob(TestGlobalCacheAn* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockAnalyzer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~ProcessBlockIntAnalyzer() { + TestGlobalCacheAn const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + } // namespace stream } // namespace edmtest std::atomic edmtest::stream::GlobalIntAnalyzer::m_count{0}; @@ -484,3 +587,4 @@ DEFINE_FWK_MODULE(edmtest::stream::RunIntAnalyzer); DEFINE_FWK_MODULE(edmtest::stream::LumiIntAnalyzer); DEFINE_FWK_MODULE(edmtest::stream::RunSummaryIntAnalyzer); DEFINE_FWK_MODULE(edmtest::stream::LumiSummaryIntAnalyzer); +DEFINE_FWK_MODULE(edmtest::stream::ProcessBlockIntAnalyzer); diff --git a/FWCore/Framework/test/stubs/TestStreamFilters.cc b/FWCore/Framework/test/stubs/TestStreamFilters.cc index c18a2a0c42d98..fe89a436b5485 100644 --- a/FWCore/Framework/test/stubs/TestStreamFilters.cc +++ b/FWCore/Framework/test/stubs/TestStreamFilters.cc @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------- -Toy edm::stream::EDFilter modules of +Toy edm::stream::EDFilter modules of edm::*Cache templates and edm::*Producer classes for testing purposes only. @@ -19,6 +19,7 @@ for testing purposes only. #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDMException.h" @@ -35,9 +36,17 @@ namespace edmtest { mutable std::atomic lumi; }; + struct TestGlobalCacheFil { + CMS_THREAD_SAFE mutable edm::EDPutTokenT token_; + CMS_THREAD_SAFE mutable edm::EDGetTokenT getTokenBegin_; + CMS_THREAD_SAFE mutable edm::EDGetTokenT getTokenEnd_; + unsigned int trans_{0}; + CMS_THREAD_SAFE mutable std::atomic m_count{0}; + }; } // namespace cache using Cache = cache::Cache; + using TestGlobalCacheFil = cache::TestGlobalCacheFil; class GlobalIntFilter : public edm::stream::EDFilter> { public: @@ -428,6 +437,223 @@ namespace edmtest { } }; + class ProcessBlockIntFilter + : public edm::stream::EDFilter, edm::GlobalCache> { + public: + explicit ProcessBlockIntFilter(edm::ParameterSet const& pset, TestGlobalCacheFil const* testGlobalCache) { + produces(); + + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenEnd_ = consumes(tag); + } + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheFil const* testGlobalCache) { + if (testGlobalCache->m_count != 0) { + throw cms::Exception("transitions") << "ProcessBlockIntFilter::begin transitions " << testGlobalCache->m_count + << " but it was supposed to be " << 0; + } + ++testGlobalCache->m_count; + const unsigned int valueToGet = 71; + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + + static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCacheFil const*) { + return std::make_shared(); + } + + bool filter(edm::Event&, edm::EventSetup const&) override { + TestGlobalCacheFil const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << testGlobalCache->m_count; + } + ++testGlobalCache->m_count; + return true; + } + + static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheFil const* testGlobalCache) { + ++testGlobalCache->m_count; + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntFilter::end transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + { + const unsigned int valueToGet = 71; + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 81; + if (not testGlobalCache->getTokenEnd_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenEnd_); + } + } + } + } + + static void globalEndJob(TestGlobalCacheFil* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~ProcessBlockIntFilter() { + TestGlobalCacheFil const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + + class TestBeginProcessBlockFilter + : public edm::stream::EDFilter> { + public: + explicit TestBeginProcessBlockFilter(edm::ParameterSet const& pset, TestGlobalCacheFil const* testGlobalCache) { + testGlobalCache->token_ = produces("begin"); + produces(); + + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenBegin_ = consumes(tag); + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + static void beginProcessBlockProduce(edm::ProcessBlock& processBlock, TestGlobalCacheFil const* testGlobalCache) { + if (testGlobalCache->m_count != 0) { + throw cms::Exception("transitions") << "TestBeginProcessBlockFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << 0; + } + ++testGlobalCache->m_count; + + const unsigned int valueToPutAndGet = 71; + processBlock.emplace(testGlobalCache->token_, valueToPutAndGet); + + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + + bool filter(edm::Event&, edm::EventSetup const&) override { + TestGlobalCacheFil const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count < 1u) { + throw cms::Exception("out of sequence") + << "produce before beginProcessBlockProduce " << testGlobalCache->m_count; + } + ++testGlobalCache->m_count; + return true; + } + + static void globalEndJob(TestGlobalCacheFil* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "TestBeginProcessBlockFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~TestBeginProcessBlockFilter() { + TestGlobalCacheFil const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "TestBeginProcessBlockFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + + class TestEndProcessBlockFilter + : public edm::stream::EDFilter> { + public: + explicit TestEndProcessBlockFilter(edm::ParameterSet const& pset, TestGlobalCacheFil const* testGlobalCache) { + testGlobalCache->token_ = produces("end"); + produces(); + + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenEnd_ = consumes(tag); + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + bool filter(edm::Event&, edm::EventSetup const&) override { + TestGlobalCacheFil const* testGlobalCache = globalCache(); + ++testGlobalCache->m_count; + return true; + } + + static void endProcessBlockProduce(edm::ProcessBlock& processBlock, TestGlobalCacheFil const* testGlobalCache) { + ++testGlobalCache->m_count; + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "TestEndProcessBlockFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + + const unsigned int valueToPutAndGet = 81; + processBlock.emplace(testGlobalCache->token_, valueToPutAndGet); + if (not testGlobalCache->getTokenEnd_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenEnd_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(testGlobalCache->getTokenEnd_); + } + } + } + + static void globalEndJob(TestGlobalCacheFil* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "TestEndProcessBlockFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~TestEndProcessBlockFilter() { + TestGlobalCacheFil const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "~TestEndProcessBlockFilter transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + class TestBeginRunFilter : public edm::stream::EDFilter, edm::BeginRunProducer> { public: static std::atomic m_count; @@ -719,6 +945,9 @@ DEFINE_FWK_MODULE(edmtest::stream::RunIntFilter); DEFINE_FWK_MODULE(edmtest::stream::LumiIntFilter); DEFINE_FWK_MODULE(edmtest::stream::RunSummaryIntFilter); DEFINE_FWK_MODULE(edmtest::stream::LumiSummaryIntFilter); +DEFINE_FWK_MODULE(edmtest::stream::ProcessBlockIntFilter); +DEFINE_FWK_MODULE(edmtest::stream::TestBeginProcessBlockFilter); +DEFINE_FWK_MODULE(edmtest::stream::TestEndProcessBlockFilter); DEFINE_FWK_MODULE(edmtest::stream::TestBeginRunFilter); DEFINE_FWK_MODULE(edmtest::stream::TestEndRunFilter); DEFINE_FWK_MODULE(edmtest::stream::TestBeginLumiBlockFilter); diff --git a/FWCore/Framework/test/stubs/TestStreamProducers.cc b/FWCore/Framework/test/stubs/TestStreamProducers.cc index be19a817c3640..bace26ee82cb4 100644 --- a/FWCore/Framework/test/stubs/TestStreamProducers.cc +++ b/FWCore/Framework/test/stubs/TestStreamProducers.cc @@ -1,8 +1,8 @@ /*---------------------------------------------------------------------- -Toy edm::stream::EDProducer modules of -edm::*Cache templates and edm::*Producer classes +Toy edm::stream::EDProducer modules of +edm::*Cache templates and edm::*Producer classes for testing purposes only. ----------------------------------------------------------------------*/ @@ -19,6 +19,7 @@ for testing purposes only. #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDMException.h" @@ -42,10 +43,19 @@ namespace edmtest { unsigned int lumi; }; + struct TestGlobalCache { + CMS_THREAD_SAFE mutable edm::EDPutTokenT token_; + CMS_THREAD_SAFE mutable edm::EDGetTokenT getTokenBegin_; + CMS_THREAD_SAFE mutable edm::EDGetTokenT getTokenEnd_; + unsigned int trans_{0}; + CMS_THREAD_SAFE mutable std::atomic m_count{0}; + }; + } // namespace cache using Cache = cache::Cache; using UnsafeCache = cache::UnsafeCache; + using TestGlobalCache = cache::TestGlobalCache; class GlobalIntProducer : public edm::stream::EDProducer> { public: @@ -448,6 +458,225 @@ namespace edmtest { } }; + class ProcessBlockIntProducer + : public edm::stream::EDProducer, edm::GlobalCache> { + public: + explicit ProcessBlockIntProducer(edm::ParameterSet const& pset, TestGlobalCache const* testGlobalCache) { + produces(); + + { + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenBegin_ = consumes(tag); + } + } + { + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenEnd_ = consumes(tag); + } + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCache const* testGlobalCache) { + if (testGlobalCache->m_count != 0) { + throw cms::Exception("transitions") << "ProcessBlockIntProducer::begin transitions " + << testGlobalCache->m_count << " but it was supposed to be " << 0; + } + ++testGlobalCache->m_count; + + const unsigned int valueToGet = 51; + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + + static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCache const*) { + return std::make_shared(); + } + + void produce(edm::Event&, edm::EventSetup const&) override { + TestGlobalCache const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count < 1u) { + throw cms::Exception("out of sequence") << "produce before beginProcessBlock " << testGlobalCache->m_count; + } + ++testGlobalCache->m_count; + } + + static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCache const* testGlobalCache) { + ++testGlobalCache->m_count; + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntProducer::end transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + { + const unsigned int valueToGet = 51; + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + { + const unsigned int valueToGet = 61; + if (not testGlobalCache->getTokenEnd_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenEnd_) != valueToGet) { + throw cms::Exception("BadValue") + << "expected " << valueToGet << " but got " << processBlock.get(testGlobalCache->getTokenEnd_); + } + } + } + } + + static void globalEndJob(TestGlobalCache* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~ProcessBlockIntProducer() { + TestGlobalCache const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "ProcessBlockIntProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + + class TestBeginProcessBlockProducer + : public edm::stream::EDProducer> { + public: + explicit TestBeginProcessBlockProducer(edm::ParameterSet const& pset, TestGlobalCache const* testGlobalCache) { + testGlobalCache->token_ = produces("begin"); + produces(); + + auto tag = pset.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenBegin_ = consumes(tag); + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + static void beginProcessBlockProduce(edm::ProcessBlock& processBlock, TestGlobalCache const* testGlobalCache) { + if (testGlobalCache->m_count != 0) { + throw cms::Exception("transitions") << "TestBeginProcessBlockProducer transitions " + << testGlobalCache->m_count << " but it was supposed to be " << 0; + } + ++testGlobalCache->m_count; + + const unsigned int valueToPutAndGet = 51; + processBlock.emplace(testGlobalCache->token_, valueToPutAndGet); + + if (not testGlobalCache->getTokenBegin_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenBegin_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(testGlobalCache->getTokenBegin_); + } + } + } + + void produce(edm::Event&, edm::EventSetup const&) override { + TestGlobalCache const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count < 1u) { + throw cms::Exception("out of sequence") + << "produce before beginProcessBlockProduce " << testGlobalCache->m_count; + } + ++testGlobalCache->m_count; + } + + static void globalEndJob(TestGlobalCache* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~TestBeginProcessBlockProducer() { + TestGlobalCache const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + + class TestEndProcessBlockProducer + : public edm::stream::EDProducer> { + public: + explicit TestEndProcessBlockProducer(edm::ParameterSet const& pset, TestGlobalCache const* testGlobalCache) { + testGlobalCache->token_ = produces("end"); + produces(); + + auto tag = pset.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + testGlobalCache->getTokenEnd_ = consumes(tag); + } + } + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + auto testGlobalCache = std::make_unique(); + testGlobalCache->trans_ = pset.getParameter("transitions"); + return testGlobalCache; + } + + void produce(edm::Event&, edm::EventSetup const&) override { + TestGlobalCache const* testGlobalCache = globalCache(); + ++testGlobalCache->m_count; + } + + static void endProcessBlockProduce(edm::ProcessBlock& processBlock, TestGlobalCache const* testGlobalCache) { + ++testGlobalCache->m_count; + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "TestEndProcessBlockProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + const unsigned int valueToPutAndGet = 61; + processBlock.emplace(testGlobalCache->token_, valueToPutAndGet); + + if (not testGlobalCache->getTokenEnd_.isUninitialized()) { + if (processBlock.get(testGlobalCache->getTokenEnd_) != valueToPutAndGet) { + throw cms::Exception("BadValue") + << "expected " << valueToPutAndGet << " but got " << processBlock.get(testGlobalCache->getTokenEnd_); + } + } + } + + static void globalEndJob(TestGlobalCache* testGlobalCache) { + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") + << "TestBeginProcessBlockProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + + ~TestEndProcessBlockProducer() { + TestGlobalCache const* testGlobalCache = globalCache(); + if (testGlobalCache->m_count != testGlobalCache->trans_) { + throw cms::Exception("transitions") << "~TestEndProcessBlockProducer transitions " << testGlobalCache->m_count + << " but it was supposed to be " << testGlobalCache->trans_; + } + } + }; + class TestBeginRunProducer : public edm::stream::EDProducer, edm::BeginRunProducer> { public: static std::atomic m_count; @@ -757,6 +986,9 @@ DEFINE_FWK_MODULE(edmtest::stream::RunIntProducer); DEFINE_FWK_MODULE(edmtest::stream::LumiIntProducer); DEFINE_FWK_MODULE(edmtest::stream::RunSummaryIntProducer); DEFINE_FWK_MODULE(edmtest::stream::LumiSummaryIntProducer); +DEFINE_FWK_MODULE(edmtest::stream::ProcessBlockIntProducer); +DEFINE_FWK_MODULE(edmtest::stream::TestBeginProcessBlockProducer); +DEFINE_FWK_MODULE(edmtest::stream::TestEndProcessBlockProducer); DEFINE_FWK_MODULE(edmtest::stream::TestBeginRunProducer); DEFINE_FWK_MODULE(edmtest::stream::TestEndRunProducer); DEFINE_FWK_MODULE(edmtest::stream::TestBeginLumiBlockProducer); diff --git a/FWCore/Framework/test/stubs/ToyIntProducers.cc b/FWCore/Framework/test/stubs/ToyIntProducers.cc index 63e95a08c9177..9f7b3cae59941 100644 --- a/FWCore/Framework/test/stubs/ToyIntProducers.cc +++ b/FWCore/Framework/test/stubs/ToyIntProducers.cc @@ -16,6 +16,7 @@ Toy EDProducers of Ints for testing purposes only. #include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -26,6 +27,7 @@ Toy EDProducers of Ints for testing purposes only. #include #include #include +#include namespace edmtest { @@ -492,18 +494,31 @@ namespace edmtest { edm::BeginRunProducer, edm::BeginLuminosityBlockProducer, edm::EndLuminosityBlockProducer, - edm::EndRunProducer> { + edm::EndRunProducer, + edm::BeginProcessBlockProducer, + edm::EndProcessBlockProducer> { public: explicit NonEventIntProducer(edm::ParameterSet const& p) - : brToken_{produces("beginRun")}, + : bpbToken_{produces("beginProcessBlock")}, + brToken_{produces("beginRun")}, blToken_{produces("beginLumi")}, elToken_{produces("endLumi")}, erToken_{produces("endRun")}, + epbToken_{produces("endProcessBlock")}, value_(p.getParameter("ivalue")), + sleepTime_(p.getParameter("sleepTime")), + bpbExpect_{p.getUntrackedParameter("expectBeginProcessBlock")}, brExpect_{p.getUntrackedParameter("expectBeginRun")}, blExpect_{p.getUntrackedParameter("expectBeginLuminosityBlock")}, elExpect_{p.getUntrackedParameter("expectEndLuminosityBlock")}, - erExpect_{p.getUntrackedParameter("expectEndRun")} { + erExpect_{p.getUntrackedParameter("expectEndRun")}, + epbExpect_{p.getUntrackedParameter("expectEndProcessBlock")} { + { + auto tag = p.getParameter("consumesBeginProcessBlock"); + if (not tag.label().empty()) { + bpbGet_ = consumes(tag); + } + } { auto tag = p.getParameter("consumesBeginRun"); if (not tag.label().empty()) { @@ -528,8 +543,16 @@ namespace edmtest { erGet_ = consumes(tag); } } + { + auto tag = p.getParameter("consumesEndProcessBlock"); + if (not tag.label().empty()) { + epbGet_ = consumes(tag); + } + } } void accumulate(edm::StreamID iID, edm::Event const& e, edm::EventSetup const& c) const override; + void beginProcessBlockProduce(edm::ProcessBlock&) const override; + void endProcessBlockProduce(edm::ProcessBlock&) const override; void globalBeginRunProduce(edm::Run& e, edm::EventSetup const&) const override; void globalEndRunProduce(edm::Run& e, edm::EventSetup const&) const override; void globalBeginLuminosityBlockProduce(edm::LuminosityBlock& e, edm::EventSetup const&) const override; @@ -538,6 +561,11 @@ namespace edmtest { static void fillDescriptions(edm::ConfigurationDescriptions& conf) { edm::ParameterSetDescription desc; desc.add("ivalue", 0); + desc.add("sleepTime", 0); + desc.add("consumesBeginProcessBlock", {}); + desc.addUntracked("expectBeginProcessBlock", 0); + desc.add("consumesEndProcessBlock", {}); + desc.addUntracked("expectEndProcessBlock", 0); desc.add("consumesBeginRun", {}); desc.addUntracked("expectBeginRun", 0); desc.add("consumesEndRun", {}); @@ -552,44 +580,81 @@ namespace edmtest { private: void check(IntProduct, int) const; + const edm::EDPutTokenT bpbToken_; const edm::EDPutTokenT brToken_; const edm::EDPutTokenT blToken_; const edm::EDPutTokenT elToken_; const edm::EDPutTokenT erToken_; + const edm::EDPutTokenT epbToken_; const int value_; + const unsigned int sleepTime_; + edm::EDGetTokenT bpbGet_; edm::EDGetTokenT brGet_; edm::EDGetTokenT blGet_; edm::EDGetTokenT elGet_; edm::EDGetTokenT erGet_; + edm::EDGetTokenT epbGet_; + const int bpbExpect_; const int brExpect_; const int blExpect_; const int elExpect_; const int erExpect_; + const int epbExpect_; }; void NonEventIntProducer::accumulate(edm::StreamID iID, edm::Event const& e, edm::EventSetup const&) const {} + void NonEventIntProducer::beginProcessBlockProduce(edm::ProcessBlock& processBlock) const { + if (not bpbGet_.isUninitialized()) { + check(processBlock.get(bpbGet_), bpbExpect_); + } + if (sleepTime_ > 0) { + usleep(sleepTime_); + } + processBlock.emplace(bpbToken_, value_); + } + void NonEventIntProducer::endProcessBlockProduce(edm::ProcessBlock& processBlock) const { + if (not epbGet_.isUninitialized()) { + check(processBlock.get(epbGet_), epbExpect_); + } + if (sleepTime_ > 0) { + usleep(sleepTime_); + } + processBlock.emplace(epbToken_, value_); + } void NonEventIntProducer::globalBeginRunProduce(edm::Run& r, edm::EventSetup const&) const { if (not brGet_.isUninitialized()) { check(r.get(brGet_), brExpect_); } + if (sleepTime_ > 0) { + usleep(sleepTime_); + } r.emplace(brToken_, value_); } void NonEventIntProducer::globalEndRunProduce(edm::Run& r, edm::EventSetup const&) const { if (not erGet_.isUninitialized()) { check(r.get(erGet_), erExpect_); } + if (sleepTime_ > 0) { + usleep(sleepTime_); + } r.emplace(erToken_, value_); } void NonEventIntProducer::globalBeginLuminosityBlockProduce(edm::LuminosityBlock& l, edm::EventSetup const&) const { if (not blGet_.isUninitialized()) { check(l.get(blGet_), blExpect_); } + if (sleepTime_ > 0) { + usleep(sleepTime_); + } l.emplace(blToken_, value_); } void NonEventIntProducer::globalEndLuminosityBlockProduce(edm::LuminosityBlock& l, edm::EventSetup const&) const { if (not elGet_.isUninitialized()) { check(l.get(elGet_), elExpect_); } + if (sleepTime_ > 0) { + usleep(sleepTime_); + } l.emplace(elToken_, value_); } void NonEventIntProducer::check(IntProduct iProd, int iExpect) const { @@ -597,6 +662,56 @@ namespace edmtest { throw cms::Exception("BadValue") << "expected " << iExpect << " but got " << iProd.value; } } + + //-------------------------------------------------------------------- + // + // Produces an IntProduct in ProcessBlock at beginProcessBlock + // + class IntProducerBeginProcessBlock : public edm::global::EDProducer { + public: + explicit IntProducerBeginProcessBlock(edm::ParameterSet const& p) + : token_{produces()}, value_(p.getParameter("ivalue")) {} + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override {} + void beginProcessBlockProduce(edm::ProcessBlock&) const override; + + private: + edm::EDPutTokenT token_; + int value_; + }; + + void IntProducerBeginProcessBlock::beginProcessBlockProduce(edm::ProcessBlock& processBlock) const { + processBlock.emplace(token_, value_); + } + + //-------------------------------------------------------------------- + // + // Produces an IntProduct in ProcessBlock at endProcessBlock + // + class IntProducerEndProcessBlock : public edm::global::EDProducer { + public: + explicit IntProducerEndProcessBlock(edm::ParameterSet const& p) + : token_{produces()}, + token2_{produces("two")}, + token3_{produces("three")}, + token4_{produces("four")}, + value_(p.getParameter("ivalue")) {} + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override {} + void endProcessBlockProduce(edm::ProcessBlock&) const override; + + private: + edm::EDPutTokenT token_; + edm::EDPutToken token2_; + edm::EDPutTokenT token3_; + edm::EDPutToken token4_; + int value_; + }; + + void IntProducerEndProcessBlock::endProcessBlockProduce(edm::ProcessBlock& processBlock) const { + processBlock.emplace(token_, value_); + processBlock.emplace(token2_, value_ + 2); + processBlock.put(token3_, std::make_unique(value_ + 3)); + processBlock.put(token4_, std::make_unique(value_ + 4)); + } } // namespace edmtest using edmtest::AddIntsProducer; @@ -609,6 +724,8 @@ using edmtest::FailingProducer; using edmtest::Int16_tProducer; using edmtest::IntLegacyProducer; using edmtest::IntProducer; +using edmtest::IntProducerBeginProcessBlock; +using edmtest::IntProducerEndProcessBlock; using edmtest::IntProducerFromTransient; using edmtest::ManyIntProducer; using edmtest::ManyIntWhenRegisteredProducer; @@ -632,3 +749,5 @@ DEFINE_FWK_MODULE(AddIntsProducer); DEFINE_FWK_MODULE(ManyIntProducer); DEFINE_FWK_MODULE(ManyIntWhenRegisteredProducer); DEFINE_FWK_MODULE(NonEventIntProducer); +DEFINE_FWK_MODULE(IntProducerBeginProcessBlock); +DEFINE_FWK_MODULE(IntProducerEndProcessBlock); diff --git a/FWCore/Framework/test/test_global_modules_cfg.py b/FWCore/Framework/test/test_global_modules_cfg.py index 10ce5c80aad27..9417be41179ff 100644 --- a/FWCore/Framework/test/test_global_modules_cfg.py +++ b/FWCore/Framework/test/test_global_modules_cfg.py @@ -24,7 +24,7 @@ timeBetweenEvents = cms.untracked.uint64(1000), firstTime = cms.untracked.uint64(1000000), numberEventsInRun = cms.untracked.uint32(nEvtRun), - numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) + numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) ) process.StreamIntProd = cms.EDProducer("edmtest::global::StreamIntProducer", @@ -52,6 +52,32 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntProd = cms.EDProducer("edmtest::global::ProcessBlockIntProducer", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + +process.TestBeginProcessBlockProd = cms.EDProducer("edmtest::global::TestBeginProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockProdRead = cms.EDProducer("edmtest::global::TestBeginProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin") +) + +process.TestEndProcessBlockProd = cms.EDProducer("edmtest::global::TestEndProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockProdRead = cms.EDProducer("edmtest::global::TestEndProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.TestBeginRunProd = cms.EDProducer("edmtest::global::TestBeginRunProducer", transitions = cms.int32(int(nEvt/nEvtRun)) ) @@ -93,6 +119,12 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntAn = cms.EDAnalyzer("edmtest::global::ProcessBlockIntAnalyzer", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.StreamIntFil = cms.EDFilter("edmtest::global::StreamIntFilter", transitions = cms.int32(int(nEvt+nStreams*(2*(nEvt/nEvtRun)+2*(nEvt/nEvtLumi)+2))) ,cachevalue = cms.int32(1) @@ -118,6 +150,32 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntFil = cms.EDFilter("edmtest::global::ProcessBlockIntFilter", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + +process.TestBeginProcessBlockFil = cms.EDFilter("edmtest::global::TestBeginProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockFilRead = cms.EDFilter("edmtest::global::TestBeginProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin") +) + +process.TestEndProcessBlockFil = cms.EDFilter("edmtest::global::TestEndProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockFilRead = cms.EDFilter("edmtest::global::TestEndProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + process.TestBeginRunFil = cms.EDFilter("edmtest::global::TestBeginRunFilter", transitions = cms.int32(int(nEvt/nEvtRun)) ) @@ -150,4 +208,40 @@ process.task = cms.Task(process.TestAccumulator1) -process.p = cms.Path(process.StreamIntProd+process.RunIntProd+process.LumiIntProd+process.RunSumIntProd+process.LumiSumIntProd+process.TestBeginRunProd+process.TestEndRunProd+process.TestBeginLumiBlockProd+process.TestEndLumiBlockProd+process.StreamIntAn+process.RunIntAn+process.LumiIntAn+process.RunSumIntAn+process.LumiSumIntAn+process.StreamIntFil+process.RunIntFil+process.LumiIntFil+process.RunSumIntFil+process.LumiSumIntFil+process.TestBeginRunFil+process.TestEndRunFil+process.TestBeginLumiBlockFil+process.TestEndLumiBlockFil+process.testFilterModule+process.TestAccumulator2, process.task) +process.p = cms.Path(process.StreamIntProd + + process.RunIntProd + + process.LumiIntProd + + process.RunSumIntProd + + process.LumiSumIntProd + + process.ProcessBlockIntProd + + process.TestBeginProcessBlockProdRead + + process.TestBeginProcessBlockProd + + process.TestEndProcessBlockProdRead + + process.TestEndProcessBlockProd + + process.TestBeginRunProd + + process.TestEndRunProd + + process.TestBeginLumiBlockProd + + process.TestEndLumiBlockProd + + process.StreamIntAn + + process.RunIntAn + + process.LumiIntAn + + process.RunSumIntAn + + process.LumiSumIntAn + + process.ProcessBlockIntAn + + process.StreamIntFil + + process.RunIntFil + + process.LumiIntFil + + process.RunSumIntFil + + process.LumiSumIntFil + + process.ProcessBlockIntFil + + process.TestBeginProcessBlockFilRead + + process.TestBeginProcessBlockFil + + process.TestEndProcessBlockFilRead + + process.TestEndProcessBlockFil + + process.TestBeginRunFil + + process.TestEndRunFil + + process.TestBeginLumiBlockFil + + process.TestEndLumiBlockFil + + process.testFilterModule + + process.TestAccumulator2, + process.task) diff --git a/FWCore/Framework/test/test_limited_modules_cfg.py b/FWCore/Framework/test/test_limited_modules_cfg.py index fd44e452b80cb..9a05413e706c5 100644 --- a/FWCore/Framework/test/test_limited_modules_cfg.py +++ b/FWCore/Framework/test/test_limited_modules_cfg.py @@ -24,11 +24,9 @@ timeBetweenEvents = cms.untracked.uint64(1000), firstTime = cms.untracked.uint64(1000000), numberEventsInRun = cms.untracked.uint32(nEvtRun), - numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) + numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) ) -#process.Tracer = cms.Service("Tracer") - process.StreamIntProd = cms.EDProducer("edmtest::limited::StreamIntProducer", concurrencyLimit = cms.untracked.uint32(1), transitions = cms.int32(nEvt+nStreams*(2*int(nEvt/nEvtRun)+2*int(nEvt/nEvtLumi)+2)) @@ -59,6 +57,37 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntProd = cms.EDProducer("edmtest::limited::ProcessBlockIntProducer", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + +process.TestBeginProcessBlockProd = cms.EDProducer("edmtest::limited::TestBeginProcessBlockProducer", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockProdRead = cms.EDProducer("edmtest::limited::TestBeginProcessBlockProducer", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin") +) + +process.TestEndProcessBlockProd = cms.EDProducer("edmtest::limited::TestEndProcessBlockProducer", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockProdRead = cms.EDProducer("edmtest::limited::TestEndProcessBlockProducer", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.TestBeginRunProd = cms.EDProducer("edmtest::limited::TestBeginRunProducer", concurrencyLimit = cms.untracked.uint32(1), transitions = cms.int32(int(nEvt/nEvtRun)) @@ -109,6 +138,13 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntAn = cms.EDAnalyzer("edmtest::limited::ProcessBlockIntAnalyzer", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.StreamIntFil = cms.EDFilter("edmtest::limited::StreamIntFilter", concurrencyLimit = cms.untracked.uint32(1), transitions = cms.int32(nEvt+nStreams*(2*int(nEvt/nEvtRun)+2*int(nEvt/nEvtLumi)+2)) @@ -139,6 +175,37 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntFil = cms.EDFilter("edmtest::limited::ProcessBlockIntFilter", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + +process.TestBeginProcessBlockFil = cms.EDFilter("edmtest::limited::TestBeginProcessBlockFilter", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockFilRead = cms.EDFilter("edmtest::limited::TestBeginProcessBlockFilter", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin") +) + +process.TestEndProcessBlockFil = cms.EDFilter("edmtest::limited::TestEndProcessBlockFilter", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockFilRead = cms.EDFilter("edmtest::limited::TestEndProcessBlockFilter", + concurrencyLimit = cms.untracked.uint32(1), + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + process.TestBeginRunFil = cms.EDFilter("edmtest::limited::TestBeginRunFilter", concurrencyLimit = cms.untracked.uint32(1), transitions = cms.int32(int(nEvt/nEvtRun)) @@ -177,4 +244,40 @@ process.task = cms.Task(process.TestAccumulator1) -process.p = cms.Path(process.StreamIntProd+process.RunIntProd+process.LumiIntProd+process.RunSumIntProd+process.LumiSumIntProd+process.TestBeginRunProd+process.TestEndRunProd+process.TestBeginLumiBlockProd+process.TestEndLumiBlockProd+process.StreamIntAn+process.RunIntAn+process.LumiIntAn+process.RunSumIntAn+process.LumiSumIntAn+process.StreamIntFil+process.RunIntFil+process.LumiIntFil+process.RunSumIntFil+process.LumiSumIntFil+process.TestBeginRunFil+process.TestEndRunFil+process.TestBeginLumiBlockFil+process.TestEndLumiBlockFil+process.testFilterModule+process.TestAccumulator2, process.task) +process.p = cms.Path(process.StreamIntProd + + process.RunIntProd + + process.LumiIntProd + + process.RunSumIntProd + + process.LumiSumIntProd + + process.ProcessBlockIntProd + + process.TestBeginProcessBlockProd + + process.TestBeginProcessBlockProdRead + + process.TestEndProcessBlockProd + + process.TestEndProcessBlockProdRead + + process.TestBeginRunProd + + process.TestEndRunProd + + process.TestBeginLumiBlockProd + + process.TestEndLumiBlockProd + + process.StreamIntAn + + process.RunIntAn + + process.LumiIntAn + + process.RunSumIntAn + + process.LumiSumIntAn + + process.ProcessBlockIntAn + + process.StreamIntFil + + process.RunIntFil + + process.LumiIntFil + + process.RunSumIntFil + + process.LumiSumIntFil + + process.ProcessBlockIntFil + + process.TestBeginProcessBlockFil + + process.TestBeginProcessBlockFilRead + + process.TestEndProcessBlockFil + + process.TestEndProcessBlockFilRead + + process.TestBeginRunFil + + process.TestEndRunFil + + process.TestBeginLumiBlockFil + + process.TestEndLumiBlockFil + + process.testFilterModule + + process.TestAccumulator2, + process.task) diff --git a/FWCore/Framework/test/test_non_event_ordering.sh b/FWCore/Framework/test/test_non_event_ordering.sh index b8812bd29f774..bb1be702ac0c7 100755 --- a/FWCore/Framework/test/test_non_event_ordering.sh +++ b/FWCore/Framework/test/test_non_event_ordering.sh @@ -9,3 +9,9 @@ cmsRun $TEST_DIR/test_non_event_ordering_beginLumi_cfg.py || die "begin Lumi tes cmsRun $TEST_DIR/test_non_event_ordering_beginRun_cfg.py || die "begin Run test failed" $? cmsRun $TEST_DIR/test_non_event_ordering_endLumi_cfg.py || die "end Lumi test failed" $? cmsRun $TEST_DIR/test_non_event_ordering_endRun_cfg.py || die "end Run test failed" $? +echo test_non_event_ordering_beginProcessBlock_cfg.py +cmsRun $TEST_DIR/test_non_event_ordering_beginProcessBlock_cfg.py || die "begin ProcessBlock test failed" $? +echo test_non_event_ordering_endProcessBlock_cfg.py +cmsRun $TEST_DIR/test_non_event_ordering_endProcessBlock_cfg.py || die "end Process block test failed" $? +echo test_non_event_ordering_multithreaded_cfg.py +cmsRun $TEST_DIR/test_non_event_ordering_multithreaded_cfg.py || die "multithreaded test failed" $? diff --git a/FWCore/Framework/test/test_non_event_ordering_beginProcessBlock_cfg.py b/FWCore/Framework/test/test_non_event_ordering_beginProcessBlock_cfg.py new file mode 100644 index 0000000000000..a925a6487de51 --- /dev/null +++ b/FWCore/Framework/test/test_non_event_ordering_beginProcessBlock_cfg.py @@ -0,0 +1,18 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") + +process.source = cms.Source("EmptySource") + +process.maxEvents.input = 3 + +process.d = cms.EDProducer("NonEventIntProducer", ivalue = cms.int32(1)) +process.b = cms.EDProducer("NonEventIntProducer", ivalue = cms.int32(2), + consumesBeginProcessBlock = cms.InputTag("c","beginProcessBlock"), + expectBeginProcessBlock = cms.untracked.int32(3) ) +process.c = cms.EDProducer("NonEventIntProducer", ivalue = cms.int32(3), + consumesBeginProcessBlock = cms.InputTag("d", "beginProcessBlock"), + expectBeginProcessBlock = cms.untracked.int32(1)) + +process.t = cms.Task(process.d, process.c) +process.p = cms.Path(process.b, process.t) diff --git a/FWCore/Framework/test/test_non_event_ordering_endProcessBlock_cfg.py b/FWCore/Framework/test/test_non_event_ordering_endProcessBlock_cfg.py new file mode 100644 index 0000000000000..1d628c3e961fc --- /dev/null +++ b/FWCore/Framework/test/test_non_event_ordering_endProcessBlock_cfg.py @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") + +process.source = cms.Source("EmptySource") + +process.maxEvents.input = 3 + +process.d = cms.EDProducer("NonEventIntProducer", + ivalue = cms.int32(1)) +process.b = cms.EDProducer("NonEventIntProducer", + ivalue = cms.int32(2), + consumesEndProcessBlock = cms.InputTag("c","endProcessBlock"), + expectEndProcessBlock = cms.untracked.int32(3) ) +process.c = cms.EDProducer("NonEventIntProducer", + ivalue = cms.int32(3), + consumesEndProcessBlock = cms.InputTag("d", "endProcessBlock"), + expectEndProcessBlock = cms.untracked.int32(1) ) + +process.t = cms.Task(process.d, process.c) +process.p = cms.Path(process.b, process.t) diff --git a/FWCore/Framework/test/test_non_event_ordering_multithreaded_cfg.py b/FWCore/Framework/test/test_non_event_ordering_multithreaded_cfg.py new file mode 100644 index 0000000000000..1f9cd7079c1f3 --- /dev/null +++ b/FWCore/Framework/test/test_non_event_ordering_multithreaded_cfg.py @@ -0,0 +1,52 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") + +process.options = cms.untracked.PSet( + numberOfStreams = cms.untracked.uint32(3), + numberOfThreads = cms.untracked.uint32(3) +) + +process.source = cms.Source("EmptySource") + +process.maxEvents.input = 3 + +process.d = cms.EDProducer("NonEventIntProducer", + ivalue = cms.int32(1)) + +process.b = cms.EDProducer("NonEventIntProducer", + ivalue = cms.int32(2), + sleepTime = cms.uint32(3000), + consumesBeginProcessBlock = cms.InputTag("c","beginProcessBlock"), + expectBeginProcessBlock = cms.untracked.int32(3), + consumesBeginRun = cms.InputTag("c","beginRun"), + expectBeginRun = cms.untracked.int32(3), + consumesBeginLuminosityBlock = cms.InputTag("c","beginLumi"), + expectBeginLuminosityBlock = cms.untracked.int32(3), + consumesEndLuminosityBlock = cms.InputTag("c","endLumi"), + expectEndLuminosityBlock = cms.untracked.int32(3), + consumesEndRun = cms.InputTag("c","endRun"), + expectEndRun = cms.untracked.int32(3), + consumesEndProcessBlock = cms.InputTag("c","endProcessBlock"), + expectEndProcessBlock = cms.untracked.int32(3) +) + +process.c = cms.EDProducer("NonEventIntProducer", + ivalue = cms.int32(3), + sleepTime = cms.uint32(3000), + consumesBeginProcessBlock = cms.InputTag("d","beginProcessBlock"), + expectBeginProcessBlock = cms.untracked.int32(1), + consumesBeginRun = cms.InputTag("d","beginRun"), + expectBeginRun = cms.untracked.int32(1), + consumesBeginLuminosityBlock = cms.InputTag("d","beginLumi"), + expectBeginLuminosityBlock = cms.untracked.int32(1), + consumesEndLuminosityBlock = cms.InputTag("d","endLumi"), + expectEndLuminosityBlock = cms.untracked.int32(1), + consumesEndRun = cms.InputTag("d","endRun"), + expectEndRun = cms.untracked.int32(1), + consumesEndProcessBlock = cms.InputTag("d", "endProcessBlock"), + expectEndProcessBlock = cms.untracked.int32(1) +) + +process.t = cms.Task(process.d, process.c) +process.p = cms.Path(process.b, process.t) diff --git a/FWCore/Framework/test/test_one_modules_cfg.py b/FWCore/Framework/test/test_one_modules_cfg.py index 077db7c6c364e..6ea86ce9f9ef3 100644 --- a/FWCore/Framework/test/test_one_modules_cfg.py +++ b/FWCore/Framework/test/test_one_modules_cfg.py @@ -23,7 +23,7 @@ timeBetweenEvents = cms.untracked.uint64(10), firstTime = cms.untracked.uint64(1000000), numberEventsInRun = cms.untracked.uint32(nEvtRun), - numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) + numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) ) #process.Tracer = cms.Service("Tracer") @@ -48,6 +48,32 @@ transitions = cms.int32(nEvt+2*int(nEvt/nEvtLumi)) ) +process.ProcessBlockIntProd = cms.EDProducer("edmtest::one::ProcessBlockIntProducer", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + +process.TestBeginProcessBlockProd = cms.EDProducer("edmtest::one::TestBeginProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockProdRead = cms.EDProducer("edmtest::one::TestBeginProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin") +) + +process.TestEndProcessBlockProd = cms.EDProducer("edmtest::one::TestEndProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockProdRead = cms.EDProducer("edmtest::one::TestEndProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.BeginRunProd = cms.EDProducer("edmtest::one::TestBeginRunProducer", transitions = cms.int32(nEvt+int(nEvt/nEvtRun)) ) @@ -85,6 +111,12 @@ transitions = cms.int32(nEvt+2*int(nEvt/nEvtLumi)) ) +process.ProcessBlockIntAn = cms.EDAnalyzer("edmtest::one::ProcessBlockIntAnalyzer", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.SharedResFil = cms.EDFilter("edmtest::one::SharedResourcesFilter", transitions = cms.int32(nEvt) ) @@ -104,6 +136,32 @@ transitions = cms.int32(nEvt+2*int(nEvt/nEvtLumi)) ) +process.ProcessBlockIntFil = cms.EDFilter("edmtest::one::ProcessBlockIntFilter", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + +process.TestBeginProcessBlockFil = cms.EDFilter("edmtest::one::TestBeginProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockFilRead = cms.EDFilter("edmtest::one::TestBeginProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin") +) + +process.TestEndProcessBlockFil = cms.EDFilter("edmtest::one::TestEndProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockFilRead = cms.EDFilter("edmtest::one::TestEndProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + process.BeginRunFil = cms.EDFilter("edmtest::one::BeginRunFilter", transitions = cms.int32(nEvt+int(nEvt/nEvtRun)) ) @@ -136,6 +194,40 @@ process.task = cms.Task(process.TestAccumulator1) -process.p = cms.Path(process.SharedResProd+process.WatchRunProd+process.WatchLumiBlockProd+process.RunCacheProd+process.LumiBlockCacheProd+process.BeginRunProd+process.BeginLumiBlockProd+process.EndRunProd+process.EndLumiBlockProd+process.SharedResAn+process.WatchRunAn+process.WatchLumiBlockAn+process.RunCacheAn+process.LumiBlockCacheAn+process.SharedResFil+process.WatchRunFil+process.WatchLumiBlockFil+process.RunCacheFil+process.LumiBlockCacheFil+process.BeginRunFil+process.BeginLumiBlockFil+process.EndRunFil+process.EndLumiBlockFil+process.testFilterModule+process.TestAccumulator2, process.task) - - +process.p = cms.Path(process.SharedResProd + + process.WatchRunProd + + process.WatchLumiBlockProd + + process.RunCacheProd + + process.LumiBlockCacheProd + + process.ProcessBlockIntProd + + process.TestBeginProcessBlockProd + + process.TestBeginProcessBlockProdRead + + process.TestEndProcessBlockProd + + process.TestEndProcessBlockProdRead + + process.BeginRunProd + + process.BeginLumiBlockProd + + process.EndRunProd + + process.EndLumiBlockProd + + process.SharedResAn + + process.WatchRunAn + + process.WatchLumiBlockAn + + process.RunCacheAn + + process.LumiBlockCacheAn + + process.ProcessBlockIntAn + + process.SharedResFil + + process.WatchRunFil + + process.WatchLumiBlockFil + + process.RunCacheFil + + process.LumiBlockCacheFil + + process.ProcessBlockIntFil + + process.TestBeginProcessBlockFil + + process.TestBeginProcessBlockFilRead + + process.TestEndProcessBlockFil + + process.TestEndProcessBlockFilRead + + process.BeginRunFil + + process.BeginLumiBlockFil + + process.EndRunFil + + process.EndLumiBlockFil + + process.testFilterModule + + process.TestAccumulator2, + process.task) diff --git a/FWCore/Framework/test/test_stream_modules_cfg.py b/FWCore/Framework/test/test_stream_modules_cfg.py index 5d24d8de94827..4654cb7e7ab5c 100644 --- a/FWCore/Framework/test/test_stream_modules_cfg.py +++ b/FWCore/Framework/test/test_stream_modules_cfg.py @@ -22,7 +22,7 @@ timeBetweenEvents = cms.untracked.uint64(1000), firstTime = cms.untracked.uint64(1000000), numberEventsInRun = cms.untracked.uint32(nEvtRun), - numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) + numberEventsInLuminosityBlock = cms.untracked.uint32(nEvtLumi) ) #process.Tracer = cms.Service("Tracer") @@ -53,6 +53,32 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntProd = cms.EDProducer("edmtest::stream::ProcessBlockIntProducer", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + +process.TestBeginProcessBlockProd = cms.EDProducer("edmtest::stream::TestBeginProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockProdRead = cms.EDProducer("edmtest::stream::TestBeginProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin") +) + +process.TestEndProcessBlockProd = cms.EDProducer("edmtest::stream::TestEndProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockProdRead = cms.EDProducer("edmtest::stream::TestEndProcessBlockProducer", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.TestBeginRunProd = cms.EDProducer("edmtest::stream::TestBeginRunProducer", transitions = cms.int32(int(nEvt/nEvtRun)) ,cachevalue = cms.int32(nEvt) @@ -99,6 +125,12 @@ ,cachevalue = cms.int32(nEvtLumi) ) +process.ProcessBlockIntAn = cms.EDAnalyzer("edmtest::stream::ProcessBlockIntAnalyzer", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") +) + process.GlobIntFil = cms.EDFilter("edmtest::stream::GlobalIntFilter", transitions = cms.int32(nEvt+3) ,cachevalue = cms.int32(nEvt) @@ -123,6 +155,33 @@ transitions = cms.int32(nEvt+4*int(nEvt/nEvtLumi)) ,cachevalue = cms.int32(nEvtLumi) ) + +process.ProcessBlockIntFil = cms.EDFilter("edmtest::stream::ProcessBlockIntFilter", + transitions = cms.int32(int(nEvt + 2)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil" ,"begin"), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + +process.TestBeginProcessBlockFil = cms.EDFilter("edmtest::stream::TestBeginProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("") +) + +process.TestBeginProcessBlockFilRead = cms.EDFilter("edmtest::stream::TestBeginProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockFil", "begin") +) + +process.TestEndProcessBlockFil = cms.EDFilter("edmtest::stream::TestEndProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("") +) + +process.TestEndProcessBlockFilRead = cms.EDFilter("edmtest::stream::TestEndProcessBlockFilter", + transitions = cms.int32(int(nEvt + 1)), + consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockFil", "end") +) + process.TestBeginRunFil = cms.EDFilter("edmtest::stream::TestBeginRunFilter", transitions = cms.int32(nEvt+3*int(nEvt/nEvtRun)) ,cachevalue = cms.int32(nEvt) @@ -158,5 +217,40 @@ process.task = cms.Task(process.TestAccumulator1) -process.p = cms.Path(process.GlobIntProd+process.RunIntProd+process.LumiIntProd+process.RunSumIntProd+process.LumiSumIntProd+process.TestBeginRunProd+process.TestEndRunProd+process.TestBeginLumiBlockProd+process.TestEndLumiBlockProd+process.GlobIntAn+process.RunIntAn+process.LumiIntAn+process.RunSumIntAn+process.LumiSumIntAn+process.GlobIntFil+process.RunIntFil+process.LumiIntFil+process.RunSumIntFil+process.LumiSumIntFil+process.TestBeginRunFil+process.TestEndRunFil+process.TestBeginLumiBlockFil+process.TestEndLumiBlockFil+process.testFilterModule+process.TestAccumulator2, process.task) - +process.p = cms.Path(process.GlobIntProd + + process.RunIntProd + + process.LumiIntProd + + process.RunSumIntProd + + process.LumiSumIntProd + + process.ProcessBlockIntProd + + process.TestBeginProcessBlockProdRead + + process.TestBeginProcessBlockProd + + process.TestEndProcessBlockProdRead + + process.TestEndProcessBlockProd + + process.TestBeginRunProd + + process.TestEndRunProd + + process.TestBeginLumiBlockProd + + process.TestEndLumiBlockProd + + process.GlobIntAn + + process.RunIntAn + + process.LumiIntAn + + process.RunSumIntAn + + process.LumiSumIntAn + + process.ProcessBlockIntAn + + process.GlobIntFil + + process.RunIntFil + + process.LumiIntFil + + process.RunSumIntFil + + process.LumiSumIntFil + + process.ProcessBlockIntFil + + process.TestBeginProcessBlockFil + + process.TestBeginProcessBlockFilRead + + process.TestEndProcessBlockFil + + process.TestEndProcessBlockFilRead + + process.TestBeginRunFil + + process.TestEndRunFil + + process.TestBeginLumiBlockFil + + process.TestEndLumiBlockFil + + process.testFilterModule + + process.TestAccumulator2, + process.task) diff --git a/FWCore/Framework/test/unit_test_outputs/test_deepCall_unscheduled.log b/FWCore/Framework/test/unit_test_outputs/test_deepCall_unscheduled.log index 102c07cf1d76c..23d8a6c730287 100644 --- a/FWCore/Framework/test/unit_test_outputs/test_deepCall_unscheduled.log +++ b/FWCore/Framework/test/unit_test_outputs/test_deepCall_unscheduled.log @@ -71,6 +71,8 @@ ModuleCallingContext state = Running ++++ finished: begin stream for module: stream = 0 label = 'result2' id = 6 ++++ starting: begin stream for module: stream = 0 label = 'result4' id = 7 ++++ finished: begin stream for module: stream = 0 label = 'result4' id = 7 +++++ starting: begin process block +++++ finished: begin process block ++++ starting: source run ++++ finished: source run ++++ starting: global begin run 1 : time = 1000000 @@ -547,6 +549,10 @@ ModuleCallingContext state = Running ++++ finished: global end run 1 : time = 1000030 ++++ starting: global write run 1 : time = 1000030 ++++ finished: global write run 1 : time = 1000030 +++++ starting: end process block +++++ finished: end process block +++++ starting: write process block +++++ finished: write process block ++++ starting: end stream for module: stream = 0 label = 'get' id = 3 ++++ finished: end stream for module: stream = 0 label = 'get' id = 3 ++++ starting: end stream for module: stream = 0 label = 'TriggerResults' id = 1 diff --git a/FWCore/Framework/test/unit_test_outputs/test_onPath_unscheduled.log b/FWCore/Framework/test/unit_test_outputs/test_onPath_unscheduled.log index b1622b6a2552c..5f97105ab152f 100644 --- a/FWCore/Framework/test/unit_test_outputs/test_onPath_unscheduled.log +++ b/FWCore/Framework/test/unit_test_outputs/test_onPath_unscheduled.log @@ -39,6 +39,8 @@ ++++ finished: begin stream for module: stream = 0 label = 'TriggerResults' id = 1 ++++ starting: begin stream for module: stream = 0 label = 'p' id = 2 ++++ finished: begin stream for module: stream = 0 label = 'p' id = 2 +++++ starting: begin process block +++++ finished: begin process block ++++ starting: source run ++++ finished: source run ++++ starting: global begin run 1 : time = 1000000 @@ -179,6 +181,10 @@ ++++ finished: global end run 1 : time = 1000030 ++++ starting: global write run 1 : time = 1000030 ++++ finished: global write run 1 : time = 1000030 +++++ starting: end process block +++++ finished: end process block +++++ starting: write process block +++++ finished: write process block ++++ starting: end stream for module: stream = 0 label = 'one' id = 3 ++++ finished: end stream for module: stream = 0 label = 'one' id = 3 ++++ starting: end stream for module: stream = 0 label = 'getOne' id = 4 diff --git a/FWCore/Integration/test/TestFindProduct.cc b/FWCore/Integration/test/TestFindProduct.cc index cc2d5f19d4b63..8617467049ca4 100644 --- a/FWCore/Integration/test/TestFindProduct.cc +++ b/FWCore/Integration/test/TestFindProduct.cc @@ -19,6 +19,7 @@ #include "FWCore/Framework/interface/getProducerParameterSet.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ProcessBlock.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/BranchType.h" @@ -29,7 +30,12 @@ #include namespace edmtest { - class TestFindProduct : public edm::one::EDAnalyzer { + + struct DummyTestFindProduct {}; + + class TestFindProduct : public edm::one::EDAnalyzer> { public: explicit TestFindProduct(edm::ParameterSet const& pset); virtual ~TestFindProduct(); @@ -39,6 +45,8 @@ namespace edmtest { void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; void beginRun(edm::Run const&, edm::EventSetup const&) override; void endRun(edm::Run const&, edm::EventSetup const&) override; + void beginProcessBlock(edm::ProcessBlock const&) override; + void endProcessBlock(edm::ProcessBlock const&) override; void endJob() override; private: @@ -52,6 +60,11 @@ namespace edmtest { std::vector inputTagsUInt64_; std::vector inputTagsEndLumi_; std::vector inputTagsEndRun_; + std::vector inputTagsBeginProcessBlock_; + std::vector inputTagsEndProcessBlock_; + std::vector inputTagsEndProcessBlock2_; + std::vector inputTagsEndProcessBlock3_; + std::vector inputTagsEndProcessBlock4_; std::vector> tokens_; std::vector> tokensNotFound_; @@ -59,6 +72,11 @@ namespace edmtest { std::vector> tokensUInt64_; std::vector> tokensEndLumi_; std::vector> tokensEndRun_; + std::vector> tokensBeginProcessBlock_; + std::vector> tokensEndProcessBlock_; + std::vector tokensEndProcessBlock2_; + std::vector> tokensEndProcessBlock3_; + std::vector> tokensEndProcessBlock4_; }; // class TestFindProduct //-------------------------------------------------------------------- @@ -79,6 +97,16 @@ namespace edmtest { inputTagsUInt64_ = pset.getUntrackedParameter>("inputTagsUInt64", emptyTagVector); inputTagsEndLumi_ = pset.getUntrackedParameter>("inputTagsEndLumi", emptyTagVector); inputTagsEndRun_ = pset.getUntrackedParameter>("inputTagsEndRun", emptyTagVector); + inputTagsBeginProcessBlock_ = + pset.getUntrackedParameter>("inputTagsBeginProcessBlock", emptyTagVector); + inputTagsEndProcessBlock_ = + pset.getUntrackedParameter>("inputTagsEndProcessBlock", emptyTagVector); + inputTagsEndProcessBlock2_ = + pset.getUntrackedParameter>("inputTagsEndProcessBlock2", emptyTagVector); + inputTagsEndProcessBlock3_ = + pset.getUntrackedParameter>("inputTagsEndProcessBlock3", emptyTagVector); + inputTagsEndProcessBlock4_ = + pset.getUntrackedParameter>("inputTagsEndProcessBlock4", emptyTagVector); for (auto const& tag : inputTags_) { tokens_.push_back(consumes(tag)); @@ -98,6 +126,21 @@ namespace edmtest { for (auto const& tag : inputTagsEndRun_) { tokensEndRun_.push_back(consumes(tag)); } + for (auto const& tag : inputTagsBeginProcessBlock_) { + tokensBeginProcessBlock_.push_back(consumes(tag)); + } + for (auto const& tag : inputTagsEndProcessBlock_) { + tokensEndProcessBlock_.push_back(consumes(tag)); + } + for (auto const& tag : inputTagsEndProcessBlock2_) { + tokensEndProcessBlock2_.push_back(consumes(tag)); + } + for (auto const& tag : inputTagsEndProcessBlock3_) { + tokensEndProcessBlock3_.push_back(consumes(tag)); + } + for (auto const& tag : inputTagsEndProcessBlock4_) { + tokensEndProcessBlock4_.push_back(consumes(tag)); + } } TestFindProduct::~TestFindProduct() {} @@ -211,6 +254,44 @@ namespace edmtest { } } + void TestFindProduct::beginProcessBlock(edm::ProcessBlock const& processBlock) { + for (auto const& token : tokensBeginProcessBlock_) { + sum_ += processBlock.get(token).value; + } + } + + void TestFindProduct::endProcessBlock(edm::ProcessBlock const& processBlock) { + std::vector values; + for (auto const& token : tokensEndProcessBlock_) { + int value = processBlock.get(token).value; + values.push_back(value); + sum_ += value; + } + edm::Handle h; + unsigned int i = 0; + for (auto val : values) { + if (i < tokensEndProcessBlock2_.size()) { + processBlock.getByToken(tokensEndProcessBlock2_[i], h); + if (h->value != val + 2) { + throw cms::Exception("TestFail") << "TestFindProduct::endProcessBlock 2, received unexpected value"; + } + } + if (i < tokensEndProcessBlock3_.size()) { + processBlock.getByToken(tokensEndProcessBlock3_[i], h); + if (h->value != val + 3) { + throw cms::Exception("TestFail") << "TestFindProduct::endProcessBlock 3, received unexpected value"; + } + } + if (i < tokensEndProcessBlock4_.size()) { + h = processBlock.getHandle(tokensEndProcessBlock4_[i]); + if (h->value != val + 4) { + throw cms::Exception("TestFail") << "TestFindProduct::endProcessBlock 4, received unexpected value"; + } + } + ++i; + } + } + void TestFindProduct::endJob() { std::cout << "TestFindProduct sum = " << sum_ << std::endl; if (expectedSum_ != 0 && sum_ != expectedSum_) { diff --git a/FWCore/Integration/test/testConsumesInfo_cfg.py b/FWCore/Integration/test/testConsumesInfo_cfg.py index 74c094e16d563..53b2a666f5482 100644 --- a/FWCore/Integration/test/testConsumesInfo_cfg.py +++ b/FWCore/Integration/test/testConsumesInfo_cfg.py @@ -125,10 +125,32 @@ process.intProducerH = cms.EDProducer("IntProducer", ivalue = cms.int32(1006)) process.intProducerI = cms.EDProducer("IntProducer", ivalue = cms.int32(1007)) +process.intProducerBeginProcessBlock = cms.EDProducer("IntProducerBeginProcessBlock", ivalue = cms.int32(10000)) + +process.intProducerEndProcessBlock = cms.EDProducer("IntProducerEndProcessBlock", ivalue = cms.int32(100000)) + +process.processBlockTest1 = cms.EDAnalyzer("TestFindProduct", + inputTags = cms.untracked.VInputTag(), + expectedSum = cms.untracked.int32(220000), + inputTagsBeginProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerBeginProcessBlock"), + cms.InputTag("intProducerBeginProcessBlock", "", "PROD1") + ), + inputTagsEndProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock"), + cms.InputTag("intProducerEndProcessBlock", "", "PROD1"), + ) +) + process.p = cms.Path(process.intProducer * process.a1 * process.a2 * process.a3 * process.a4 * process.test * process.testView1 * - process.testStreamingProducer * process.testStreamingAnalyzer) + process.testStreamingProducer * process.testStreamingAnalyzer * + process.intProducerBeginProcessBlock * + process.intProducerEndProcessBlock * + process.processBlockTest1 +) + process.p2 = cms.Path(process.intProducer * process.a1 * process.a2 * process.a3) process.p3 = cms.Path( @@ -418,3 +440,32 @@ copyProcess.a24 * copyProcess.a25 ) + +copyProcess.intProducerBeginProcessBlock = cms.EDProducer("IntProducerBeginProcessBlock", ivalue = cms.int32(10001)) + +copyProcess.intProducerEndProcessBlock = cms.EDProducer("IntProducerEndProcessBlock", ivalue = cms.int32(100010)) + +copyProcess.processBlockTest1 = cms.EDAnalyzer("TestFindProduct", + inputTags = cms.untracked.VInputTag(), + expectedSum = cms.untracked.int32(460034), + inputTagsBeginProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerBeginProcessBlock"), + cms.InputTag("intProducerBeginProcessBlock", "", "PROD1"), + cms.InputTag("intProducerBeginProcessBlock", "", "COPY") + ), + inputTagsEndProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerBeginProcessBlock"), + cms.InputTag("intProducerBeginProcessBlock", "", "PROD1"), + cms.InputTag("intProducerBeginProcessBlock", "", "COPY"), + cms.InputTag("intProducerEndProcessBlock"), + cms.InputTag("intProducerEndProcessBlock", "", "PROD1"), + cms.InputTag("intProducerEndProcessBlock", "", "COPY"), + cms.InputTag("intProducerEndProcessBlock", "", cms.InputTag.currentProcess()) + ) +) + +copyProcess.path3 = cms.Path( + copyProcess.intProducerBeginProcessBlock * + copyProcess.intProducerEndProcessBlock * + copyProcess.processBlockTest1 +) diff --git a/FWCore/Integration/test/testGetBy1_cfg.py b/FWCore/Integration/test/testGetBy1_cfg.py index 1517d288d2f4f..e892ada21e002 100644 --- a/FWCore/Integration/test/testGetBy1_cfg.py +++ b/FWCore/Integration/test/testGetBy1_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("PROD1") process.Tracer = cms.Service('Tracer', - dumpContextForLabels = cms.untracked.vstring('intProducerA'), + dumpContextForLabels = cms.untracked.vstring('intProducerA', 'a1'), dumpNonModuleContext = cms.untracked.bool(True) ) @@ -45,11 +45,26 @@ process.a1 = cms.EDAnalyzer("TestFindProduct", inputTags = cms.untracked.VInputTag( cms.InputTag("source") ), - expectedSum = cms.untracked.int32(12), + expectedSum = cms.untracked.int32(110012), inputTagsNotFound = cms.untracked.VInputTag( cms.InputTag("source", processName=cms.InputTag.skipCurrentProcess()), cms.InputTag("intProducer", processName=cms.InputTag.skipCurrentProcess()), cms.InputTag("intProducerU", processName=cms.InputTag.skipCurrentProcess()) + ), + inputTagsBeginProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerBeginProcessBlock"), + ), + inputTagsEndProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock"), + ), + inputTagsEndProcessBlock2 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "two"), + ), + inputTagsEndProcessBlock3 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "three"), + ), + inputTagsEndProcessBlock4 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "four"), ) ) @@ -83,7 +98,17 @@ process.intProducerB = cms.EDProducer("IntProducer", ivalue = cms.int32(1000)) -process.t = cms.Task(process.intProducerU, process.intProducerA, process.intProducerB, process.intVectorProducer) +process.intProducerBeginProcessBlock = cms.EDProducer("IntProducerBeginProcessBlock", ivalue = cms.int32(10000)) + +process.intProducerEndProcessBlock = cms.EDProducer("IntProducerEndProcessBlock", ivalue = cms.int32(100000)) + +process.t = cms.Task(process.intProducerU, + process.intProducerA, + process.intProducerB, + process.intVectorProducer, + process.intProducerBeginProcessBlock, + process.intProducerEndProcessBlock +) process.p = cms.Path(process.intProducer * process.a1 * process.a2 * process.a3, process.t) diff --git a/FWCore/Integration/test/testProcessBlock_cfg.py b/FWCore/Integration/test/testProcessBlock_cfg.py new file mode 100644 index 0000000000000..9080d38492849 --- /dev/null +++ b/FWCore/Integration/test/testProcessBlock_cfg.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.thingProducer = cms.EDProducer("ThingProducer") + +process.path = cms.Path(process.thingProducer) + diff --git a/FWCore/Integration/test/unit_test_outputs/testConsumesInfo_1.log b/FWCore/Integration/test/unit_test_outputs/testConsumesInfo_1.log index 9bcad0a320b37..0f4d964805dcc 100644 --- a/FWCore/Integration/test/unit_test_outputs/testConsumesInfo_1.log +++ b/FWCore/Integration/test/unit_test_outputs/testConsumesInfo_1.log @@ -17,6 +17,9 @@ modules on path p: testView1 testStreamingProducer testStreamingAnalyzer + intProducerBeginProcessBlock + intProducerEndProcessBlock + processBlockTest1 modules on path p2: intProducer a1 @@ -55,6 +58,9 @@ All modules and modules in the current process whose products they consume: IntProducer/'testStreamingProducer' ConsumingStreamAnalyzer/'testStreamingAnalyzer' consumes products from these modules: IntProducer/'testStreamingProducer' + IntProducerBeginProcessBlock/'intProducerBeginProcessBlock' + IntProducerEndProcessBlock/'intProducerEndProcessBlock' + TestFindProduct/'processBlockTest1' IntProducer/'intProducerB' IntProducer/'intProducerC' IntProducer/'intProducerD' @@ -78,7 +84,7 @@ All modules and modules in the current process whose products they consume: EndPathStatusInserter/'p1ep2' All modules (listed by class and label) and all their consumed products. Consumed products are listed by type, label, instance, process. -For products not in the event, 'run' or 'lumi' is added to indicate the TTree they are from. +For products not in the event, 'processBlock', 'run' or 'lumi' is added to indicate the TTree they are from. For products that are declared with mayConsume, 'may consume' is added. For products consumed for Views, 'element type' is added For products only read from previous processes, 'skip current process' is added @@ -107,6 +113,13 @@ For products only read from previous processes, 'skip current process' is added IntProducer/'testStreamingProducer' ConsumingStreamAnalyzer/'testStreamingAnalyzer' consumes: edmtest::IntProduct 'testStreamingProducer' '' '', may consume + IntProducerBeginProcessBlock/'intProducerBeginProcessBlock' + IntProducerEndProcessBlock/'intProducerEndProcessBlock' + TestFindProduct/'processBlockTest1' consumes: + edmtest::IntProduct 'intProducerBeginProcessBlock' '' '', processBlock + edmtest::IntProduct 'intProducerBeginProcessBlock' '' 'PROD1', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' '', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' 'PROD1', processBlock IntProducer/'intProducerB' IntProducer/'intProducerC' IntProducer/'intProducerD' @@ -118,6 +131,11 @@ For products only read from previous processes, 'skip current process' is added edm::TriggerResults 'TriggerResults' '' 'PROD1' edmtest::IntProduct 'aliasForInt' '' 'PROD1' edmtest::IntProduct 'intProducer' '' 'PROD1' + edmtest::IntProduct 'intProducerBeginProcessBlock' '' 'PROD1', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' 'PROD1', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' 'four' 'PROD1', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' 'three' 'PROD1', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' 'two' 'PROD1', processBlock edmtest::IntProduct 'intProducerU' '' 'PROD1' edmtest::IntProduct 'source' '' 'PROD1' edmtest::IntProduct 'testManyConsumingProducer' '' 'PROD1' @@ -148,7 +166,7 @@ All modules and modules in the current process whose products they consume: PathStatusInserter/'path1' All modules (listed by class and label) and all their consumed products. Consumed products are listed by type, label, instance, process. -For products not in the event, 'run' or 'lumi' is added to indicate the TTree they are from. +For products not in the event, 'processBlock', 'run' or 'lumi' is added to indicate the TTree they are from. For products that are declared with mayConsume, 'may consume' is added. For products consumed for Views, 'element type' is added For products only read from previous processes, 'skip current process' is added @@ -164,6 +182,7 @@ paths: p3 path1 path2 + path3 end paths: ep1 ep2 @@ -206,6 +225,10 @@ modules on path path2: a23 a24 a25 +modules on path path3: + intProducerBeginProcessBlock + intProducerEndProcessBlock + processBlockTest1 modules on end path ep1: intVectorProducer testManyConsumingProducer @@ -265,17 +288,21 @@ All modules and modules in the current process whose products they consume: IntProducer/'intProducerC' IntProducer/'intProducerF' IntProducer/'intProducerG' + IntProducerBeginProcessBlock/'intProducerBeginProcessBlock' + IntProducerEndProcessBlock/'intProducerEndProcessBlock' + TestFindProduct/'processBlockTest1' ConsumingIntProducer/'testManyConsumingProducer' consumes products from these modules: TriggerResultInserter/'TriggerResults' TriggerResultInserter/'TriggerResults' PathStatusInserter/'p3' PathStatusInserter/'path1' PathStatusInserter/'path2' + PathStatusInserter/'path3' EndPathStatusInserter/'ep1' EndPathStatusInserter/'ep2' All modules (listed by class and label) and all their consumed products. Consumed products are listed by type, label, instance, process. -For products not in the event, 'run' or 'lumi' is added to indicate the TTree they are from. +For products not in the event, 'processBlock', 'run' or 'lumi' is added to indicate the TTree they are from. For products that are declared with mayConsume, 'may consume' is added. For products consumed for Views, 'element type' is added For products only read from previous processes, 'skip current process' is added @@ -379,6 +406,19 @@ For products only read from previous processes, 'skip current process' is added edmtest::IntProduct 'intProducerE' '' 'COPY' edmtest::IntProduct 'intProducerH' '' 'COPY' edmtest::IntProduct 'intProducerQ' 'INSTANCE' 'DOESNOTEXIST' + IntProducerBeginProcessBlock/'intProducerBeginProcessBlock' + IntProducerEndProcessBlock/'intProducerEndProcessBlock' + TestFindProduct/'processBlockTest1' consumes: + edmtest::IntProduct 'intProducerBeginProcessBlock' '' '', processBlock + edmtest::IntProduct 'intProducerBeginProcessBlock' '' 'PROD1', processBlock + edmtest::IntProduct 'intProducerBeginProcessBlock' '' 'COPY', processBlock + edmtest::IntProduct 'intProducerBeginProcessBlock' '' '', processBlock + edmtest::IntProduct 'intProducerBeginProcessBlock' '' 'PROD1', processBlock + edmtest::IntProduct 'intProducerBeginProcessBlock' '' 'COPY', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' '', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' 'PROD1', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' 'COPY', processBlock + edmtest::IntProduct 'intProducerEndProcessBlock' '' 'COPY', processBlock ConsumingIntProducer/'testManyConsumingProducer' consumes: edm::TriggerResults 'TriggerResults' '' '' edm::TriggerResults '' '' '' @@ -386,6 +426,7 @@ For products only read from previous processes, 'skip current process' is added PathStatusInserter/'p3' PathStatusInserter/'path1' PathStatusInserter/'path2' + PathStatusInserter/'path3' EndPathStatusInserter/'ep1' EndPathStatusInserter/'ep2' @@ -394,6 +435,7 @@ TestFindProduct sum = 300 TestFindProduct sum = 300 TestFindProduct sum = 300 TestFindProduct sum = 33 +TestFindProduct sum = 220000 TestFindProduct sum = 33 TestFindProduct sum = 36 TestFindProduct sum = 36 @@ -422,3 +464,4 @@ TestFindProduct sum = 9015 TestFindProduct sum = 0 TestFindProduct sum = 0 TestFindProduct sum = 45057 +TestFindProduct sum = 460034 diff --git a/FWCore/Integration/test/unit_test_outputs/testGetBy1.log b/FWCore/Integration/test/unit_test_outputs/testGetBy1.log index af282c8a27a4c..8b9a25715628d 100644 --- a/FWCore/Integration/test/unit_test_outputs/testGetBy1.log +++ b/FWCore/Integration/test/unit_test_outputs/testGetBy1.log @@ -11,7 +11,9 @@ Module type=IntSource, Module label=source, Parameter Set ID=031810a3ee2992e7936 ++++ starting: constructing module with label 'intProducer' id = 4 ++++ finished: constructing module with label 'intProducer' id = 4 ++++ starting: constructing module with label 'a1' id = 5 +Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc ++++ finished: constructing module with label 'a1' id = 5 +Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc ++++ starting: constructing module with label 'a2' id = 6 ++++ finished: constructing module with label 'a2' id = 6 ++++ starting: constructing module with label 'a3' id = 7 @@ -24,10 +26,14 @@ Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e81 Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ++++ starting: constructing module with label 'intProducerB' id = 10 ++++ finished: constructing module with label 'intProducerB' id = 10 -++++ starting: constructing module with label 'intProducerU' id = 11 -++++ finished: constructing module with label 'intProducerU' id = 11 -++++ starting: constructing module with label 'intVectorProducer' id = 12 -++++ finished: constructing module with label 'intVectorProducer' id = 12 +++++ starting: constructing module with label 'intProducerBeginProcessBlock' id = 11 +++++ finished: constructing module with label 'intProducerBeginProcessBlock' id = 11 +++++ starting: constructing module with label 'intProducerEndProcessBlock' id = 12 +++++ finished: constructing module with label 'intProducerEndProcessBlock' id = 12 +++++ starting: constructing module with label 'intProducerU' id = 13 +++++ finished: constructing module with label 'intProducerU' id = 13 +++++ starting: constructing module with label 'intVectorProducer' id = 14 +++++ finished: constructing module with label 'intVectorProducer' id = 14 ++ preallocate: 1 concurrent runs, 1 concurrent luminosity sections, 1 streams ++ starting: begin job ++++ starting: begin job for module with label 'intProducerA' id = 9 @@ -36,14 +42,20 @@ Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e81 Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ++++ starting: begin job for module with label 'intProducerB' id = 10 ++++ finished: begin job for module with label 'intProducerB' id = 10 -++++ starting: begin job for module with label 'intProducerU' id = 11 -++++ finished: begin job for module with label 'intProducerU' id = 11 -++++ starting: begin job for module with label 'intVectorProducer' id = 12 -++++ finished: begin job for module with label 'intVectorProducer' id = 12 +++++ starting: begin job for module with label 'intProducerBeginProcessBlock' id = 11 +++++ finished: begin job for module with label 'intProducerBeginProcessBlock' id = 11 +++++ starting: begin job for module with label 'intProducerEndProcessBlock' id = 12 +++++ finished: begin job for module with label 'intProducerEndProcessBlock' id = 12 +++++ starting: begin job for module with label 'intProducerU' id = 13 +++++ finished: begin job for module with label 'intProducerU' id = 13 +++++ starting: begin job for module with label 'intVectorProducer' id = 14 +++++ finished: begin job for module with label 'intVectorProducer' id = 14 ++++ starting: begin job for module with label 'intProducer' id = 4 ++++ finished: begin job for module with label 'intProducer' id = 4 ++++ starting: begin job for module with label 'a1' id = 5 +Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc ++++ finished: begin job for module with label 'a1' id = 5 +Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc ++++ starting: begin job for module with label 'a2' id = 6 ++++ finished: begin job for module with label 'a2' id = 6 ++++ starting: begin job for module with label 'a3' id = 7 @@ -61,7 +73,29 @@ Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e81 ++++ starting: begin stream for module: stream = 0 label = 'intProducer' id = 4 ++++ finished: begin stream for module: stream = 0 label = 'intProducer' id = 4 ++++ starting: begin stream for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = BeginStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + StreamContext: StreamID = 0 transition = BeginStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++ finished: begin stream for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = BeginStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + StreamContext: StreamID = 0 transition = BeginStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++ starting: begin stream for module: stream = 0 label = 'a2' id = 6 ++++ finished: begin stream for module: stream = 0 label = 'a2' id = 6 ++++ starting: begin stream for module: stream = 0 label = 'a3' id = 7 @@ -78,44 +112,128 @@ Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e81 StreamContext: StreamID = 0 transition = BeginStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = BeginStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: begin stream for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = BeginStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = BeginStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: begin stream for module: stream = 0 label = 'intProducerB' id = 10 ++++ finished: begin stream for module: stream = 0 label = 'intProducerB' id = 10 -++++ starting: begin stream for module: stream = 0 label = 'intProducerU' id = 11 -++++ finished: begin stream for module: stream = 0 label = 'intProducerU' id = 11 -++++ starting: begin stream for module: stream = 0 label = 'intVectorProducer' id = 12 -++++ finished: begin stream for module: stream = 0 label = 'intVectorProducer' id = 12 +++++ starting: begin stream for module: stream = 0 label = 'intProducerBeginProcessBlock' id = 11 +++++ finished: begin stream for module: stream = 0 label = 'intProducerBeginProcessBlock' id = 11 +++++ starting: begin stream for module: stream = 0 label = 'intProducerEndProcessBlock' id = 12 +++++ finished: begin stream for module: stream = 0 label = 'intProducerEndProcessBlock' id = 12 +++++ starting: begin stream for module: stream = 0 label = 'intProducerU' id = 13 +++++ finished: begin stream for module: stream = 0 label = 'intProducerU' id = 13 +++++ starting: begin stream for module: stream = 0 label = 'intVectorProducer' id = 14 +++++ finished: begin stream for module: stream = 0 label = 'intVectorProducer' id = 14 +++++ starting: begin process block +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ starting: begin process block for module: label = 'intProducerBeginProcessBlock' id = 11 +++++++ finished: begin process block for module: label = 'intProducerBeginProcessBlock' id = 11 +++++++ starting: begin process block for module: label = 'a1' id = 5 +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ finished: begin process block for module: label = 'a1' id = 5 +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ starting: begin process block for module: label = 'intProducerEndProcessBlock' id = 12 +++++++ finished: begin process block for module: label = 'intProducerEndProcessBlock' id = 12 +++++++ starting: begin process block for module: label = 'a2' id = 6 +++++++ finished: begin process block for module: label = 'a2' id = 6 +++++++ starting: begin process block for module: label = 'a3' id = 7 +++++++ finished: begin process block for module: label = 'a3' id = 7 +++++ finished: begin process block +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ starting: begin process block +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ finished: begin process block +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++ starting: source run ++++ finished: source run ++++ starting: global begin run 1 : time = 1 GlobalContext: transition = BeginRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: global begin run for module: label = 'intVectorProducer' id = 12 -++++++ finished: global begin run for module: label = 'intVectorProducer' id = 12 +++++++ starting: global begin run for module: label = 'intVectorProducer' id = 14 +++++++ finished: global begin run for module: label = 'intVectorProducer' id = 14 ++++++ starting: global begin run for module: label = 'a1' id = 5 +GlobalContext: transition = BeginRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = BeginRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ finished: global begin run for module: label = 'a1' id = 5 +GlobalContext: transition = BeginRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = BeginRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ starting: global begin run for module: label = 'a2' id = 6 ++++++ finished: global begin run for module: label = 'a2' id = 6 ++++++ starting: global begin run for module: label = 'a3' id = 7 @@ -124,55 +242,55 @@ GlobalContext: transition = BeginRun GlobalContext: transition = BeginRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global begin run 1 : time = 1 GlobalContext: transition = BeginRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: global begin run 1 : time = 1 GlobalContext: transition = BeginRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: begin run: stream = 0 run = 1 time = 1 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: begin run for module: stream = 0 label = 'intProducerU' id = 11 -++++++ finished: begin run for module: stream = 0 label = 'intProducerU' id = 11 +++++++ starting: begin run for module: stream = 0 label = 'intProducerU' id = 13 +++++++ finished: begin run for module: stream = 0 label = 'intProducerU' id = 13 ++++++ starting: begin run for module: stream = 0 label = 'intProducerB' id = 10 ++++++ finished: begin run for module: stream = 0 label = 'intProducerB' id = 10 ++++++ starting: begin run for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ finished: begin run for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: begin run for module: stream = 0 label = 'intProducer' id = 4 ++++++ finished: begin run for module: stream = 0 label = 'intProducer' id = 4 @@ -180,21 +298,21 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: begin run: stream = 0 run = 1 time = 1 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: begin run: stream = 0 run = 1 time = 1 StreamContext: StreamID = 0 transition = BeginRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: source lumi ++++ finished: source lumi @@ -202,12 +320,34 @@ StreamContext: StreamID = 0 transition = BeginRun GlobalContext: transition = BeginLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: global begin lumi for module: label = 'intVectorProducer' id = 12 -++++++ finished: global begin lumi for module: label = 'intVectorProducer' id = 12 +++++++ starting: global begin lumi for module: label = 'intVectorProducer' id = 14 +++++++ finished: global begin lumi for module: label = 'intVectorProducer' id = 14 ++++++ starting: global begin lumi for module: label = 'a1' id = 5 +GlobalContext: transition = BeginLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = BeginLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ finished: global begin lumi for module: label = 'a1' id = 5 +GlobalContext: transition = BeginLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = BeginLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ starting: global begin lumi for module: label = 'a2' id = 6 ++++++ finished: global begin lumi for module: label = 'a2' id = 6 ++++++ starting: global begin lumi for module: label = 'a3' id = 7 @@ -216,55 +356,55 @@ GlobalContext: transition = BeginLuminosityBlock GlobalContext: transition = BeginLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global begin lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = BeginLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: global begin lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = BeginLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: begin lumi: stream = 0 run = 1 lumi = 1 time = 1 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: begin lumi for module: stream = 0 label = 'intProducerU' id = 11 -++++++ finished: begin lumi for module: stream = 0 label = 'intProducerU' id = 11 +++++++ starting: begin lumi for module: stream = 0 label = 'intProducerU' id = 13 +++++++ finished: begin lumi for module: stream = 0 label = 'intProducerU' id = 13 ++++++ starting: begin lumi for module: stream = 0 label = 'intProducerB' id = 10 ++++++ finished: begin lumi for module: stream = 0 label = 'intProducerB' id = 10 ++++++ starting: begin lumi for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ finished: begin lumi for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: begin lumi for module: stream = 0 label = 'intProducer' id = 4 ++++++ finished: begin lumi for module: stream = 0 label = 'intProducer' id = 4 @@ -272,21 +412,21 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: begin lumi: stream = 0 run = 1 lumi = 1 time = 1 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: begin lumi: stream = 0 run = 1 lumi = 1 time = 1 StreamContext: StreamID = 0 transition = BeginLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: source event ++++ finished: source event @@ -294,36 +434,36 @@ StreamContext: StreamID = 0 transition = BeginLuminosityBlock StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: processing path 'e' : stream = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = e pathID = 0 (EndPath) StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: processing path 'p' : stream = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a3' id = 7 ++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Prefetching moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -333,22 +473,74 @@ ModuleCallingContext state = Prefetching StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a2' id = 6 ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Prefetching + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ starting: processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Prefetching + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ starting: processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ finished: processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Prefetching moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -358,13 +550,13 @@ ModuleCallingContext state = Prefetching StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++++ starting: processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -374,13 +566,13 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++++ finished: processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -390,7 +582,7 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'a3' id = 7 ++++++++ starting: processing event for module: stream = 0 label = 'a3' id = 7 @@ -404,12 +596,12 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'TriggerResults' id = 1 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'TriggerResults' id = 1 @@ -417,14 +609,14 @@ PathContext: pathName = p pathID = 0 ++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1 ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'out' id = 8 ++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerB' id = 10 -++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ starting: processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ starting: processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ finished: processing event for module: stream = 0 label = 'intProducerU' id = 11 +++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ starting: processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ starting: processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ finished: processing event for module: stream = 0 label = 'intProducerU' id = 13 ++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerB' id = 10 ++++++++++ starting: processing event for module: stream = 0 label = 'intProducerB' id = 10 ++++++++++ finished: processing event for module: stream = 0 label = 'intProducerB' id = 10 @@ -437,32 +629,32 @@ PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = e pathID = 0 (EndPath) StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: processing event : stream = 0 run = 1 lumi = 1 event = 1 time = 5000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: processing event : stream = 0 run = 1 lumi = 1 event = 1 time = 5000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: processing event : stream = 0 run = 1 lumi = 1 event = 1 time = 5000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 5000001 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: source event ++++ finished: source event @@ -470,36 +662,36 @@ StreamContext: StreamID = 0 transition = Event StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: processing path 'e' : stream = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = e pathID = 0 (EndPath) StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: processing path 'p' : stream = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a3' id = 7 ++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Prefetching moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -509,22 +701,74 @@ ModuleCallingContext state = Prefetching StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a2' id = 6 ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Prefetching + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ starting: processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Prefetching + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ starting: processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ finished: processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 2 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Prefetching moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -534,13 +778,13 @@ ModuleCallingContext state = Prefetching StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++++ starting: processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -550,13 +794,13 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++++ finished: processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -566,7 +810,7 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'a3' id = 7 ++++++++ starting: processing event for module: stream = 0 label = 'a3' id = 7 @@ -580,12 +824,12 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'TriggerResults' id = 1 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'TriggerResults' id = 1 @@ -593,14 +837,14 @@ PathContext: pathName = p pathID = 0 ++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1 ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'out' id = 8 ++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerB' id = 10 -++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ starting: processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ starting: processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ finished: processing event for module: stream = 0 label = 'intProducerU' id = 11 +++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ starting: processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ starting: processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ finished: processing event for module: stream = 0 label = 'intProducerU' id = 13 ++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerB' id = 10 ++++++++++ starting: processing event for module: stream = 0 label = 'intProducerB' id = 10 ++++++++++ finished: processing event for module: stream = 0 label = 'intProducerB' id = 10 @@ -613,32 +857,32 @@ PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = e pathID = 0 (EndPath) StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: processing event : stream = 0 run = 1 lumi = 1 event = 2 time = 10000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: processing event : stream = 0 run = 1 lumi = 1 event = 2 time = 10000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: processing event : stream = 0 run = 1 lumi = 1 event = 2 time = 10000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 2 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 10000001 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: source event ++++ finished: source event @@ -646,36 +890,36 @@ StreamContext: StreamID = 0 transition = Event StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: processing path 'e' : stream = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = e pathID = 0 (EndPath) StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: processing path 'p' : stream = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a3' id = 7 ++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Prefetching moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -685,22 +929,74 @@ ModuleCallingContext state = Prefetching StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a2' id = 6 ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Prefetching + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ starting: processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: processing event for module: stream = 0 label = 'intProducer' id = 4 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Prefetching + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ starting: processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++ finished: processing event for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + PlaceInPathContext 1 + PathContext: pathName = p pathID = 0 + StreamContext: StreamID = 0 transition = Event + run: 1 lumi: 1 event: 3 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Prefetching moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -710,13 +1006,13 @@ ModuleCallingContext state = Prefetching StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++++ starting: processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -726,13 +1022,13 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++++ finished: processing event for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ModuleCallingContext state = Prefetching @@ -742,7 +1038,7 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'a3' id = 7 ++++++++ starting: processing event for module: stream = 0 label = 'a3' id = 7 @@ -756,12 +1052,12 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'TriggerResults' id = 1 ++++++++ finished: prefetching before processing event for module: stream = 0 label = 'TriggerResults' id = 1 @@ -769,14 +1065,14 @@ PathContext: pathName = p pathID = 0 ++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1 ++++++++ starting: prefetching before processing event for module: stream = 0 label = 'out' id = 8 ++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerB' id = 10 -++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ starting: processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: processing event for module: stream = 0 label = 'intVectorProducer' id = 12 -++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ starting: processing event for module: stream = 0 label = 'intProducerU' id = 11 -++++++++++ finished: processing event for module: stream = 0 label = 'intProducerU' id = 11 +++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ starting: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ starting: processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: processing event for module: stream = 0 label = 'intVectorProducer' id = 14 +++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ starting: processing event for module: stream = 0 label = 'intProducerU' id = 13 +++++++++++ finished: processing event for module: stream = 0 label = 'intProducerU' id = 13 ++++++++++ finished: prefetching before processing event for module: stream = 0 label = 'intProducerB' id = 10 ++++++++++ starting: processing event for module: stream = 0 label = 'intProducerB' id = 10 ++++++++++ finished: processing event for module: stream = 0 label = 'intProducerB' id = 10 @@ -789,66 +1085,66 @@ PathContext: pathName = p pathID = 0 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac PathContext: pathName = e pathID = 0 (EndPath) StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: processing event : stream = 0 run = 1 lumi = 1 event = 3 time = 15000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: processing event : stream = 0 run = 1 lumi = 1 event = 3 time = 15000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: processing event : stream = 0 run = 1 lumi = 1 event = 3 time = 15000001 StreamContext: StreamID = 0 transition = Event run: 1 lumi: 1 event: 3 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: end lumi: stream = 0 run = 1 lumi = 1 time = 15000001 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: end lumi for module: stream = 0 label = 'intProducerU' id = 11 -++++++ finished: end lumi for module: stream = 0 label = 'intProducerU' id = 11 +++++++ starting: end lumi for module: stream = 0 label = 'intProducerU' id = 13 +++++++ finished: end lumi for module: stream = 0 label = 'intProducerU' id = 13 ++++++ starting: end lumi for module: stream = 0 label = 'intProducerB' id = 10 ++++++ finished: end lumi for module: stream = 0 label = 'intProducerB' id = 10 ++++++ starting: end lumi for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ finished: end lumi for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: end lumi for module: stream = 0 label = 'intProducer' id = 4 ++++++ finished: end lumi for module: stream = 0 label = 'intProducer' id = 4 @@ -856,32 +1152,54 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: end lumi: stream = 0 run = 1 lumi = 1 time = 0 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: end lumi: stream = 0 run = 1 lumi = 1 time = 0 StreamContext: StreamID = 0 transition = EndLuminosityBlock run: 1 lumi: 1 event: 0 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global end lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = EndLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: global end lumi for module: label = 'intVectorProducer' id = 12 -++++++ finished: global end lumi for module: label = 'intVectorProducer' id = 12 +++++++ starting: global end lumi for module: label = 'intVectorProducer' id = 14 +++++++ finished: global end lumi for module: label = 'intVectorProducer' id = 14 ++++++ starting: global end lumi for module: label = 'a1' id = 5 +GlobalContext: transition = EndLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = EndLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ finished: global end lumi for module: label = 'a1' id = 5 +GlobalContext: transition = EndLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = EndLuminosityBlock + run: 1 luminosityBlock: 1 + runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ starting: global end lumi for module: label = 'a2' id = 6 ++++++ finished: global end lumi for module: label = 'a2' id = 6 ++++++ starting: global end lumi for module: label = 'a3' id = 7 @@ -890,27 +1208,27 @@ GlobalContext: transition = EndLuminosityBlock GlobalContext: transition = EndLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global end lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = EndLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: global end lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = EndLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global write lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = WriteLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: write lumi for module: label = 'out' id = 8 ++++++ finished: write lumi for module: label = 'out' id = 8 @@ -918,55 +1236,55 @@ GlobalContext: transition = WriteLuminosityBlock GlobalContext: transition = WriteLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global write lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = WriteLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: global write lumi: run = 1 lumi = 1 time = 1 GlobalContext: transition = WriteLuminosityBlock run: 1 luminosityBlock: 1 runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: end run: stream = 0 run = 1 time = 15000001 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: end run for module: stream = 0 label = 'intProducerU' id = 11 -++++++ finished: end run for module: stream = 0 label = 'intProducerU' id = 11 +++++++ starting: end run for module: stream = 0 label = 'intProducerU' id = 13 +++++++ finished: end run for module: stream = 0 label = 'intProducerU' id = 13 ++++++ starting: end run for module: stream = 0 label = 'intProducerB' id = 10 ++++++ finished: end run for module: stream = 0 label = 'intProducerB' id = 10 ++++++ starting: end run for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ finished: end run for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: end run for module: stream = 0 label = 'intProducer' id = 4 ++++++ finished: end run for module: stream = 0 label = 'intProducer' id = 4 @@ -974,32 +1292,54 @@ ModuleCallingContext state = Running StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: end run: stream = 0 run = 1 time = 0 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: end run: stream = 0 run = 1 time = 0 StreamContext: StreamID = 0 transition = EndRun run: 1 lumi: 0 event: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global end run 1 : time = 15000001 GlobalContext: transition = EndRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac -++++++ starting: global end run for module: label = 'intVectorProducer' id = 12 -++++++ finished: global end run for module: label = 'intVectorProducer' id = 12 +++++++ starting: global end run for module: label = 'intVectorProducer' id = 14 +++++++ finished: global end run for module: label = 'intVectorProducer' id = 14 ++++++ starting: global end run for module: label = 'a1' id = 5 +GlobalContext: transition = EndRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = EndRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ finished: global end run for module: label = 'a1' id = 5 +GlobalContext: transition = EndRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = EndRun + run: 1 luminosityBlock: 0 + runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++++ starting: global end run for module: label = 'a2' id = 6 ++++++ finished: global end run for module: label = 'a2' id = 6 ++++++ starting: global end run for module: label = 'a3' id = 7 @@ -1008,27 +1348,27 @@ GlobalContext: transition = EndRun GlobalContext: transition = EndRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global end run 1 : time = 0 GlobalContext: transition = EndRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: global end run 1 : time = 0 GlobalContext: transition = EndRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global write run 1 : time = 15000001 GlobalContext: transition = WriteRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++++ starting: write run for module: label = 'out' id = 8 ++++++ finished: write run for module: label = 'out' id = 8 @@ -1036,26 +1376,134 @@ GlobalContext: transition = WriteRun GlobalContext: transition = WriteRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: global write run 1 : time = 0 GlobalContext: transition = WriteRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: global write run 1 : time = 0 GlobalContext: transition = WriteRun run: 1 luminosityBlock: 0 runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 - parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ starting: end process block +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ starting: end process block for module: label = 'intProducerBeginProcessBlock' id = 11 +++++++ finished: end process block for module: label = 'intProducerBeginProcessBlock' id = 11 +++++++ starting: end process block for module: label = 'intProducerEndProcessBlock' id = 12 +++++++ finished: end process block for module: label = 'intProducerEndProcessBlock' id = 12 +++++++ starting: end process block for module: label = 'a1' id = 5 +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ finished: end process block for module: label = 'a1' id = 5 +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ starting: end process block for module: label = 'a2' id = 6 +++++++ finished: end process block for module: label = 'a2' id = 6 +++++++ starting: end process block for module: label = 'a3' id = 7 +++++++ finished: end process block for module: label = 'a3' id = 7 +++++ finished: end process block +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ starting: end process block +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ finished: end process block +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ starting: write process block +GlobalContext: transition = WriteProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++++ starting: write process block for module: label = 'out' id = 8 +++++++ finished: write process block for module: label = 'out' id = 8 +++++ finished: write process block +GlobalContext: transition = WriteProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ starting: write process block +GlobalContext: transition = WriteProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + +++++ finished: write process block +GlobalContext: transition = WriteProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994 + parent ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: end stream for module: stream = 0 label = 'intProducer' id = 4 ++++ finished: end stream for module: stream = 0 label = 'intProducer' id = 4 ++++ starting: end stream for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = EndStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + StreamContext: StreamID = 0 transition = EndStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++ finished: end stream for module: stream = 0 label = 'a1' id = 5 +StreamContext: StreamID = 0 transition = EndStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac +ModuleCallingContext state = Running + moduleDescription: Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc + StreamContext: StreamID = 0 transition = EndStream + run: 0 lumi: 0 event: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac + ++++ starting: end stream for module: stream = 0 label = 'a2' id = 6 ++++ finished: end stream for module: stream = 0 label = 'a2' id = 6 ++++ starting: end stream for module: stream = 0 label = 'a3' id = 7 @@ -1072,47 +1520,57 @@ GlobalContext: transition = WriteRun StreamContext: StreamID = 0 transition = EndStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = EndStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ finished: end stream for module: stream = 0 label = 'intProducerA' id = 9 StreamContext: StreamID = 0 transition = EndStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ModuleCallingContext state = Running moduleDescription: Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 StreamContext: StreamID = 0 transition = EndStream run: 0 lumi: 0 event: 0 runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 - ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b + ProcessContext: PROD1 be16549dc0c1f4b03231a8b98d235dac ++++ starting: end stream for module: stream = 0 label = 'intProducerB' id = 10 ++++ finished: end stream for module: stream = 0 label = 'intProducerB' id = 10 -++++ starting: end stream for module: stream = 0 label = 'intProducerU' id = 11 -++++ finished: end stream for module: stream = 0 label = 'intProducerU' id = 11 -++++ starting: end stream for module: stream = 0 label = 'intVectorProducer' id = 12 -++++ finished: end stream for module: stream = 0 label = 'intVectorProducer' id = 12 +++++ starting: end stream for module: stream = 0 label = 'intProducerBeginProcessBlock' id = 11 +++++ finished: end stream for module: stream = 0 label = 'intProducerBeginProcessBlock' id = 11 +++++ starting: end stream for module: stream = 0 label = 'intProducerEndProcessBlock' id = 12 +++++ finished: end stream for module: stream = 0 label = 'intProducerEndProcessBlock' id = 12 +++++ starting: end stream for module: stream = 0 label = 'intProducerU' id = 13 +++++ finished: end stream for module: stream = 0 label = 'intProducerU' id = 13 +++++ starting: end stream for module: stream = 0 label = 'intVectorProducer' id = 14 +++++ finished: end stream for module: stream = 0 label = 'intVectorProducer' id = 14 ++++ starting: end job for module with label 'intProducerA' id = 9 Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ++++ finished: end job for module with label 'intProducerA' id = 9 Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4 ++++ starting: end job for module with label 'intProducerB' id = 10 ++++ finished: end job for module with label 'intProducerB' id = 10 -++++ starting: end job for module with label 'intProducerU' id = 11 -++++ finished: end job for module with label 'intProducerU' id = 11 -++++ starting: end job for module with label 'intVectorProducer' id = 12 -++++ finished: end job for module with label 'intVectorProducer' id = 12 +++++ starting: end job for module with label 'intProducerBeginProcessBlock' id = 11 +++++ finished: end job for module with label 'intProducerBeginProcessBlock' id = 11 +++++ starting: end job for module with label 'intProducerEndProcessBlock' id = 12 +++++ finished: end job for module with label 'intProducerEndProcessBlock' id = 12 +++++ starting: end job for module with label 'intProducerU' id = 13 +++++ finished: end job for module with label 'intProducerU' id = 13 +++++ starting: end job for module with label 'intVectorProducer' id = 14 +++++ finished: end job for module with label 'intVectorProducer' id = 14 ++++ starting: end job for module with label 'intProducer' id = 4 ++++ finished: end job for module with label 'intProducer' id = 4 ++++ starting: end job for module with label 'a1' id = 5 -TestFindProduct sum = 12 +Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc +TestFindProduct sum = 110012 ++++ finished: end job for module with label 'a1' id = 5 +Module type=TestFindProduct, Module label=a1, Parameter Set ID=73b313a2727141f62e12cd7cf1a5b8dc ++++ starting: end job for module with label 'a2' id = 6 TestFindProduct sum = 300 ++++ finished: end job for module with label 'a2' id = 6 diff --git a/FWCore/Integration/test/unit_test_outputs/testGetBy2.log b/FWCore/Integration/test/unit_test_outputs/testGetBy2.log index 29b03e19587dc..819be350379f5 100644 --- a/FWCore/Integration/test/unit_test_outputs/testGetBy2.log +++ b/FWCore/Integration/test/unit_test_outputs/testGetBy2.log @@ -75,6 +75,18 @@ ModuleCallingContext state = Running ++++ finished: begin stream for module: stream = 0 label = 'intProducerU' id = 6 ++++ starting: begin stream for module: stream = 0 label = 'intVectorProducer' id = 7 ++++ finished: begin stream for module: stream = 0 label = 'intVectorProducer' id = 7 +++++ starting: begin process block +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59 + +++++ finished: begin process block +GlobalContext: transition = BeginProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59 + ++++ starting: source run ++++ finished: source run ++++ starting: global begin run 1 : time = 1 @@ -767,6 +779,32 @@ GlobalContext: transition = WriteRun ++++ starting: close input file: lfn = file:testGetBy1.root usedFallBack = 0 ++++ finished: close input file: lfn = file:testGetBy1.root usedFallBack = 0 +++++ starting: end process block +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59 + +++++ finished: end process block +GlobalContext: transition = EndProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59 + +++++ starting: write process block +GlobalContext: transition = WriteProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59 + +++++++ starting: write process block for module: label = 'out' id = 5 +++++++ finished: write process block for module: label = 'out' id = 5 +++++ finished: write process block +GlobalContext: transition = WriteProcessBlock + run: 0 luminosityBlock: 0 + runIndex = 4294967295 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0 + ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59 + ++++ starting: end stream for module: stream = 0 label = 'intProducer' id = 4 StreamContext: StreamID = 0 transition = EndStream run: 0 lumi: 0 event: 0 diff --git a/FWCore/Integration/test/unit_test_outputs/testSubProcess.grep2.txt b/FWCore/Integration/test/unit_test_outputs/testSubProcess.grep2.txt index af294c940857c..2069347e3a3ce 100644 --- a/FWCore/Integration/test/unit_test_outputs/testSubProcess.grep2.txt +++ b/FWCore/Integration/test/unit_test_outputs/testSubProcess.grep2.txt @@ -230,6 +230,24 @@ ++++ finished: begin stream for module: stream = 0 label = 'path4' id = 29 ++++ starting: begin stream for module: stream = 0 label = 'endPath1' id = 30 ++++ finished: begin stream for module: stream = 0 label = 'endPath1' id = 30 +++++ starting: begin process block +++++ finished: begin process block +++++ starting: begin process block +++++ finished: begin process block +++++ starting: begin process block +++++++ starting: begin process block for module: label = 'getInt' id = 10 +++++++ finished: begin process block for module: label = 'getInt' id = 10 +++++ finished: begin process block +++++ starting: begin process block +++++ finished: begin process block +++++ starting: begin process block +++++ starting: begin process block +++++++ starting: begin process block for module: label = 'getInt' id = 35 +++++++ finished: begin process block for module: label = 'getInt' id = 35 +++++ finished: begin process block +++++++ starting: begin process block for module: label = 'getInt' id = 22 +++++++ finished: begin process block for module: label = 'getInt' id = 22 +++++ finished: begin process block ++++ starting: source run ++++ finished: source run ++++ starting: global begin run 1 : time = 1 @@ -6794,6 +6812,40 @@ ++++++ starting: write run for module: label = 'out' id = 24 ++++++ finished: write run for module: label = 'out' id = 24 ++++ finished: global write run 3 : time = 0 +++++ starting: end process block +++++ finished: end process block +++++ starting: end process block +++++ finished: end process block +++++ starting: end process block +++++++ starting: end process block for module: label = 'getInt' id = 10 +++++++ finished: end process block for module: label = 'getInt' id = 10 +++++ finished: end process block +++++ starting: end process block +++++ finished: end process block +++++ starting: end process block +++++ starting: end process block +++++++ starting: end process block for module: label = 'getInt' id = 35 +++++++ finished: end process block for module: label = 'getInt' id = 35 +++++ finished: end process block +++++++ starting: end process block for module: label = 'getInt' id = 22 +++++++ finished: end process block for module: label = 'getInt' id = 22 +++++ finished: end process block +++++ starting: write process block +++++ finished: write process block +++++ starting: write process block +++++ finished: write process block +++++ starting: write process block +++++ finished: write process block +++++ starting: write process block +++++ finished: write process block +++++ starting: write process block +++++ starting: write process block +++++++ starting: write process block for module: label = 'out' id = 37 +++++++ finished: write process block for module: label = 'out' id = 37 +++++ finished: write process block +++++++ starting: write process block for module: label = 'out' id = 24 +++++++ finished: write process block for module: label = 'out' id = 24 +++++ finished: write process block ++++ starting: end stream for module: stream = 0 label = 'thingWithMergeProducer' id = 5 ++++ finished: end stream for module: stream = 0 label = 'thingWithMergeProducer' id = 5 ++++ starting: end stream for module: stream = 0 label = 'get' id = 6 diff --git a/FWCore/MessageService/interface/MessageLogger.h b/FWCore/MessageService/interface/MessageLogger.h index ebc8bd63163dc..ff46741db63b2 100644 --- a/FWCore/MessageService/interface/MessageLogger.h +++ b/FWCore/MessageService/interface/MessageLogger.h @@ -114,6 +114,13 @@ namespace edm { void preStreamEndLumi(StreamContext const&); void postStreamEndLumi(StreamContext const&); + void preModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&); void postModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&); void preModuleGlobalEndRun(GlobalContext const&, ModuleCallingContext const&); @@ -124,6 +131,13 @@ namespace edm { void preModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&); void postModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&); + void preBeginProcessBlock(GlobalContext const&); + void postBeginProcessBlock(GlobalContext const&); + void preAccessInputProcessBlock(GlobalContext const&); + void postAccessInputProcessBlock(GlobalContext const&); + void preEndProcessBlock(GlobalContext const&); + void postEndProcessBlock(GlobalContext const&); + void preGlobalBeginRun(GlobalContext const&); void postGlobalBeginRun(GlobalContext const&); void preGlobalEndRun(GlobalContext const&); diff --git a/FWCore/MessageService/src/MessageLogger.cc b/FWCore/MessageService/src/MessageLogger.cc index fb9d16af57a8e..0878f8486f972 100644 --- a/FWCore/MessageService/src/MessageLogger.cc +++ b/FWCore/MessageService/src/MessageLogger.cc @@ -107,8 +107,18 @@ using namespace edm; using namespace edm::service; namespace { - constexpr std::array s_globalTransitionNames = { - {"@beginJob", "@beginRun", "@beginLumi", "@endLumi", "@endRun", "@endJob", "@writeRun", "@writeLumi"}}; + constexpr std::array s_globalTransitionNames = {{"@beginJob", + "@beginProcessBlock", + "@accessInputProcessBlock", + "@beginRun", + "@beginLumi", + "@endLumi", + "@endRun", + "@kEndProcessBlock", + "@endJob", + "@writeProcessBlock", + "@writeRun", + "@writeLumi"}}; constexpr std::array s_streamTransitionNames = {{"@beginStream", "@streamBeginRun", @@ -312,6 +322,13 @@ namespace edm { iRegistry.watchPreModuleStreamEndLumi(this, &MessageLogger::preModuleStreamEndLumi); iRegistry.watchPostModuleStreamEndLumi(this, &MessageLogger::postModuleStreamEndLumi); + iRegistry.watchPreModuleBeginProcessBlock(this, &MessageLogger::preModuleBeginProcessBlock); + iRegistry.watchPostModuleBeginProcessBlock(this, &MessageLogger::postModuleBeginProcessBlock); + iRegistry.watchPreModuleAccessInputProcessBlock(this, &MessageLogger::preModuleAccessInputProcessBlock); + iRegistry.watchPostModuleAccessInputProcessBlock(this, &MessageLogger::postModuleAccessInputProcessBlock); + iRegistry.watchPreModuleEndProcessBlock(this, &MessageLogger::preModuleEndProcessBlock); + iRegistry.watchPostModuleEndProcessBlock(this, &MessageLogger::postModuleEndProcessBlock); + iRegistry.watchPreModuleGlobalBeginRun(this, &MessageLogger::preModuleGlobalBeginRun); iRegistry.watchPostModuleGlobalBeginRun(this, &MessageLogger::postModuleGlobalBeginRun); iRegistry.watchPreModuleGlobalEndRun(this, &MessageLogger::preModuleGlobalEndRun); @@ -333,6 +350,13 @@ namespace edm { iRegistry.watchPreStreamEndLumi(this, &MessageLogger::preStreamEndLumi); iRegistry.watchPostStreamEndLumi(this, &MessageLogger::postStreamEndLumi); + iRegistry.watchPreBeginProcessBlock(this, &MessageLogger::preBeginProcessBlock); + iRegistry.watchPostBeginProcessBlock(this, &MessageLogger::postBeginProcessBlock); + iRegistry.watchPreAccessInputProcessBlock(this, &MessageLogger::preAccessInputProcessBlock); + iRegistry.watchPostAccessInputProcessBlock(this, &MessageLogger::postAccessInputProcessBlock); + iRegistry.watchPreEndProcessBlock(this, &MessageLogger::preEndProcessBlock); + iRegistry.watchPostEndProcessBlock(this, &MessageLogger::postEndProcessBlock); + iRegistry.watchPreGlobalBeginRun(this, &MessageLogger::preGlobalBeginRun); iRegistry.watchPostGlobalBeginRun(this, &MessageLogger::postGlobalBeginRun); iRegistry.watchPreGlobalEndRun(this, &MessageLogger::preGlobalEndRun); @@ -609,6 +633,37 @@ namespace edm { } //Global + + void MessageLogger::preModuleBeginProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + ModuleDescription const& desc = *mcc.moduleDescription(); + establishModule(desc, "@beginProcessBlock"); + } + + void MessageLogger::postModuleBeginProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + ModuleDescription const& desc = *mcc.moduleDescription(); + unEstablishModule(desc, "After module BeginProcessBlock"); + } + + void MessageLogger::preModuleAccessInputProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + ModuleDescription const& desc = *mcc.moduleDescription(); + establishModule(desc, "@accessInputProcessBlock"); + } + + void MessageLogger::postModuleAccessInputProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + ModuleDescription const& desc = *mcc.moduleDescription(); + unEstablishModule(desc, "After module AccessInputProcessBlock"); + } + + void MessageLogger::preModuleEndProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + ModuleDescription const& desc = *mcc.moduleDescription(); + establishModule(desc, "@endProcessBlock"); + } + + void MessageLogger::postModuleEndProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + ModuleDescription const& desc = *mcc.moduleDescription(); + unEstablishModule(desc, "After module EndProcessBlock"); + } + void MessageLogger::preModuleGlobalBeginRun(GlobalContext const& context, ModuleCallingContext const& mod) { establishModule(runInfoBegin_ + context.runIndex().value(), mod, @@ -757,6 +812,33 @@ namespace edm { edm::MessageDrop::instance()->setSinglet("PostStreamEndLumi"); // changelog 17 } + void MessageLogger::preBeginProcessBlock(GlobalContext const& gc) { + edm::MessageDrop::instance()->runEvent = "pre-events"; + edm::MessageDrop::instance()->setSinglet("BeginProcessBlock"); + } + + void MessageLogger::postBeginProcessBlock(GlobalContext const& gc) { + edm::MessageDrop::instance()->setSinglet("After BeginProcessBlock"); + } + + void MessageLogger::preAccessInputProcessBlock(GlobalContext const& gc) { + edm::MessageDrop::instance()->runEvent = "pre-events"; + edm::MessageDrop::instance()->setSinglet("AccessInputProcessBlock"); + } + + void MessageLogger::postAccessInputProcessBlock(GlobalContext const& gc) { + edm::MessageDrop::instance()->setSinglet("After AccessInputProcessBlock"); + } + + void MessageLogger::preEndProcessBlock(GlobalContext const& gc) { + edm::MessageDrop::instance()->runEvent = "post-events"; + edm::MessageDrop::instance()->setSinglet("EndProcessBlock"); + } + + void MessageLogger::postEndProcessBlock(GlobalContext const& gc) { + edm::MessageDrop::instance()->setSinglet("After EndProcessBlock"); + } + void MessageLogger::preGlobalBeginRun(GlobalContext const& iContext) // change log 14 { auto& buffer = transitionInfoCache_[runInfoBegin_ + iContext.runIndex()]; diff --git a/FWCore/MessageService/test/UnitTestClient_V.cc b/FWCore/MessageService/test/UnitTestClient_V.cc index 9e070b27e90c9..c0cc78f93037c 100644 --- a/FWCore/MessageService/test/UnitTestClient_V.cc +++ b/FWCore/MessageService/test/UnitTestClient_V.cc @@ -26,7 +26,7 @@ namespace edmtest { void UTC_V1::beginRun(edm::Run const& /*unused*/, edm::EventSetup const& /*unused*/) { edm::LogInfo("cat_BR") << "T1 beginRun info with identifier " << identifier << " event " << ev; - LogDebug("cat_BJ") << "T1 beginRun debug with identifier " << identifier << " event " << ev; + LogDebug("cat_BR") << "T1 beginRun debug with identifier " << identifier << " event " << ev; } void UTC_V1::beginLuminosityBlock(edm::LuminosityBlock const& /*unused*/, edm::EventSetup const& /*unused*/) { @@ -34,6 +34,16 @@ namespace edmtest { LogDebug("cat_BL") << "T1 beginLumi debug with identifier " << identifier << " event " << ev; } + void UTC_V1::beginProcessBlock(edm::ProcessBlock const&) { + edm::LogInfo("cat_BPB") << "T1 beginProcessBlock info with identifier " << identifier << " event " << ev; + LogDebug("cat_BPB") << "T1 beginProcessBlock debug with identifier " << identifier << " event " << ev; + } + + void UTC_V1::endProcessBlock(edm::ProcessBlock const&) { + edm::LogInfo("cat_EPB") << "T1 endProcessBlock info with identifier " << identifier << " event " << ev; + LogDebug("cat_EPB") << "T1 endProcessBlock debug with identifier " << identifier << " event " << ev; + } + void UTC_V2::analyze(edm::Event const& /*unused*/ , edm::EventSetup const& /*unused*/ diff --git a/FWCore/MessageService/test/UnitTestClient_V.h b/FWCore/MessageService/test/UnitTestClient_V.h index 8d1e3f06ee74e..bcd2aef75b13a 100644 --- a/FWCore/MessageService/test/UnitTestClient_V.h +++ b/FWCore/MessageService/test/UnitTestClient_V.h @@ -3,6 +3,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -14,17 +15,23 @@ namespace edm { namespace edmtest { - class UTC_V1 : public edm::EDAnalyzer { + class UTC_V1 + : public edm::one::EDAnalyzer> { public: explicit UTC_V1(edm::ParameterSet const& p) : ev(0) { identifier = p.getUntrackedParameter("identifier", 99); } - virtual ~UTC_V1() {} + ~UTC_V1() override {} - virtual void analyze(edm::Event const& e, edm::EventSetup const& c); + void analyze(edm::Event const& e, edm::EventSetup const& c) override; - virtual void beginJob(); - virtual void beginRun(edm::Run const&, edm::EventSetup const&); - virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&); + void beginJob() override; + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override {} + void endRun(edm::Run const&, edm::EventSetup const&) override {} + + void beginProcessBlock(edm::ProcessBlock const&) override; + void endProcessBlock(edm::ProcessBlock const&) override; private: int identifier; @@ -35,9 +42,9 @@ namespace edmtest { public: explicit UTC_V2(edm::ParameterSet const& p) : ev(0) { identifier = p.getUntrackedParameter("identifier", 98); } - virtual ~UTC_V2() {} + ~UTC_V2() override {} - virtual void analyze(edm::Event const& e, edm::EventSetup const& c); + void analyze(edm::Event const& e, edm::EventSetup const& c) override; private: int identifier; diff --git a/FWCore/MessageService/test/unit_test_outputs/u33_all.log b/FWCore/MessageService/test/unit_test_outputs/u33_all.log index 7b7557faaa047..b32bd7eb2d16d 100644 --- a/FWCore/MessageService/test/unit_test_outputs/u33_all.log +++ b/FWCore/MessageService/test/unit_test_outputs/u33_all.log @@ -4,6 +4,12 @@ T1 beginJob warning with identifier 11 event 0 %MSG-w cat_BJ: UTC_V1:ssm_1b@beginJob pre-events T1 beginJob warning with identifier 12 event 0 %MSG +%MSG-i cat_BPB: UTC_V1:ssm_1a@beginProcessBlock pre-events +T1 beginProcessBlock info with identifier 11 event 0 +%MSG +%MSG-i cat_BPB: UTC_V1:ssm_1b@beginProcessBlock pre-events +T1 beginProcessBlock info with identifier 12 event 0 +%MSG %MSG-i cat_BR: UTC_V1:ssm_1a@beginRun Run: 1 T1 beginRun info with identifier 11 event 0 %MSG @@ -84,6 +90,12 @@ T1 analyze warning with identifier 22 event 1 %MSG-i cat_A: UTC_V2:ssm_2b Run: 1 Event: 2 T1 analyze info with identifier 22 event 1 %MSG +%MSG-i cat_EPB: UTC_V1:ssm_1a@endProcessBlock post-events +T1 endProcessBlock info with identifier 11 event 2 +%MSG +%MSG-i cat_EPB: UTC_V1:ssm_1b@endProcessBlock post-events +T1 endProcessBlock info with identifier 12 event 2 +%MSG ============================================= @@ -95,20 +107,24 @@ MessageLogger Summary 2 cat_A -i UTC_V1:ssm_1a 2 2 3 cat_A -i UTC_V1:ssm_1b 2 2 4 cat_A -i UTC_V2:ssm_2b 2 2 - 5 cat_BR -i UTC_V1:ssm_1a@be 1 1 - 6 cat_BR -i UTC_V1:ssm_1b@be 1 1 - 7 cat_A -w UTC_V1:ssm_1a 2 2 - 8 cat_A -w UTC_V1:ssm_1b 2 2 - 9 cat_A -w UTC_V2:ssm_2a 2 2 - 10 cat_A -w UTC_V2:ssm_2b 2 2 - 11 cat_BJ -w UTC_V1:ssm_1a@be 1 1 - 12 cat_BJ -w UTC_V1:ssm_1b@be 1 1 - 13 cat_BL -w UTC_V1:ssm_1a@be 1 1 - 14 cat_BL -w UTC_V1:ssm_1b@be 1 1 - 15 cat_A -e UTC_V1:ssm_1a 2 2 - 16 cat_A -e UTC_V1:ssm_1b 2 2 - 17 cat_A -e UTC_V2:ssm_2a 2 2 - 18 cat_A -e UTC_V2:ssm_2b 2 2 + 5 cat_BPB -i UTC_V1:ssm_1a@be 1 1 + 6 cat_BPB -i UTC_V1:ssm_1b@be 1 1 + 7 cat_BR -i UTC_V1:ssm_1a@be 1 1 + 8 cat_BR -i UTC_V1:ssm_1b@be 1 1 + 9 cat_EPB -i UTC_V1:ssm_1a@en 1 1 + 10 cat_EPB -i UTC_V1:ssm_1b@en 1 1 + 11 cat_A -w UTC_V1:ssm_1a 2 2 + 12 cat_A -w UTC_V1:ssm_1b 2 2 + 13 cat_A -w UTC_V2:ssm_2a 2 2 + 14 cat_A -w UTC_V2:ssm_2b 2 2 + 15 cat_BJ -w UTC_V1:ssm_1a@be 1 1 + 16 cat_BJ -w UTC_V1:ssm_1b@be 1 1 + 17 cat_BL -w UTC_V1:ssm_1a@be 1 1 + 18 cat_BL -w UTC_V1:ssm_1b@be 1 1 + 19 cat_A -e UTC_V1:ssm_1a 2 2 + 20 cat_A -e UTC_V1:ssm_1b 2 2 + 21 cat_A -e UTC_V2:ssm_2a 2 2 + 22 cat_A -e UTC_V2:ssm_2b 2 2 type category Examples: run/evt run/evt run/evt ---- -------------------- ---------------- ---------------- ---------------- @@ -116,24 +132,28 @@ MessageLogger Summary 2 cat_A 1/1 1/2 3 cat_A 1/1 1/2 4 cat_A 1/1 1/2 - 5 cat_BR Run: 1 - 6 cat_BR Run: 1 - 7 cat_A 1/1 1/2 - 8 cat_A 1/1 1/2 - 9 cat_A 1/1 1/2 - 10 cat_A 1/1 1/2 - 11 cat_BJ pre-events - 12 cat_BJ pre-events - 13 cat_BL Run: 1 Lumi: 1 - 14 cat_BL Run: 1 Lumi: 1 - 15 cat_A 1/1 1/2 - 16 cat_A 1/1 1/2 - 17 cat_A 1/1 1/2 - 18 cat_A 1/1 1/2 + 5 cat_BPB pre-events + 6 cat_BPB pre-events + 7 cat_BR Run: 1 + 8 cat_BR Run: 1 + 9 cat_EPB post-events + 10 cat_EPB post-events + 11 cat_A 1/1 1/2 + 12 cat_A 1/1 1/2 + 13 cat_A 1/1 1/2 + 14 cat_A 1/1 1/2 + 15 cat_BJ pre-events + 16 cat_BJ pre-events + 17 cat_BL Run: 1 Lumi: 1 + 18 cat_BL Run: 1 Lumi: 1 + 19 cat_A 1/1 1/2 + 20 cat_A 1/1 1/2 + 21 cat_A 1/1 1/2 + 22 cat_A 1/1 1/2 Severity # Occurrences Total Occurrences -------- ------------- ----------------- -Info 10 10 +Info 14 14 Warning 12 12 Error 8 8 diff --git a/FWCore/ServiceRegistry/interface/ActivityRegistry.h b/FWCore/ServiceRegistry/interface/ActivityRegistry.h index 54d70f765959b..8d689d7be6e85 100644 --- a/FWCore/ServiceRegistry/interface/ActivityRegistry.h +++ b/FWCore/ServiceRegistry/interface/ActivityRegistry.h @@ -268,6 +268,48 @@ namespace edm { } AR_WATCH_USING_METHOD_2(watchPostModuleEndStream) + typedef signalslot::Signal PreBeginProcessBlock; + PreBeginProcessBlock preBeginProcessBlockSignal_; + void watchPreBeginProcessBlock(PreBeginProcessBlock::slot_type const& iSlot) { + preBeginProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPreBeginProcessBlock) + + typedef signalslot::Signal PostBeginProcessBlock; + PostBeginProcessBlock postBeginProcessBlockSignal_; + void watchPostBeginProcessBlock(PostBeginProcessBlock::slot_type const& iSlot) { + postBeginProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPostBeginProcessBlock) + + typedef signalslot::Signal PreAccessInputProcessBlock; + PreAccessInputProcessBlock preAccessInputProcessBlockSignal_; + void watchPreAccessInputProcessBlock(PreAccessInputProcessBlock::slot_type const& iSlot) { + preAccessInputProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPreAccessInputProcessBlock) + + typedef signalslot::Signal PostAccessInputProcessBlock; + PostAccessInputProcessBlock postAccessInputProcessBlockSignal_; + void watchPostAccessInputProcessBlock(PostAccessInputProcessBlock::slot_type const& iSlot) { + postAccessInputProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPostAccessInputProcessBlock) + + typedef signalslot::Signal PreEndProcessBlock; + PreEndProcessBlock preEndProcessBlockSignal_; + void watchPreEndProcessBlock(PreEndProcessBlock::slot_type const& iSlot) { + preEndProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPreEndProcessBlock) + + typedef signalslot::Signal PostEndProcessBlock; + PostEndProcessBlock postEndProcessBlockSignal_; + void watchPostEndProcessBlock(PostEndProcessBlock::slot_type const& iSlot) { + postEndProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPostEndProcessBlock) + typedef signalslot::Signal PreGlobalBeginRun; /// signal is emitted after the Run has been created by the InputSource but before any modules have seen the Run PreGlobalBeginRun preGlobalBeginRunSignal_; @@ -293,6 +335,20 @@ namespace edm { } AR_WATCH_USING_METHOD_1(watchPostGlobalEndRun) + typedef signalslot::Signal PreWriteProcessBlock; + PreWriteProcessBlock preWriteProcessBlockSignal_; + void watchPreWriteProcessBlock(PreWriteProcessBlock::slot_type const& iSlot) { + preWriteProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPreWriteProcessBlock) + + typedef signalslot::Signal PostWriteProcessBlock; + PostWriteProcessBlock postWriteProcessBlockSignal_; + void watchPostWriteProcessBlock(PostWriteProcessBlock::slot_type const& iSlot) { + postWriteProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_1(watchPostWriteProcessBlock) + typedef signalslot::Signal PreGlobalWriteRun; PreGlobalWriteRun preGlobalWriteRunSignal_; void watchPreGlobalWriteRun(PreGlobalWriteRun::slot_type const& iSlot) { preGlobalWriteRunSignal_.connect(iSlot); } @@ -782,6 +838,49 @@ namespace edm { } AR_WATCH_USING_METHOD_2(watchPostModuleStreamEndLumi) + typedef signalslot::Signal PreModuleBeginProcessBlock; + PreModuleBeginProcessBlock preModuleBeginProcessBlockSignal_; + void watchPreModuleBeginProcessBlock(PreModuleBeginProcessBlock::slot_type const& iSlot) { + preModuleBeginProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPreModuleBeginProcessBlock) + + typedef signalslot::Signal PostModuleBeginProcessBlock; + PostModuleBeginProcessBlock postModuleBeginProcessBlockSignal_; + void watchPostModuleBeginProcessBlock(PostModuleBeginProcessBlock::slot_type const& iSlot) { + postModuleBeginProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPostModuleBeginProcessBlock) + + typedef signalslot::Signal PreModuleAccessInputProcessBlock; + PreModuleAccessInputProcessBlock preModuleAccessInputProcessBlockSignal_; + void watchPreModuleAccessInputProcessBlock(PreModuleAccessInputProcessBlock::slot_type const& iSlot) { + preModuleAccessInputProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPreModuleAccessInputProcessBlock) + + typedef signalslot::Signal + PostModuleAccessInputProcessBlock; + PostModuleAccessInputProcessBlock postModuleAccessInputProcessBlockSignal_; + void watchPostModuleAccessInputProcessBlock(PostModuleAccessInputProcessBlock::slot_type const& iSlot) { + postModuleAccessInputProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPostModuleAccessInputProcessBlock) + + typedef signalslot::Signal PreModuleEndProcessBlock; + PreModuleEndProcessBlock preModuleEndProcessBlockSignal_; + void watchPreModuleEndProcessBlock(PreModuleEndProcessBlock::slot_type const& iSlot) { + preModuleEndProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPreModuleEndProcessBlock) + + typedef signalslot::Signal PostModuleEndProcessBlock; + PostModuleEndProcessBlock postModuleEndProcessBlockSignal_; + void watchPostModuleEndProcessBlock(PostModuleEndProcessBlock::slot_type const& iSlot) { + postModuleEndProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPostModuleEndProcessBlock) + typedef signalslot::Signal PreModuleGlobalBeginRun; PreModuleGlobalBeginRun preModuleGlobalBeginRunSignal_; void watchPreModuleGlobalBeginRun(PreModuleGlobalBeginRun::slot_type const& iSlot) { @@ -838,6 +937,20 @@ namespace edm { } AR_WATCH_USING_METHOD_2(watchPostModuleGlobalEndLumi) + typedef signalslot::Signal PreModuleWriteProcessBlock; + PreModuleWriteProcessBlock preModuleWriteProcessBlockSignal_; + void watchPreModuleWriteProcessBlock(PreModuleWriteProcessBlock::slot_type const& iSlot) { + preModuleWriteProcessBlockSignal_.connect(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPreModuleWriteProcessBlock) + + typedef signalslot::Signal PostModuleWriteProcessBlock; + PostModuleWriteProcessBlock postModuleWriteProcessBlockSignal_; + void watchPostModuleWriteProcessBlock(PostModuleWriteProcessBlock::slot_type const& iSlot) { + postModuleWriteProcessBlockSignal_.connect_front(iSlot); + } + AR_WATCH_USING_METHOD_2(watchPostModuleWriteProcessBlock) + typedef signalslot::Signal PreModuleWriteRun; PreModuleWriteRun preModuleWriteRunSignal_; void watchPreModuleWriteRun(PreModuleWriteRun::slot_type const& iSlot) { preModuleWriteRunSignal_.connect(iSlot); } diff --git a/FWCore/ServiceRegistry/interface/GlobalContext.h b/FWCore/ServiceRegistry/interface/GlobalContext.h index b8b14b99b8dd4..d88077b332a4c 100644 --- a/FWCore/ServiceRegistry/interface/GlobalContext.h +++ b/FWCore/ServiceRegistry/interface/GlobalContext.h @@ -30,11 +30,15 @@ namespace edm { public: enum class Transition { kBeginJob, + kBeginProcessBlock, + kAccessInputProcessBlock, kBeginRun, kBeginLuminosityBlock, kEndLuminosityBlock, kEndRun, + kEndProcessBlock, kEndJob, + kWriteProcessBlock, kWriteRun, kWriteLuminosityBlock }; @@ -49,7 +53,8 @@ namespace edm { Transition transition() const { return transition_; } bool isAtEndTransition() const { return transition() == Transition::kEndLuminosityBlock or transition() == Transition::kEndRun or - transition() == Transition::kWriteRun or transition() == Transition::kWriteLuminosityBlock; + transition() == Transition::kEndProcessBlock or transition() == Transition::kWriteRun or + transition() == Transition::kWriteLuminosityBlock or transition() == Transition::kWriteProcessBlock; } LuminosityBlockID const& luminosityBlockID() const { return luminosityBlockID_; } diff --git a/FWCore/ServiceRegistry/src/ActivityRegistry.cc b/FWCore/ServiceRegistry/src/ActivityRegistry.cc index 08cf44852ff04..0e3c764445afc 100644 --- a/FWCore/ServiceRegistry/src/ActivityRegistry.cc +++ b/FWCore/ServiceRegistry/src/ActivityRegistry.cc @@ -128,12 +128,24 @@ namespace edm { preModuleEndStreamSignal_.connect(std::cref(iOther.preModuleEndStreamSignal_)); postModuleEndStreamSignal_.connect(std::cref(iOther.postModuleEndStreamSignal_)); + preBeginProcessBlockSignal_.connect(std::cref(iOther.preBeginProcessBlockSignal_)); + postBeginProcessBlockSignal_.connect(std::cref(iOther.postBeginProcessBlockSignal_)); + + preAccessInputProcessBlockSignal_.connect(std::cref(iOther.preAccessInputProcessBlockSignal_)); + postAccessInputProcessBlockSignal_.connect(std::cref(iOther.postAccessInputProcessBlockSignal_)); + + preEndProcessBlockSignal_.connect(std::cref(iOther.preEndProcessBlockSignal_)); + postEndProcessBlockSignal_.connect(std::cref(iOther.postEndProcessBlockSignal_)); + preGlobalBeginRunSignal_.connect(std::cref(iOther.preGlobalBeginRunSignal_)); postGlobalBeginRunSignal_.connect(std::cref(iOther.postGlobalBeginRunSignal_)); preGlobalEndRunSignal_.connect(std::cref(iOther.preGlobalEndRunSignal_)); postGlobalEndRunSignal_.connect(std::cref(iOther.postGlobalEndRunSignal_)); + preWriteProcessBlockSignal_.connect(std::cref(iOther.preWriteProcessBlockSignal_)); + postWriteProcessBlockSignal_.connect(std::cref(iOther.postWriteProcessBlockSignal_)); + preGlobalWriteRunSignal_.connect(std::cref(iOther.preGlobalWriteRunSignal_)); postGlobalWriteRunSignal_.connect(std::cref(iOther.postGlobalWriteRunSignal_)); @@ -230,6 +242,15 @@ namespace edm { preModuleStreamEndLumiSignal_.connect(std::cref(iOther.preModuleStreamEndLumiSignal_)); postModuleStreamEndLumiSignal_.connect(std::cref(iOther.postModuleStreamEndLumiSignal_)); + preModuleBeginProcessBlockSignal_.connect(std::cref(iOther.preModuleBeginProcessBlockSignal_)); + postModuleBeginProcessBlockSignal_.connect(std::cref(iOther.postModuleBeginProcessBlockSignal_)); + + preModuleAccessInputProcessBlockSignal_.connect(std::cref(iOther.preModuleAccessInputProcessBlockSignal_)); + postModuleAccessInputProcessBlockSignal_.connect(std::cref(iOther.postModuleAccessInputProcessBlockSignal_)); + + preModuleEndProcessBlockSignal_.connect(std::cref(iOther.preModuleEndProcessBlockSignal_)); + postModuleEndProcessBlockSignal_.connect(std::cref(iOther.postModuleEndProcessBlockSignal_)); + preModuleGlobalBeginRunSignal_.connect(std::cref(iOther.preModuleGlobalBeginRunSignal_)); postModuleGlobalBeginRunSignal_.connect(std::cref(iOther.postModuleGlobalBeginRunSignal_)); @@ -242,6 +263,9 @@ namespace edm { preModuleGlobalEndLumiSignal_.connect(std::cref(iOther.preModuleGlobalEndLumiSignal_)); postModuleGlobalEndLumiSignal_.connect(std::cref(iOther.postModuleGlobalEndLumiSignal_)); + preModuleWriteProcessBlockSignal_.connect(std::cref(iOther.preModuleWriteProcessBlockSignal_)); + postModuleWriteProcessBlockSignal_.connect(std::cref(iOther.postModuleWriteProcessBlockSignal_)); + preModuleWriteRunSignal_.connect(std::cref(iOther.preModuleWriteRunSignal_)); postModuleWriteRunSignal_.connect(std::cref(iOther.postModuleWriteRunSignal_)); @@ -304,12 +328,24 @@ namespace edm { copySlotsToFrom(preModuleEndStreamSignal_, iOther.preModuleEndStreamSignal_); copySlotsToFromReverse(postModuleEndStreamSignal_, iOther.postModuleEndStreamSignal_); + copySlotsToFrom(preBeginProcessBlockSignal_, iOther.preBeginProcessBlockSignal_); + copySlotsToFromReverse(postBeginProcessBlockSignal_, iOther.postBeginProcessBlockSignal_); + + copySlotsToFrom(preAccessInputProcessBlockSignal_, iOther.preAccessInputProcessBlockSignal_); + copySlotsToFromReverse(postAccessInputProcessBlockSignal_, iOther.postAccessInputProcessBlockSignal_); + + copySlotsToFrom(preEndProcessBlockSignal_, iOther.preEndProcessBlockSignal_); + copySlotsToFromReverse(postEndProcessBlockSignal_, iOther.postEndProcessBlockSignal_); + copySlotsToFrom(preGlobalBeginRunSignal_, iOther.preGlobalBeginRunSignal_); copySlotsToFromReverse(postGlobalBeginRunSignal_, iOther.postGlobalBeginRunSignal_); copySlotsToFrom(preGlobalEndRunSignal_, iOther.preGlobalEndRunSignal_); copySlotsToFromReverse(postGlobalEndRunSignal_, iOther.postGlobalEndRunSignal_); + copySlotsToFrom(preWriteProcessBlockSignal_, iOther.preWriteProcessBlockSignal_); + copySlotsToFromReverse(postWriteProcessBlockSignal_, iOther.postWriteProcessBlockSignal_); + copySlotsToFrom(preGlobalWriteRunSignal_, iOther.preGlobalWriteRunSignal_); copySlotsToFromReverse(postGlobalWriteRunSignal_, iOther.postGlobalWriteRunSignal_); @@ -411,6 +447,15 @@ namespace edm { copySlotsToFrom(preModuleStreamEndLumiSignal_, iOther.preModuleStreamEndLumiSignal_); copySlotsToFromReverse(postModuleStreamEndLumiSignal_, iOther.postModuleStreamEndLumiSignal_); + copySlotsToFrom(preModuleBeginProcessBlockSignal_, iOther.preModuleBeginProcessBlockSignal_); + copySlotsToFromReverse(postModuleBeginProcessBlockSignal_, iOther.postModuleBeginProcessBlockSignal_); + + copySlotsToFrom(preModuleAccessInputProcessBlockSignal_, iOther.preModuleAccessInputProcessBlockSignal_); + copySlotsToFromReverse(postModuleAccessInputProcessBlockSignal_, iOther.postModuleAccessInputProcessBlockSignal_); + + copySlotsToFrom(preModuleEndProcessBlockSignal_, iOther.preModuleEndProcessBlockSignal_); + copySlotsToFromReverse(postModuleEndProcessBlockSignal_, iOther.postModuleEndProcessBlockSignal_); + copySlotsToFrom(preModuleGlobalBeginRunSignal_, iOther.preModuleGlobalBeginRunSignal_); copySlotsToFromReverse(postModuleGlobalBeginRunSignal_, iOther.postModuleGlobalBeginRunSignal_); @@ -423,6 +468,9 @@ namespace edm { copySlotsToFrom(preModuleGlobalEndLumiSignal_, iOther.preModuleGlobalEndLumiSignal_); copySlotsToFromReverse(postModuleGlobalEndLumiSignal_, iOther.postModuleGlobalEndLumiSignal_); + copySlotsToFrom(preModuleWriteProcessBlockSignal_, iOther.preModuleWriteProcessBlockSignal_); + copySlotsToFromReverse(postModuleWriteProcessBlockSignal_, iOther.postModuleWriteProcessBlockSignal_); + copySlotsToFrom(preModuleWriteRunSignal_, iOther.preModuleWriteRunSignal_); copySlotsToFromReverse(postModuleWriteRunSignal_, iOther.postModuleWriteRunSignal_); diff --git a/FWCore/ServiceRegistry/src/GlobalContext.cc b/FWCore/ServiceRegistry/src/GlobalContext.cc index 0c3ad08b6dae0..db300d856fbd7 100644 --- a/FWCore/ServiceRegistry/src/GlobalContext.cc +++ b/FWCore/ServiceRegistry/src/GlobalContext.cc @@ -24,6 +24,12 @@ namespace edm { case GlobalContext::Transition::kBeginJob: os << "BeginJob"; break; + case GlobalContext::Transition::kBeginProcessBlock: + os << "BeginProcessBlock"; + break; + case GlobalContext::Transition::kAccessInputProcessBlock: + os << "AccessInputProcessBlock"; + break; case GlobalContext::Transition::kBeginRun: os << "BeginRun"; break; @@ -36,9 +42,15 @@ namespace edm { case GlobalContext::Transition::kEndRun: os << "EndRun"; break; + case GlobalContext::Transition::kEndProcessBlock: + os << "EndProcessBlock"; + break; case GlobalContext::Transition::kEndJob: os << "EndJob"; break; + case GlobalContext::Transition::kWriteProcessBlock: + os << "WriteProcessBlock"; + break; case GlobalContext::Transition::kWriteRun: os << "WriteRun"; break; @@ -62,6 +74,12 @@ namespace edm { case GlobalContext::Transition::kBeginJob: os << "begin Job"; break; + case GlobalContext::Transition::kBeginProcessBlock: + os << "begin ProcessBlock"; + break; + case GlobalContext::Transition::kAccessInputProcessBlock: + os << "access input ProcessBlock"; + break; case GlobalContext::Transition::kBeginRun: os << "global begin Run " << RunID(gc.luminosityBlockID().run()); break; @@ -74,9 +92,15 @@ namespace edm { case GlobalContext::Transition::kEndRun: os << "global end Run " << RunID(gc.luminosityBlockID().run()); break; + case GlobalContext::Transition::kEndProcessBlock: + os << "end ProcessBlock"; + break; case GlobalContext::Transition::kEndJob: os << "endJob"; break; + case GlobalContext::Transition::kWriteProcessBlock: + os << "write ProcessBlock "; + break; case GlobalContext::Transition::kWriteRun: os << "write Run " << RunID(gc.luminosityBlockID().run()); break; diff --git a/FWCore/Services/plugins/Tracer.cc b/FWCore/Services/plugins/Tracer.cc index a643a9c097d19..7d7c86ebd0fad 100644 --- a/FWCore/Services/plugins/Tracer.cc +++ b/FWCore/Services/plugins/Tracer.cc @@ -96,6 +96,18 @@ namespace edm { void preModuleEndStream(StreamContext const&, ModuleCallingContext const&); void postModuleEndStream(StreamContext const&, ModuleCallingContext const&); + void preBeginProcessBlock(GlobalContext const&); + void postBeginProcessBlock(GlobalContext const&); + + void preAccessInputProcessBlock(GlobalContext const&); + void postAccessInputProcessBlock(GlobalContext const&); + + void preEndProcessBlock(GlobalContext const&); + void postEndProcessBlock(GlobalContext const&); + + void preWriteProcessBlock(GlobalContext const&); + void postWriteProcessBlock(GlobalContext const&); + void preGlobalBeginRun(GlobalContext const&); void postGlobalBeginRun(GlobalContext const&); @@ -162,6 +174,13 @@ namespace edm { void preModuleStreamEndLumi(StreamContext const&, ModuleCallingContext const&); void postModuleStreamEndLumi(StreamContext const&, ModuleCallingContext const&); + void preModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&); void postModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&); void preModuleGlobalEndRun(GlobalContext const&, ModuleCallingContext const&); @@ -172,6 +191,9 @@ namespace edm { void preModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&); void postModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&); + void preModuleWriteProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void postModuleWriteProcessBlock(GlobalContext const&, ModuleCallingContext const&); + void preModuleWriteRun(GlobalContext const&, ModuleCallingContext const&); void postModuleWriteRun(GlobalContext const&, ModuleCallingContext const&); @@ -249,6 +271,18 @@ Tracer::Tracer(ParameterSet const& iPS, ActivityRegistry& iRegistry) iRegistry.watchPreModuleEndStream(this, &Tracer::preModuleEndStream); iRegistry.watchPostModuleEndStream(this, &Tracer::postModuleEndStream); + iRegistry.watchPreBeginProcessBlock(this, &Tracer::preBeginProcessBlock); + iRegistry.watchPostBeginProcessBlock(this, &Tracer::postBeginProcessBlock); + + iRegistry.watchPreAccessInputProcessBlock(this, &Tracer::preAccessInputProcessBlock); + iRegistry.watchPostAccessInputProcessBlock(this, &Tracer::postAccessInputProcessBlock); + + iRegistry.watchPreEndProcessBlock(this, &Tracer::preEndProcessBlock); + iRegistry.watchPostEndProcessBlock(this, &Tracer::postEndProcessBlock); + + iRegistry.watchPreWriteProcessBlock(this, &Tracer::preWriteProcessBlock); + iRegistry.watchPostWriteProcessBlock(this, &Tracer::postWriteProcessBlock); + iRegistry.watchPreGlobalBeginRun(this, &Tracer::preGlobalBeginRun); iRegistry.watchPostGlobalBeginRun(this, &Tracer::postGlobalBeginRun); @@ -315,6 +349,13 @@ Tracer::Tracer(ParameterSet const& iPS, ActivityRegistry& iRegistry) iRegistry.watchPreModuleStreamEndLumi(this, &Tracer::preModuleStreamEndLumi); iRegistry.watchPostModuleStreamEndLumi(this, &Tracer::postModuleStreamEndLumi); + iRegistry.watchPreModuleBeginProcessBlock(this, &Tracer::preModuleBeginProcessBlock); + iRegistry.watchPostModuleBeginProcessBlock(this, &Tracer::postModuleBeginProcessBlock); + iRegistry.watchPreModuleAccessInputProcessBlock(this, &Tracer::preModuleAccessInputProcessBlock); + iRegistry.watchPostModuleAccessInputProcessBlock(this, &Tracer::postModuleAccessInputProcessBlock); + iRegistry.watchPreModuleEndProcessBlock(this, &Tracer::preModuleEndProcessBlock); + iRegistry.watchPostModuleEndProcessBlock(this, &Tracer::postModuleEndProcessBlock); + iRegistry.watchPreModuleGlobalBeginRun(this, &Tracer::preModuleGlobalBeginRun); iRegistry.watchPostModuleGlobalBeginRun(this, &Tracer::postModuleGlobalBeginRun); iRegistry.watchPreModuleGlobalEndRun(this, &Tracer::preModuleGlobalEndRun); @@ -325,6 +366,9 @@ Tracer::Tracer(ParameterSet const& iPS, ActivityRegistry& iRegistry) iRegistry.watchPreModuleGlobalEndLumi(this, &Tracer::preModuleGlobalEndLumi); iRegistry.watchPostModuleGlobalEndLumi(this, &Tracer::postModuleGlobalEndLumi); + iRegistry.watchPreModuleWriteProcessBlock(this, &Tracer::preModuleWriteProcessBlock); + iRegistry.watchPostModuleWriteProcessBlock(this, &Tracer::postModuleWriteProcessBlock); + iRegistry.watchPreModuleWriteRun(this, &Tracer::preModuleWriteRun); iRegistry.watchPostModuleWriteRun(this, &Tracer::postModuleWriteRun); @@ -455,7 +499,8 @@ void Tracer::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, } out << "All modules (listed by class and label) and all their consumed products.\n"; out << "Consumed products are listed by type, label, instance, process.\n"; - out << "For products not in the event, \'run\' or \'lumi\' is added to indicate the TTree they are from.\n"; + out << "For products not in the event, \'processBlock\', \'run\' or \'lumi\' is added to indicate the TTree they " + "are from.\n"; out << "For products that are declared with mayConsume, \'may consume\' is added.\n"; out << "For products consumed for Views, \'element type\' is added\n"; out << "For products only read from previous processes, \'skip current process\' is added\n"; @@ -471,6 +516,8 @@ void Tracer::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, out << ", lumi"; } else if (info.branchType() == InRun) { out << ", run"; + } else if (info.branchType() == InProcess) { + out << ", processBlock"; } if (!info.alwaysGets()) { out << ", may consume"; @@ -601,6 +648,70 @@ void Tracer::postModuleEndStream(StreamContext const& sc, ModuleCallingContext c } } +void Tracer::preBeginProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " starting: begin process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::postBeginProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " finished: begin process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::preAccessInputProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " starting: access input process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::postAccessInputProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " finished: access input process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::preEndProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " starting: end process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::postEndProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " finished: end process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::preWriteProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " starting: write process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + +void Tracer::postWriteProcessBlock(GlobalContext const& gc) { + LogAbsolute out("Tracer"); + out << indention_ << indention_ << " finished: write process block"; + if (dumpNonModuleContext_) { + out << "\n" << gc; + } +} + void Tracer::preGlobalBeginRun(GlobalContext const& gc) { LogAbsolute out("Tracer"); out << TimeStamper(printTimestamps_); @@ -1163,6 +1274,90 @@ void Tracer::postModuleStreamEndLumi(StreamContext const& sc, ModuleCallingConte } } +void Tracer::preModuleBeginProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " starting: begin process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + +void Tracer::postModuleBeginProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " finished: begin process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + +void Tracer::preModuleAccessInputProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " starting: access input process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + +void Tracer::postModuleAccessInputProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " finished: access input process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + +void Tracer::preModuleEndProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " starting: end process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + +void Tracer::postModuleEndProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " finished: end process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + void Tracer::preModuleGlobalBeginRun(GlobalContext const& gc, ModuleCallingContext const& mcc) { LogAbsolute out("Tracer"); out << TimeStamper(printTimestamps_); @@ -1283,6 +1478,34 @@ void Tracer::postModuleGlobalEndLumi(GlobalContext const& gc, ModuleCallingConte } } +void Tracer::preModuleWriteProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " starting: write process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + +void Tracer::postModuleWriteProcessBlock(GlobalContext const& gc, ModuleCallingContext const& mcc) { + LogAbsolute out("Tracer"); + unsigned int nIndents = mcc.depth() + 3; + for (unsigned int i = 0; i < nIndents; ++i) { + out << indention_; + } + out << " finished: write process block for module: label = '" << mcc.moduleDescription()->moduleLabel() + << "' id = " << mcc.moduleDescription()->id(); + if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) { + out << "\n" << gc; + out << mcc; + } +} + void Tracer::preModuleWriteRun(GlobalContext const& gc, ModuleCallingContext const& mcc) { LogAbsolute out("Tracer"); out << TimeStamper(printTimestamps_); diff --git a/FWCore/TestProcessor/interface/ProcessBlock.h b/FWCore/TestProcessor/interface/ProcessBlock.h new file mode 100644 index 0000000000000..8ead7f443262d --- /dev/null +++ b/FWCore/TestProcessor/interface/ProcessBlock.h @@ -0,0 +1,62 @@ +#ifndef FWCore_TestProcessor_ProcessBlock_h +#define FWCore_TestProcessor_ProcessBlock_h +// -*- C++ -*- +// +// Package: FWCore/TestProcessor +// Class : ProcessBlock +// +/**\class edm::test::ProcessBlock + + Description: [one line class summary] + + Usage: + + +*/ +// +// Original Author: W. David Dagenhart +// Created: 28 May 2020 +// + +#include + +#include "FWCore/TestProcessor/interface/TestHandle.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" +#include "FWCore/Utilities/interface/TypeID.h" + +namespace edm { + + namespace test { + + class ProcessBlock { + public: + ProcessBlock(ProcessBlockPrincipal const* iPrincipal, std::string iModuleLabel, std::string iProcessName); + + template + TestHandle get() const { + static const std::string s_null; + return get(s_null); + } + + template + TestHandle get(std::string const& iInstanceLabel) const { + auto h = principal_->getByLabel( + edm::PRODUCT_TYPE, edm::TypeID(typeid(T)), label_, iInstanceLabel, processName_, nullptr, nullptr, nullptr); + if (h.failedToGet()) { + return TestHandle(std::move(h.whyFailedFactory())); + } + void const* basicWrapper = h.wrapper(); + assert(basicWrapper); + Wrapper const* wrapper = static_cast const*>(basicWrapper); + return TestHandle(wrapper->product()); + } + + private: + ProcessBlockPrincipal const* principal_; + std::string label_; + std::string processName_; + }; + } // namespace test +} // namespace edm + +#endif diff --git a/FWCore/TestProcessor/interface/TestProcessor.h b/FWCore/TestProcessor/interface/TestProcessor.h index fc848418b60ee..ee5f17fc2dfe1 100644 --- a/FWCore/TestProcessor/interface/TestProcessor.h +++ b/FWCore/TestProcessor/interface/TestProcessor.h @@ -43,6 +43,7 @@ #include "FWCore/TestProcessor/interface/Event.h" #include "FWCore/TestProcessor/interface/LuminosityBlock.h" +#include "FWCore/TestProcessor/interface/ProcessBlock.h" #include "FWCore/TestProcessor/interface/Run.h" #include "FWCore/TestProcessor/interface/TestDataProxy.h" #include "FWCore/TestProcessor/interface/ESPutTokenT.h" @@ -156,6 +157,8 @@ namespace edm { using Config = TestProcessorConfig; TestProcessor(Config const& iConfig, ServiceToken iToken = ServiceToken()); + TestProcessor(const TestProcessor&) = delete; + const TestProcessor& operator=(const TestProcessor&) = delete; ~TestProcessor() noexcept(false); /** Run the test. The function arguments are the data products to be added to the @@ -184,6 +187,14 @@ namespace edm { return testEndRunImpl(std::forward(iArgs)...); } + // It makes no sense to pass EventSetup products and at least + // for now Runs, Lumis, and ProcessBlocks don't allow passing + // in other products. So for now these don't need to be templates + // for ProcessBlock. + edm::test::ProcessBlock testBeginProcessBlock() { return testBeginProcessBlockImpl(); } + + edm::test::ProcessBlock testEndProcessBlock() { return testEndProcessBlockImpl(); } + /** Run only beginJob and endJob. Once this is used, you should not attempt to run any further tests. This simulates a problem happening early in the job which causes processing not to proceed. */ @@ -192,19 +203,30 @@ This simulates a problem happening early in the job which causes processing not endJob(); } + void testWithNoRuns() { + beginJob(); + beginProcessBlock(); + endProcessBlock(); + endJob(); + } + void testRunWithNoLuminosityBlocks() { beginJob(); + beginProcessBlock(); beginRun(); endRun(); + endProcessBlock(); endJob(); } void testLuminosityBlockWithNoEvents() { beginJob(); + beginProcessBlock(); beginRun(); beginLuminosityBlock(); endLuminosityBlock(); endRun(); + endProcessBlock(); endJob(); } void setRunNumber(edm::RunNumber_t); @@ -214,10 +236,6 @@ This simulates a problem happening early in the job which causes processing not std::string const& labelOfTestModule() const { return labelOfTestModule_; } private: - TestProcessor(const TestProcessor&) = delete; // stop default - - const TestProcessor& operator=(const TestProcessor&) = delete; // stop default - template edm::test::Event testImpl(std::pair, std::unique_ptr>&& iPut, U&&... iArgs) { put(std::move(iPut)); @@ -278,15 +296,20 @@ This simulates a problem happening early in the job which causes processing not } edm::test::Run testEndRunImpl(); + edm::test::ProcessBlock testBeginProcessBlockImpl(); + edm::test::ProcessBlock testEndProcessBlockImpl(); + void setupProcessing(); void teardownProcessing(); void beginJob(); + void beginProcessBlock(); void beginRun(); void beginLuminosityBlock(); void event(); std::shared_ptr endLuminosityBlock(); std::shared_ptr endRun(); + ProcessBlockPrincipal const* endProcessBlock(); void endJob(); // ---------- member data -------------------------------- @@ -320,6 +343,7 @@ This simulates a problem happening early in the job which causes processing not LuminosityBlockNumber_t lumiNumber_ = 1; EventNumber_t eventNumber_ = 1; bool beginJobCalled_ = false; + bool beginProcessBlockCalled_ = false; bool beginRunCalled_ = false; bool beginLumiCalled_ = false; }; diff --git a/FWCore/TestProcessor/src/ProcessBlock.cc b/FWCore/TestProcessor/src/ProcessBlock.cc new file mode 100644 index 0000000000000..f488a7e42908c --- /dev/null +++ b/FWCore/TestProcessor/src/ProcessBlock.cc @@ -0,0 +1,24 @@ +// -*- C++ -*- +// +// Package: FWCore/TestProcessor +// Class : ProcessBlock +// +// Implementation: +// [Notes on implementation] +// +// Original Author: W. David Dagenhart +// Created: 28 May 2020 +// + +#include "FWCore/TestProcessor/interface/ProcessBlock.h" + +namespace edm { + namespace test { + + ProcessBlock::ProcessBlock(ProcessBlockPrincipal const* iPrincipal, + std::string iModuleLabel, + std::string iProcessName) + : principal_{iPrincipal}, label_{std::move(iModuleLabel)}, processName_{std::move(iProcessName)} {} + + } // namespace test +} // namespace edm diff --git a/FWCore/TestProcessor/src/TestProcessor.cc b/FWCore/TestProcessor/src/TestProcessor.cc index 813628b64a37f..e6a18e1417ce8 100644 --- a/FWCore/TestProcessor/src/TestProcessor.cc +++ b/FWCore/TestProcessor/src/TestProcessor.cc @@ -19,6 +19,7 @@ #include "FWCore/Framework/interface/ScheduleItems.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" +#include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Framework/interface/ExceptionActions.h" #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/Framework/interface/PathsAndConsumesOfModules.h" @@ -191,6 +192,10 @@ namespace edm { std::make_unique(preg_, *processConfiguration_, historyAppender_.get(), index); principalCache_.insert(std::move(lp)); } + { + auto pb = std::make_unique(preg_, *processConfiguration_); + principalCache_.insert(std::move(pb)); + } } TestProcessor::~TestProcessor() noexcept(false) { teardownProcessing(); } @@ -225,6 +230,9 @@ namespace edm { if (not beginJobCalled_) { beginJob(); } + if (not beginProcessBlockCalled_) { + beginProcessBlock(); + } if (not beginRunCalled_) { beginRun(); } @@ -247,6 +255,9 @@ namespace edm { if (not beginJobCalled_) { beginJob(); } + if (not beginProcessBlockCalled_) { + beginProcessBlock(); + } if (not beginRunCalled_) { beginRun(); } @@ -267,7 +278,9 @@ namespace edm { if (not beginJobCalled_) { beginJob(); } - + if (not beginProcessBlockCalled_) { + beginProcessBlock(); + } if (beginRunCalled_) { assert(runNumber_ != iNum); endRun(); @@ -287,6 +300,9 @@ namespace edm { if (not beginJobCalled_) { beginJob(); } + if (not beginProcessBlockCalled_) { + beginProcessBlock(); + } if (not beginRunCalled_) { beginRun(); } @@ -300,10 +316,32 @@ namespace edm { return edm::test::Run(rp, labelOfTestModule_, processConfiguration_->processName()); } + edm::test::ProcessBlock TestProcessor::testBeginProcessBlockImpl() { + if (not beginJobCalled_) { + beginJob(); + } + beginProcessBlock(); + return edm::test::ProcessBlock( + &principalCache_.processBlockPrincipal(), labelOfTestModule_, processConfiguration_->processName()); + } + edm::test::ProcessBlock TestProcessor::testEndProcessBlockImpl() { + if (not beginJobCalled_) { + beginJob(); + } + if (not beginProcessBlockCalled_) { + beginProcessBlock(); + } + auto pbp = endProcessBlock(); + return edm::test::ProcessBlock(pbp, labelOfTestModule_, processConfiguration_->processName()); + } + void TestProcessor::setupProcessing() { if (not beginJobCalled_) { beginJob(); } + if (not beginProcessBlockCalled_) { + beginProcessBlock(); + } if (not beginRunCalled_) { beginRun(); } @@ -321,6 +359,10 @@ namespace edm { endRun(); beginRunCalled_ = false; } + if (beginProcessBlockCalled_) { + endProcessBlock(); + beginProcessBlockCalled_ = false; + } if (beginJobCalled_) { endJob(); } @@ -356,6 +398,27 @@ namespace edm { beginJobCalled_ = true; } + void TestProcessor::beginProcessBlock() { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName()); + + std::vector emptyList; + { + typedef OccurrenceTraits Traits; + auto globalWaitTask = make_empty_waiting_task(); + globalWaitTask->increment_ref_count(); + + beginGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, processBlockPrincipal, serviceToken_, emptyList); + + globalWaitTask->wait_for_all(); + if (globalWaitTask->exceptionPtr() != nullptr) { + std::rethrow_exception(*(globalWaitTask->exceptionPtr())); + } + } + beginProcessBlockCalled_ = true; + } + void TestProcessor::beginRun() { ProcessHistoryID phid; auto aux = std::make_shared(runNumber_, Timestamp(), Timestamp()); @@ -631,7 +694,38 @@ namespace edm { return rp; } + ProcessBlockPrincipal const* TestProcessor::endProcessBlock() { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + if (beginProcessBlockCalled_) { + beginProcessBlockCalled_ = false; + + std::vector emptyList; + { + auto globalWaitTask = make_empty_waiting_task(); + globalWaitTask->increment_ref_count(); + + typedef OccurrenceTraits Traits; + endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), + *schedule_, + processBlockPrincipal, + serviceToken_, + emptyList, + false); + globalWaitTask->wait_for_all(); + if (globalWaitTask->exceptionPtr() != nullptr) { + std::rethrow_exception(*(globalWaitTask->exceptionPtr())); + } + } + } + return &processBlockPrincipal; + } + void TestProcessor::endJob() { + if (!beginJobCalled_) { + return; + } + beginJobCalled_ = false; + // Collects exceptions, so we don't throw before all operations are performed. ExceptionCollector c( "Multiple exceptions were thrown while executing endJob. An exception message follows for each.\n"); @@ -666,13 +760,5 @@ namespace edm { void TestProcessor::setEventNumber(edm::EventNumber_t iEv) { eventNumber_ = iEv; } - // - // const member functions - // - - // - // static member functions - // - } // namespace test } // namespace edm diff --git a/FWCore/TestProcessor/test/testprocessor_t.cppunit.cc b/FWCore/TestProcessor/test/testprocessor_t.cppunit.cc index 703cc12a93d92..d8c10be6519b0 100644 --- a/FWCore/TestProcessor/test/testprocessor_t.cppunit.cc +++ b/FWCore/TestProcessor/test/testprocessor_t.cppunit.cc @@ -38,8 +38,11 @@ class testTestProcessor : public CppUnit::TestFixture { CPPUNIT_TEST(eventSetupPutTest); CPPUNIT_TEST(lumiTest); CPPUNIT_TEST(taskTest); + CPPUNIT_TEST(emptyProcessBlockTest); CPPUNIT_TEST(emptyRunTest); CPPUNIT_TEST(emptyLumiTest); + CPPUNIT_TEST(processBlockProductTest); + CPPUNIT_TEST(processBlockEndProductTest); CPPUNIT_TEST(runProductTest); CPPUNIT_TEST(lumiProductTest); @@ -57,8 +60,11 @@ class testTestProcessor : public CppUnit::TestFixture { void eventSetupPutTest(); void lumiTest(); void taskTest(); + void emptyProcessBlockTest(); void emptyRunTest(); void emptyLumiTest(); + void processBlockProductTest(); + void processBlockEndProductTest(); void runProductTest(); void lumiProductTest(); @@ -240,6 +246,19 @@ void testTestProcessor::taskTest() { } } +void testTestProcessor::emptyProcessBlockTest() { + auto const kTest = R"_(from FWCore.TestProcessor.TestProcess import * +process = TestProcess() +process.toTest = cms.EDAnalyzer('RunLumiEventChecker', + eventSequence = cms.untracked.VEventID() + ) +process.moduleToTest(process.toTest) +)_"; + edm::test::TestProcessor::Config config(kTest); + edm::test::TestProcessor tester(config); + + tester.testWithNoRuns(); +} void testTestProcessor::emptyRunTest() { auto const kTest = R"_(from FWCore.TestProcessor.TestProcess import * process = TestProcess() @@ -270,6 +289,44 @@ process.moduleToTest(process.toTest) tester.testLuminosityBlockWithNoEvents(); } +void testTestProcessor::processBlockProductTest() { + auto const kTest = R"_(from FWCore.TestProcessor.TestProcess import * +process = TestProcess() +process.intProducerBeginProcessBlock = cms.EDProducer("IntProducerBeginProcessBlock", ivalue = cms.int32(10000)) +process.moduleToTest(process.intProducerBeginProcessBlock) +)_"; + edm::test::TestProcessor::Config config(kTest); + + edm::test::TestProcessor tester(config); + { + auto processBlock = tester.testBeginProcessBlock(); + CPPUNIT_ASSERT(processBlock.get()->value == 10000); + } + { + auto processBlock = tester.testEndProcessBlock(); + CPPUNIT_ASSERT(processBlock.get()->value == 10000); + } +} + +void testTestProcessor::processBlockEndProductTest() { + auto const kTest = R"_(from FWCore.TestProcessor.TestProcess import * +process = TestProcess() +process.intProducerEndProcessBlock = cms.EDProducer("IntProducerEndProcessBlock", ivalue = cms.int32(10001)) +process.moduleToTest(process.intProducerEndProcessBlock) +)_"; + edm::test::TestProcessor::Config config(kTest); + + edm::test::TestProcessor tester(config); + { + auto processBlock = tester.testBeginProcessBlock(); + CPPUNIT_ASSERT_THROW(*processBlock.get(), cms::Exception); + } + { + auto processBlock = tester.testEndProcessBlock(); + CPPUNIT_ASSERT(processBlock.get()->value == 10001); + } +} + void testTestProcessor::runProductTest() { auto const kTest = R"_(from FWCore.TestProcessor.TestProcess import * process = TestProcess() @@ -295,6 +352,7 @@ process.moduleToTest(process.toTest) CPPUNIT_ASSERT(run.get("beginRun")->size() == 20); } } + void testTestProcessor::lumiProductTest() { auto const kTest = R"_(from FWCore.TestProcessor.TestProcess import * process = TestProcess() diff --git a/FWCore/Utilities/interface/BranchType.h b/FWCore/Utilities/interface/BranchType.h index 115634057b242..384e6c35ccb99 100644 --- a/FWCore/Utilities/interface/BranchType.h +++ b/FWCore/Utilities/interface/BranchType.h @@ -1,13 +1,13 @@ #ifndef FWCore_Utilities_BranchType_h #define FWCore_Utilities_BranchType_h /*---------------------------------------------------------------------- - -BranchType: The type of a Branch (Event, LuminosityBlock, or Run) + +BranchType: The type of a Branch (Event, LuminosityBlock, Run, or ProcessBlock) ----------------------------------------------------------------------*/ namespace edm { // Note: These enum values are used as subscripts for a fixed size array, so they must not change. - enum BranchType { InEvent = 0, InLumi = 1, InRun = 2, NumBranchTypes }; + enum BranchType { InEvent = 0, InLumi = 1, InRun = 2, InProcess = 3, NumBranchTypes }; } // namespace edm #endif diff --git a/FWCore/Utilities/interface/ProcessBlockIndex.h b/FWCore/Utilities/interface/ProcessBlockIndex.h new file mode 100644 index 0000000000000..1da23104a2cb9 --- /dev/null +++ b/FWCore/Utilities/interface/ProcessBlockIndex.h @@ -0,0 +1,47 @@ +#ifndef FWCore_Utilities_ProcessBlockIndex_h +#define FWCore_Utilities_ProcessBlockIndex_h +// -*- C++ -*- +// +// Package: FWCore/Utilities +// Class : edm::ProcessBlockIndex +// +/**\class edm::ProcessBlockIndex + + Description: Identifies a ProcessBlock + + Usage: +*/ +// +// Original Author: W. David Dagenhart +// Created: 18 March 2020 + +namespace edm { + class ProcessBlockPrincipal; + + class ProcessBlockIndex { + public: + ~ProcessBlockIndex() = default; + ProcessBlockIndex(const ProcessBlockIndex&) = default; + ProcessBlockIndex& operator=(const ProcessBlockIndex&) = default; + + bool operator==(const ProcessBlockIndex& iIndex) const { return value() == iIndex.value(); } + operator unsigned int() const { return value_; } + + unsigned int value() const { return value_; } + + static ProcessBlockIndex invalidProcessBlockIndex(); + + private: + ///Only the ProcessBlockPrincipal is allowed to make one of these + friend class ProcessBlockPrincipal; + explicit ProcessBlockIndex(unsigned int iIndex) : value_(iIndex) {} + + ProcessBlockIndex() = delete; + + unsigned int value_; + + static const unsigned int invalidValue_; + }; +} // namespace edm + +#endif diff --git a/FWCore/Utilities/interface/Transition.h b/FWCore/Utilities/interface/Transition.h index 014423a1bddbc..8354fb56c5a0a 100644 --- a/FWCore/Utilities/interface/Transition.h +++ b/FWCore/Utilities/interface/Transition.h @@ -1,7 +1,7 @@ #ifndef FWCore_Utilities_Transition_h #define FWCore_Utilities_Transition_h /*---------------------------------------------------------------------- - + Transition: The allowed framework transitions ----------------------------------------------------------------------*/ @@ -9,21 +9,33 @@ Transition: The allowed framework transitions #include namespace edm { - enum class Transition { Event, BeginLuminosityBlock, EndLuminosityBlock, BeginRun, EndRun, NumberOfTransitions }; + enum class Transition { + Event, + BeginLuminosityBlock, + EndLuminosityBlock, + BeginRun, + EndRun, + BeginProcessBlock, + EndProcessBlock, + NumberOfTransitions, + NumberOfEventSetupTransitions = 5 + }; //Useful for converting EndBranchType to BranchType constexpr BranchType convertToBranchType(Transition iValue) { - constexpr BranchType branches[] = {InEvent, InLumi, InLumi, InRun, InRun}; + constexpr BranchType branches[] = {InEvent, InLumi, InLumi, InRun, InRun, InProcess, InProcess}; return branches[static_cast::type>(iValue)]; } constexpr Transition convertToTransition(BranchType iValue) { - constexpr Transition trans[] = {Transition::Event, Transition::BeginLuminosityBlock, Transition::BeginRun}; + constexpr Transition trans[] = { + Transition::Event, Transition::BeginLuminosityBlock, Transition::BeginRun, Transition::BeginProcessBlock}; return trans[iValue]; } constexpr bool isEndTransition(Transition iValue) { - return iValue == Transition::EndLuminosityBlock or iValue == Transition::EndRun; + return iValue == Transition::EndLuminosityBlock or iValue == Transition::EndRun or + iValue == Transition::EndProcessBlock; } } // namespace edm diff --git a/FWCore/Utilities/src/ProcessBlockIndex.cc b/FWCore/Utilities/src/ProcessBlockIndex.cc new file mode 100644 index 0000000000000..6903eafc5c5be --- /dev/null +++ b/FWCore/Utilities/src/ProcessBlockIndex.cc @@ -0,0 +1,10 @@ +#include "FWCore/Utilities/interface/ProcessBlockIndex.h" + +#include + +namespace edm { + + const unsigned int ProcessBlockIndex::invalidValue_ = std::numeric_limits::max(); + + ProcessBlockIndex ProcessBlockIndex::invalidProcessBlockIndex() { return ProcessBlockIndex(invalidValue_); } +} // namespace edm diff --git a/IOPool/Input/src/RootFile.cc b/IOPool/Input/src/RootFile.cc index 36f604160074f..31959b677cffd 100644 --- a/IOPool/Input/src/RootFile.cc +++ b/IOPool/Input/src/RootFile.cc @@ -247,6 +247,7 @@ namespace edm { treePointers_[InEvent] = &eventTree_; treePointers_[InLumi] = &lumiTree_; treePointers_[InRun] = &runTree_; + treePointers_[InProcess] = nullptr; // Read the metadata tree. // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file. @@ -503,6 +504,10 @@ namespace edm { for (auto& product : pList) { BranchDescription& prod = product.second; prod.init(); + if (prod.branchType() == InProcess) { + // ProcessBlock input not implemented yet + continue; + } treePointers_[prod.branchType()]->setPresence(prod, newBranchToOldBranch(prod.branchName())); } @@ -559,12 +564,20 @@ namespace edm { int i = 0; for (auto t : treePointers_) { + if (t == nullptr) { + // ProcessBlock input not implemented yet + continue; + } t->numberOfBranchesToAdd(nBranches[i]); ++i; } } for (auto const& product : prodList) { BranchDescription const& prod = product.second; + if (prod.branchType() == InProcess) { + // ProcessBlock input not implemented yet + continue; + } treePointers_[prod.branchType()]->addBranch(prod, newBranchToOldBranch(prod.branchName())); } @@ -1200,6 +1213,10 @@ namespace edm { // Just to play it safe, zero all pointers to objects in the InputFile to be closed. eventHistoryTree_ = nullptr; for (auto& treePointer : treePointers_) { + if (treePointer == nullptr) { + // ProcessBlock input not implemented yet + continue; + } treePointer->close(); treePointer = nullptr; } @@ -1784,7 +1801,10 @@ namespace edm { << "of file '" << file_ << "' because it is dependent on a branch\n" << "that was explicitly dropped.\n"; } - treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName())); + // ProcessBlock input is not implemented yet + if (prod.branchType() != InProcess) { + treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName())); + } hasNewlyDroppedBranch_[prod.branchType()] = true; } ProductRegistry::ProductList::iterator icopy = it; @@ -1800,7 +1820,7 @@ namespace edm { TString tString; for (ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) { BranchDescription const& prod = it->second; - if (prod.branchType() != InEvent) { + if (prod.branchType() != InEvent && prod.branchType() != InProcess) { TClass* cp = prod.wrappedType().getClass(); void* p = cp->New(); int offset = cp->GetBaseClassOffset(edProductClass_); diff --git a/IOPool/Output/src/PoolOutputModule.cc b/IOPool/Output/src/PoolOutputModule.cc index 10b43fc6c2924..342d123888c07 100644 --- a/IOPool/Output/src/PoolOutputModule.cc +++ b/IOPool/Output/src/PoolOutputModule.cc @@ -246,6 +246,10 @@ namespace edm { void PoolOutputModule::respondToOpenInputFile(FileBlock const& fb) { if (!initializedFromInput_) { for (int i = InEvent; i < NumBranchTypes; ++i) { + if (i == InProcess) { + // ProcessBlock output not implemented yet + continue; + } BranchType branchType = static_cast(i); TTree* theInputTree = (branchType == InEvent ? fb.tree() : (branchType == InLumi ? fb.lumiTree() : fb.runTree())); diff --git a/IOPool/Output/src/RootOutputFile.cc b/IOPool/Output/src/RootOutputFile.cc index 2d5238d79ad5b..284437150a343 100644 --- a/IOPool/Output/src/RootOutputFile.cc +++ b/IOPool/Output/src/RootOutputFile.cc @@ -148,8 +148,13 @@ namespace edm { treePointers_[InEvent] = &eventTree_; treePointers_[InLumi] = &lumiTree_; treePointers_[InRun] = &runTree_; + treePointers_[InProcess] = nullptr; for (int i = InEvent; i < NumBranchTypes; ++i) { + if (i == InProcess) { + // Output for ProcessBlocks is not implemented yet. + continue; + } BranchType branchType = static_cast(i); RootOutputTree* theTree = treePointers_[branchType]; for (auto& item : om_->selectedOutputItemList()[branchType]) { @@ -622,6 +627,10 @@ namespace edm { // events/lumis/runs trees. The loop is over all types of data // products. for (int i = InEvent; i < NumBranchTypes; ++i) { + if (i == InProcess) { + // Output for ProcessBlocks is not implemented yet. + continue; + } BranchType branchType = static_cast(i); setBranchAliases(treePointers_[branchType]->tree(), om_->keptProducts()[branchType]); treePointers_[branchType]->writeTree(); @@ -631,6 +640,10 @@ namespace edm { // Just to play it safe, zero all pointers to objects in the TFile to be closed. metaDataTree_ = parentageTree_ = nullptr; for (auto& treePointer : treePointers_) { + if (treePointer.get() == nullptr) { + // Output for ProcessBlock is not implemented yet + continue; + } treePointer->close(); treePointer = nullptr; } From b28794d90dc86ab33bc1cb2efc9ca0e8dded35d4 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 10 Jun 2020 18:49:29 +0200 Subject: [PATCH 02/25] Use std::array in ProductRegistry Replace 4 member variables with std::array for for productLookups and nextIndexValues. --- .../Provenance/interface/ProductRegistry.h | 33 +-------- DataFormats/Provenance/src/ProductRegistry.cc | 67 +++++-------------- 2 files changed, 19 insertions(+), 81 deletions(-) diff --git a/DataFormats/Provenance/interface/ProductRegistry.h b/DataFormats/Provenance/interface/ProductRegistry.h index 3c6d953241f80..be49c4dfdf38e 100644 --- a/DataFormats/Provenance/interface/ProductRegistry.h +++ b/DataFormats/Provenance/interface/ProductRegistry.h @@ -132,43 +132,14 @@ namespace edm { Transients(); void reset(); - std::shared_ptr eventProductLookup() const { - return get_underlying_safe(eventProductLookup_); - } - std::shared_ptr& eventProductLookup() { - return get_underlying_safe(eventProductLookup_); - } - std::shared_ptr lumiProductLookup() const { - return get_underlying_safe(lumiProductLookup_); - } - std::shared_ptr& lumiProductLookup() { - return get_underlying_safe(lumiProductLookup_); - } - std::shared_ptr runProductLookup() const { - return get_underlying_safe(runProductLookup_); - } - std::shared_ptr& runProductLookup() { return get_underlying_safe(runProductLookup_); } - std::shared_ptr processProductLookup() const { - return get_underlying_safe(processProductLookup_); - } - std::shared_ptr& processProductLookup() { - return get_underlying_safe(processProductLookup_); - } - bool frozen_; // Is at least one (run), (lumi), (event) persistent product produced this process? std::array productProduced_; bool anyProductProduced_; - edm::propagate_const> eventProductLookup_; - edm::propagate_const> lumiProductLookup_; - edm::propagate_const> runProductLookup_; - edm::propagate_const> processProductLookup_; + std::array>, NumBranchTypes> productLookups_; - ProductResolverIndex eventNextIndexValue_; - ProductResolverIndex lumiNextIndexValue_; - ProductResolverIndex runNextIndexValue_; - ProductResolverIndex processNextIndexValue_; + std::array nextIndexValues_; std::map branchIDToIndex_; diff --git a/DataFormats/Provenance/src/ProductRegistry.cc b/DataFormats/Provenance/src/ProductRegistry.cc index 12616d06f1d95..5f2ce73052dd1 100644 --- a/DataFormats/Provenance/src/ProductRegistry.cc +++ b/DataFormats/Provenance/src/ProductRegistry.cc @@ -35,15 +35,11 @@ namespace edm { : frozen_(false), productProduced_(), anyProductProduced_(false), - eventProductLookup_(new ProductResolverIndexHelper), - lumiProductLookup_(new ProductResolverIndexHelper), - runProductLookup_(new ProductResolverIndexHelper), - processProductLookup_(new ProductResolverIndexHelper), - eventNextIndexValue_(0), - lumiNextIndexValue_(0), - runNextIndexValue_(0), - processNextIndexValue_(0), - + productLookups_{{new ProductResolverIndexHelper, + new ProductResolverIndexHelper, + new ProductResolverIndexHelper, + new ProductResolverIndexHelper}}, + nextIndexValues_(), branchIDToIndex_() { for (bool& isProduced : productProduced_) isProduced = false; @@ -56,15 +52,10 @@ namespace edm { anyProductProduced_ = false; // propagate_const has no reset() function - eventProductLookup_ = std::make_unique(); - lumiProductLookup_ = std::make_unique(); - runProductLookup_ = std::make_unique(); - processProductLookup_ = std::make_unique(); - - eventNextIndexValue_ = 0; - lumiNextIndexValue_ = 0; - runNextIndexValue_ = 0; - processNextIndexValue_ = 0; + for (int i = InEvent; i < NumBranchTypes; ++i) { + productLookups_[i] = std::make_unique(); + } + nextIndexValues_.fill(0); branchIDToIndex_.clear(); } @@ -151,23 +142,11 @@ namespace edm { } std::shared_ptr ProductRegistry::productLookup(BranchType branchType) const { - if (branchType == InEvent) - return transient_.eventProductLookup(); - if (branchType == InLumi) - return transient_.lumiProductLookup(); - if (branchType == InRun) - return transient_.runProductLookup(); - return transient_.processProductLookup(); + return get_underlying_safe(transient_.productLookups_[branchType]); } std::shared_ptr ProductRegistry::productLookup(BranchType branchType) { - if (branchType == InEvent) - return transient_.eventProductLookup(); - if (branchType == InLumi) - return transient_.lumiProductLookup(); - if (branchType == InRun) - return transient_.runProductLookup(); - return transient_.processProductLookup(); + return get_underlying_safe(transient_.productLookups_[branchType]); } void ProductRegistry::setFrozen(bool initializeLookupInfo) { @@ -464,10 +443,10 @@ namespace edm { productLookup(InRun)->setFrozen(); productLookup(InProcess)->setFrozen(); - transient_.eventNextIndexValue_ = productLookup(InEvent)->nextIndexValue(); - transient_.lumiNextIndexValue_ = productLookup(InLumi)->nextIndexValue(); - transient_.runNextIndexValue_ = productLookup(InRun)->nextIndexValue(); - transient_.processNextIndexValue_ = productLookup(InProcess)->nextIndexValue(); + for (unsigned int i = InEvent; i < NumBranchTypes; ++i) { + BranchType branchType = static_cast(i); + transient_.nextIndexValues_[branchType] = productLookup(branchType)->nextIndexValue(); + } for (auto const& product : productList_) { auto const& desc = product.second; @@ -586,22 +565,10 @@ namespace edm { } ProductResolverIndex const& ProductRegistry::getNextIndexValue(BranchType branchType) const { - if (branchType == InEvent) - return transient_.eventNextIndexValue_; - if (branchType == InLumi) - return transient_.lumiNextIndexValue_; - if (branchType == InRun) - return transient_.runNextIndexValue_; - return transient_.processNextIndexValue_; + return transient_.nextIndexValues_[branchType]; } ProductResolverIndex& ProductRegistry::nextIndexValue(BranchType branchType) { - if (branchType == InEvent) - return transient_.eventNextIndexValue_; - if (branchType == InLumi) - return transient_.lumiNextIndexValue_; - if (branchType == InRun) - return transient_.runNextIndexValue_; - return transient_.processNextIndexValue_; + return transient_.nextIndexValues_[branchType]; } } // namespace edm From 9edfdd10d1b622233c2b68aa32af67118e74d13b Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 10 Jun 2020 23:07:16 +0200 Subject: [PATCH 03/25] Use std::array in BranchType implementation --- DataFormats/Provenance/src/BranchType.cc | 108 +++++++++++------------ 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/DataFormats/Provenance/src/BranchType.cc b/DataFormats/Provenance/src/BranchType.cc index e7ebf9b5b337f..74d8b00ef93d7 100644 --- a/DataFormats/Provenance/src/BranchType.cc +++ b/DataFormats/Provenance/src/BranchType.cc @@ -1,5 +1,7 @@ #include "DataFormats/Provenance/interface/BranchType.h" #include "FWCore/Utilities/interface/EDMException.h" +#include +#include #include namespace edm { @@ -17,44 +19,40 @@ namespace edm { std::string const branchEntryInfo = "BranchEntryInfo"; // backward compatibility std::string const productProvenance = "ProductProvenance"; - // Prefixes - std::string const process = "ProcessBlock"; - std::string const run = "Run"; - std::string const lumi = "LuminosityBlock"; - std::string const event = "Event"; + std::array const branchTypeNames{{"Event", "LuminosityBlock", "Run", "ProcessBlock"}}; + std::size_t constexpr eventLumiRunSize = 3; + using NameArray = const std::array; - // Trees, branches, indices - std::string const runs = run + 's'; - std::string const lumis = lumi + 's'; - std::string const events = event + 's'; + NameArray treeNames{{branchTypeNames[InEvent] + 's', branchTypeNames[InLumi] + 's', branchTypeNames[InRun] + 's'}}; - std::string const runMeta = run + metaData; - std::string const lumiMeta = lumi + metaData; - std::string const eventMeta = event + metaData; + NameArray metaTreeNames{ + {branchTypeNames[InEvent] + metaData, branchTypeNames[InLumi] + metaData, branchTypeNames[InRun] + metaData}}; - std::string const runInfo = run + "StatusInformation"; // backward compatibility - std::string const lumiInfo = lumi + "StatusInformation"; // backward compatibility - std::string const eventInfo = event + "StatusInformation"; // backward compatibility + // backward compatibility + NameArray infoNames{{branchTypeNames[InEvent] + "StatusInformation", + branchTypeNames[InLumi] + "StatusInformation", + branchTypeNames[InRun] + "StatusInformation"}}; - std::string const runAuxiliary = run + auxiliary; - std::string const lumiAuxiliary = lumi + auxiliary; - std::string const eventAuxiliary = event + auxiliary; + NameArray auxiliaryNames{{branchTypeNames[InEvent] + auxiliary, + branchTypeNames[InLumi] + auxiliary, + branchTypeNames[InRun] + auxiliary}}; - std::string const runProductStatus = run + productStatus; // backward compatibility - std::string const lumiProductStatus = lumi + productStatus; // backward compatibility - std::string const eventProductStatus = event + productStatus; // backward compatibility + // backward compatibility + NameArray productStatusNames{{branchTypeNames[InEvent] + productStatus, + branchTypeNames[InLumi] + productStatus, + branchTypeNames[InRun] + productStatus}}; - std::string const runEventEntryInfo = run + branchEntryInfo; // backward compatibility - std::string const lumiEventEntryInfo = lumi + branchEntryInfo; // backward compatibility - std::string const eventEventEntryInfo = event + branchEntryInfo; // backward compatibility + // backward compatibility + NameArray eventEntryInfoNames{{branchTypeNames[InEvent] + branchEntryInfo, + branchTypeNames[InLumi] + branchEntryInfo, + branchTypeNames[InRun] + branchEntryInfo}}; - std::string const runProductProvenance = run + productProvenance; - std::string const lumiProductProvenance = lumi + productProvenance; - std::string const eventProductProvenance = event + productProvenance; + NameArray productProvenanceNames{{branchTypeNames[InEvent] + productProvenance, + branchTypeNames[InLumi] + productProvenance, + branchTypeNames[InRun] + productProvenance}}; - std::string const runAux = run + aux; - std::string const lumiAux = lumi + aux; - std::string const eventAux = event + aux; + // backward compatibility + NameArray auxNames{{branchTypeNames[InEvent] + aux, branchTypeNames[InLumi] + aux, branchTypeNames[InRun] + aux}}; std::string const entryDescriptionTree = "EntryDescription"; std::string const entryDescriptionIDBranch = "Hash"; @@ -88,17 +86,14 @@ namespace edm { std::string const idToParameterSetBlobsBranch = "IdToParameterSetsBlobs"; } // namespace - std::string const& BranchTypeToString(BranchType const& branchType) { - return ((branchType == InEvent) ? event - : ((branchType == InRun) ? run : ((branchType == InLumi) ? lumi : process))); - } + std::string const& BranchTypeToString(BranchType const& branchType) { return branchTypeNames[branchType]; } std::string const& BranchTypeToProductTreeName(BranchType const& branchType) { if (branchType >= InProcess) { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToProductTreeName"); } - return ((branchType == InEvent) ? events : ((branchType == InRun) ? runs : lumis)); + return treeNames[branchType]; } std::string const& BranchTypeToMetaDataTreeName(BranchType const& branchType) { @@ -106,51 +101,51 @@ namespace edm { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToMetaDataTreeName"); } - return ((branchType == InEvent) ? eventMeta : ((branchType == InRun) ? runMeta : lumiMeta)); + return metaTreeNames[branchType]; } - std::string const& BranchTypeToInfoTreeName(BranchType const& branchType) { // backward compatibility + // backward compatibility + std::string const& BranchTypeToInfoTreeName(BranchType const& branchType) { if (branchType >= InProcess) { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToInfoTreeName"); } - return ((branchType == InEvent) ? eventInfo - : ((branchType == InRun) ? runInfo : lumiInfo)); // backward compatibility - } // backward compatibility + return infoNames[branchType]; + } std::string const& BranchTypeToAuxiliaryBranchName(BranchType const& branchType) { if (branchType >= InProcess) { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToAuxiliaryBranchName"); } - return ((branchType == InEvent) ? eventAuxiliary : ((branchType == InRun) ? runAuxiliary : lumiAuxiliary)); + return auxiliaryNames[branchType]; } - std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) { // backward compatibility + // backward compatibility + std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) { if (branchType >= InProcess) { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToAuxBranchName"); } - return ((branchType == InEvent) ? eventAux : ((branchType == InRun) ? runAux : lumiAux)); // backward compatibility - } // backward compatibility + return auxNames[branchType]; + } - std::string const& BranchTypeToProductStatusBranchName(BranchType const& branchType) { // backward compatibility + // backward compatibility + std::string const& BranchTypeToProductStatusBranchName(BranchType const& branchType) { if (branchType >= InProcess) { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToProductStatusBranchName"); } - return ((branchType == InEvent) - ? eventProductStatus - : ((branchType == InRun) ? runProductStatus : lumiProductStatus)); // backward compatibility - } // backward compatibility + return productStatusNames[branchType]; + } + // backward compatibility std::string const& BranchTypeToBranchEntryInfoBranchName(BranchType const& branchType) { if (branchType >= InProcess) { throw Exception(errors::LogicError, "branchType argument out of legal range for the function BranchTypeToBranchEntryInfoBranchName"); } - return ((branchType == InEvent) ? eventEventEntryInfo - : ((branchType == InRun) ? runEventEntryInfo : lumiEventEntryInfo)); + return eventEntryInfoNames[branchType]; } std::string const& BranchTypeToProductProvenanceBranchName(BranchType const& branchType) { @@ -159,8 +154,7 @@ namespace edm { errors::LogicError, "branchType argument out of legal range for the function BranchTypeToProductProvenanceBranchName"); } - return ((branchType == InEvent) ? eventProductProvenance - : ((branchType == InRun) ? runProductProvenance : lumiProductProvenance)); + return productProvenanceNames[branchType]; } namespace poolNames { @@ -234,12 +228,12 @@ namespace edm { // Branch on ParameterSets Tree std::string const& idToParameterSetBlobsBranchName() { return idToParameterSetBlobsBranch; } - std::string const& eventTreeName() { return events; } + std::string const& eventTreeName() { return treeNames[InEvent]; } - std::string const& eventMetaDataTreeName() { return eventMeta; } + std::string const& eventMetaDataTreeName() { return metaTreeNames[InEvent]; } std::string const& eventHistoryTreeName() { return eventHistory; } - std::string const& luminosityBlockTreeName() { return lumis; } - std::string const& runTreeName() { return runs; } + std::string const& luminosityBlockTreeName() { return treeNames[InLumi]; } + std::string const& runTreeName() { return treeNames[InRun]; } } // namespace poolNames } // namespace edm From a295a639b9710d07a86f62bff0d5d721bfe1ed66 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 11 Jun 2020 00:17:10 +0200 Subject: [PATCH 04/25] Remove unnecessary private access specifiers --- FWCore/Framework/interface/stream/implementors.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/FWCore/Framework/interface/stream/implementors.h b/FWCore/Framework/interface/stream/implementors.h index 1d1b3c0c404c6..b8f889287c5a8 100644 --- a/FWCore/Framework/interface/stream/implementors.h +++ b/FWCore/Framework/interface/stream/implementors.h @@ -138,7 +138,6 @@ namespace edm { EndProcessBlockProducer(EndProcessBlockProducer const&) = delete; EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete; - private: ///requires the following be defined in the inheriting class /// static void endProcessBlockProduce(edm::ProcessBlock&, GlobalCache const* ) }; @@ -159,7 +158,6 @@ namespace edm { EndRunProducer(EndRunProducer const&) = delete; EndRunProducer& operator=(EndRunProducer const&) = delete; - private: ///requires the following be defined in the inheriting class /// static void globalEndRunProduce(edm::Run&, edm::EventSetup const&, RunContext const* ) }; @@ -170,7 +168,6 @@ namespace edm { BeginLuminosityBlockProducer(BeginLuminosityBlockProducer const&) = delete; BeginLuminosityBlockProducer& operator=(BeginLuminosityBlockProducer const&) = delete; - private: ///requires the following be defined in the inheriting class ///static void globalBeginLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&, LuminosityBlockContext const*) }; @@ -181,7 +178,6 @@ namespace edm { EndLuminosityBlockProducer(EndLuminosityBlockProducer const&) = delete; EndLuminosityBlockProducer& operator=(EndLuminosityBlockProducer const&) = delete; - private: ///requires the following be defined in the inheriting class ///static void globalEndLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&, LuminosityBlockContext const*) }; From f3a2b004372f6433874e375247d308e0d49af709 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 11 Jun 2020 17:06:33 +0200 Subject: [PATCH 05/25] Insert correct principal --- FWCore/Framework/src/EventProcessor.cc | 2 +- FWCore/Framework/src/SubProcess.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index ca36c4875f934..99d352b94cb1c 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -489,7 +489,7 @@ namespace edm { principalCache_.insert(std::move(pb)); auto pbForInput = std::make_unique(preg(), *processConfiguration_); - principalCache_.insertForInput(std::move(pb)); + principalCache_.insertForInput(std::move(pbForInput)); } // fill the subprocesses, if there are any diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 449638c9e0942..c6a8186e08cb0 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -195,7 +195,7 @@ namespace edm { principalCache_.insert(std::move(pb)); auto pbForInput = std::make_unique(preg_, *processConfiguration_, false); - principalCache_.insertForInput(std::move(pb)); + principalCache_.insertForInput(std::move(pbForInput)); } inUseLumiPrincipals_.resize(preallocConfig.numberOfLuminosityBlocks()); From aa0a0d431c9938c36221e1b9c8318449fcf40b3d Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 11 Jun 2020 17:35:10 +0200 Subject: [PATCH 06/25] Modernize, replace typedef with using --- FWCore/Framework/src/EventProcessor.cc | 20 ++++++++++---------- FWCore/Framework/src/SubProcess.cc | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 99d352b94cb1c..a83151cde8891 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -875,7 +875,7 @@ namespace edm { ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName()); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); @@ -900,7 +900,7 @@ namespace edm { DelayedReader* reader = nullptr; processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName(), reader); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); @@ -931,7 +931,7 @@ namespace edm { void EventProcessor::endProcessBlock(bool cleaningUpAfterException, bool beginProcessBlockSucceeded) { ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); @@ -994,7 +994,7 @@ namespace edm { looper_->doStartingNewLoop(); } { - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); beginGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), @@ -1020,7 +1020,7 @@ namespace edm { auto streamLoopWaitTask = make_empty_waiting_task(); streamLoopWaitTask->increment_ref_count(); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; beginStreamsTransitionAsync(streamLoopWaitTask.get(), *schedule_, @@ -1090,7 +1090,7 @@ namespace edm { auto streamLoopWaitTask = make_empty_waiting_task(); streamLoopWaitTask->increment_ref_count(); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endStreamsTransitionAsync(WaitingTaskHolder(streamLoopWaitTask.get()), *schedule_, @@ -1116,7 +1116,7 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), *schedule_, runPrincipal, @@ -1230,7 +1230,7 @@ namespace edm { return; } } - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) { streamQueues_[i].push([this, i, status, holder, ts, &es]() mutable { @@ -1276,7 +1276,7 @@ namespace edm { EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); { - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; beginGlobalTransitionAsync(beginStreamsHolder, *schedule_, lumiPrincipal, @@ -1460,7 +1460,7 @@ namespace edm { IOVSyncValue ts(EventID(lp.run(), lp.luminosityBlock(), EventID::maxEventNumber()), lp.beginTime()); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endGlobalTransitionAsync(WaitingTaskHolder(writeT), *schedule_, diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index c6a8186e08cb0..3630a183a346f 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -424,7 +424,7 @@ namespace edm { processBlockPrincipal.fillProcessBlockPrincipal(principal.processName(), principal.reader()); propagateProducts(InProcess, principal, processBlockPrincipal); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; beginGlobalTransitionAsync( std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); } @@ -441,7 +441,7 @@ namespace edm { processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName()); propagateProducts(InProcess, principal, processBlockPrincipal); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; beginGlobalTransitionAsync( std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); } @@ -454,7 +454,7 @@ namespace edm { ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); propagateProducts(InProcess, principal, processBlockPrincipal); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endGlobalTransitionAsync( std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_, cleaningUpAfterException); } @@ -485,7 +485,7 @@ namespace edm { RunPrincipal& rp = *principalCache_.runPrincipalPtr(); propagateProducts(InRun, principal, rp); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; beginGlobalTransitionAsync( std::move(iHolder), *schedule_, rp, ts, esp_->eventSetupImpl(), iEventSetupImpls, serviceToken_, subProcesses_); } @@ -497,7 +497,7 @@ namespace edm { bool cleaningUpAfterException) { RunPrincipal& rp = *principalCache_.runPrincipalPtr(); propagateProducts(InRun, principal, rp); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endGlobalTransitionAsync(std::move(iHolder), *schedule_, rp, @@ -592,7 +592,7 @@ namespace edm { lbpp->setRunPrincipal(principalCache_.runPrincipalPtr()); LuminosityBlockPrincipal& lbp = *lbpp; propagateProducts(InLumi, principal, lbp); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; beginGlobalTransitionAsync(std::move(iHolder), *schedule_, lbp, @@ -610,7 +610,7 @@ namespace edm { bool cleaningUpAfterException) { LuminosityBlockPrincipal& lbp = *inUseLumiPrincipals_[principal.index()]; propagateProducts(InLumi, principal, lbp); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endGlobalTransitionAsync(std::move(iHolder), *schedule_, lbp, @@ -666,7 +666,7 @@ namespace edm { RunPrincipal const& principal, IOVSyncValue const& ts, std::vector> const* iEventSetupImpls) { - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; RunPrincipal& rp = *principalCache_.runPrincipalPtr(); @@ -688,7 +688,7 @@ namespace edm { std::vector> const* iEventSetupImpls, bool cleaningUpAfterException) { RunPrincipal& rp = *principalCache_.runPrincipalPtr(); - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endStreamTransitionAsync(std::move(iHolder), *schedule_, @@ -708,7 +708,7 @@ namespace edm { LuminosityBlockPrincipal const& principal, IOVSyncValue const& ts, std::vector> const* iEventSetupImpls) { - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; LuminosityBlockPrincipal& lbp = *inUseLumiPrincipals_[principal.index()]; @@ -731,7 +731,7 @@ namespace edm { std::vector> const* iEventSetupImpls, bool cleaningUpAfterException) { LuminosityBlockPrincipal& lbp = *inUseLumiPrincipals_[principal.index()]; - typedef OccurrenceTraits Traits; + using Traits = OccurrenceTraits; endStreamTransitionAsync(std::move(iHolder), *schedule_, id, From c4bef3b0361e7b98d583a3f4c4a970911c445d03 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 11 Jun 2020 18:11:44 +0200 Subject: [PATCH 07/25] Only perform find in fillPrincipal if needed --- FWCore/Framework/src/Principal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Framework/src/Principal.cc b/FWCore/Framework/src/Principal.cc index bb3629ba7d7ed..6282b924145e5 100644 --- a/FWCore/Framework/src/Principal.cc +++ b/FWCore/Framework/src/Principal.cc @@ -480,9 +480,9 @@ namespace edm { fillPrincipal(reader); std::vector const& lookupProcessNames = productLookup_->lookupProcessNames(); - auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock); lookupProcessOrder_.assign(lookupProcessNames.size(), 0); if (!lookupProcessOrder_.empty()) { + auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock); if (iter != lookupProcessNames.end()) { lookupProcessOrder_[0] = iter - lookupProcessNames.begin(); } From 7efbcd686023e580cfc8159b0dbd1a971707576c Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 12 Jun 2020 17:18:15 +0200 Subject: [PATCH 08/25] Use enum argument instead of bool --- FWCore/Framework/interface/EventProcessor.h | 3 +- FWCore/Framework/interface/SubProcess.h | 5 ++-- FWCore/Framework/src/EventProcessor.cc | 17 ++++++----- FWCore/Framework/src/PrincipalCache.h | 6 ++-- FWCore/Framework/src/SubProcess.cc | 32 ++++++++++----------- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/FWCore/Framework/interface/EventProcessor.h b/FWCore/Framework/interface/EventProcessor.h index 0f482e347c62b..7a6b6afa41b68 100644 --- a/FWCore/Framework/interface/EventProcessor.h +++ b/FWCore/Framework/interface/EventProcessor.h @@ -246,7 +246,8 @@ namespace edm { std::pair readAndMergeRun(); void readLuminosityBlock(LuminosityBlockProcessingStatus&); int readAndMergeLumi(LuminosityBlockProcessingStatus&); - void writeProcessBlockAsync(WaitingTaskHolder, bool isInputProcessBlock = false); + using ProcessBlockType = PrincipalCache::ProcessBlockType; + void writeProcessBlockAsync(WaitingTaskHolder, ProcessBlockType); void writeRunAsync(WaitingTaskHolder, ProcessHistoryID const& phid, RunNumber_t run, diff --git a/FWCore/Framework/interface/SubProcess.h b/FWCore/Framework/interface/SubProcess.h index ee6b8c0bdd706..216d294d568eb 100644 --- a/FWCore/Framework/interface/SubProcess.h +++ b/FWCore/Framework/interface/SubProcess.h @@ -145,7 +145,8 @@ namespace edm { void deleteLumiFromCache(LuminosityBlockPrincipal&); - void writeProcessBlockAsync(edm::WaitingTaskHolder task, bool isInputProcessBlock); + using ProcessBlockType = PrincipalCache::ProcessBlockType; + void writeProcessBlockAsync(edm::WaitingTaskHolder task, ProcessBlockType); void writeRunAsync(WaitingTaskHolder, ProcessHistoryID const& parentPhID, @@ -154,7 +155,7 @@ namespace edm { void deleteRunFromCache(ProcessHistoryID const& parentPhID, int runNumber); - void clearProcessBlockPrincipal(bool isInputProcessBlock = false); + void clearProcessBlockPrincipal(ProcessBlockType); // Call closeFile() on all OutputModules. void closeOutputFiles() { diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index a83151cde8891..985b31627e140 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -914,8 +914,7 @@ namespace edm { auto writeWaitTask = edm::make_empty_waiting_task(); writeWaitTask->increment_ref_count(); - bool isInputProcessBlock = true; - writeProcessBlockAsync(edm::WaitingTaskHolder{writeWaitTask.get()}, isInputProcessBlock); + writeProcessBlockAsync(edm::WaitingTaskHolder{writeWaitTask.get()}, ProcessBlockType::Input); writeWaitTask->wait_for_all(); if (writeWaitTask->exceptionPtr()) { std::rethrow_exception(*writeWaitTask->exceptionPtr()); @@ -923,7 +922,7 @@ namespace edm { processBlockPrincipal.clearPrincipal(); for (auto& s : subProcesses_) { - s.clearProcessBlockPrincipal(isInputProcessBlock); + s.clearProcessBlockPrincipal(ProcessBlockType::Input); } } } @@ -950,7 +949,7 @@ namespace edm { if (beginProcessBlockSucceeded) { auto writeWaitTask = edm::make_empty_waiting_task(); writeWaitTask->increment_ref_count(); - writeProcessBlockAsync(edm::WaitingTaskHolder{writeWaitTask.get()}); + writeProcessBlockAsync(edm::WaitingTaskHolder{writeWaitTask.get()}, ProcessBlockType::New); writeWaitTask->wait_for_all(); if (writeWaitTask->exceptionPtr()) { std::rethrow_exception(*writeWaitTask->exceptionPtr()); @@ -959,7 +958,7 @@ namespace edm { processBlockPrincipal.clearPrincipal(); for (auto& s : subProcesses_) { - s.clearProcessBlockPrincipal(); + s.clearProcessBlockPrincipal(ProcessBlockType::New); } } @@ -1611,21 +1610,21 @@ namespace edm { return input_->luminosityBlock(); } - void EventProcessor::writeProcessBlockAsync(WaitingTaskHolder task, bool isInputProcessBlock) { + void EventProcessor::writeProcessBlockAsync(WaitingTaskHolder task, ProcessBlockType processBlockType) { auto subsT = edm::make_waiting_task(tbb::task::allocate_root(), - [this, task, isInputProcessBlock](std::exception_ptr const* iExcept) mutable { + [this, task, processBlockType](std::exception_ptr const* iExcept) mutable { if (iExcept) { task.doneWaiting(*iExcept); } else { ServiceRegistry::Operate op(serviceToken_); for (auto& s : subProcesses_) { - s.writeProcessBlockAsync(task, isInputProcessBlock); + s.writeProcessBlockAsync(task, processBlockType); } } }); ServiceRegistry::Operate op(serviceToken_); schedule_->writeProcessBlockAsync(WaitingTaskHolder(subsT), - principalCache_.processBlockPrincipal(isInputProcessBlock), + principalCache_.processBlockPrincipal(processBlockType), &processContext_, actReg_.get()); } diff --git a/FWCore/Framework/src/PrincipalCache.h b/FWCore/Framework/src/PrincipalCache.h index b7181ed7c9c52..84f0a5e8724fa 100644 --- a/FWCore/Framework/src/PrincipalCache.h +++ b/FWCore/Framework/src/PrincipalCache.h @@ -53,8 +53,10 @@ namespace edm { ProcessBlockPrincipal& processBlockPrincipal() const { return *processBlockPrincipal_; } ProcessBlockPrincipal& inputProcessBlockPrincipal() const { return *inputProcessBlockPrincipal_; } - ProcessBlockPrincipal& processBlockPrincipal(bool input) const { - return input ? *inputProcessBlockPrincipal_ : *processBlockPrincipal_; + + enum class ProcessBlockType { New, Input }; + ProcessBlockPrincipal& processBlockPrincipal(ProcessBlockType processBlockType) const { + return processBlockType == ProcessBlockType::Input ? *inputProcessBlockPrincipal_ : *processBlockPrincipal_; } RunPrincipal& runPrincipal(ProcessHistoryID const& phid, RunNumber_t run) const; diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 3630a183a346f..1ace20a522948 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -509,22 +509,22 @@ namespace edm { cleaningUpAfterException); } - void SubProcess::writeProcessBlockAsync(edm::WaitingTaskHolder task, bool isInputProcessBlock) { + void SubProcess::writeProcessBlockAsync(edm::WaitingTaskHolder task, ProcessBlockType processBlockType) { ServiceRegistry::Operate operate(serviceToken_); - auto subTasks = edm::make_waiting_task( - tbb::task::allocate_root(), [this, task, isInputProcessBlock](std::exception_ptr const* iExcept) mutable { - if (iExcept) { - task.doneWaiting(*iExcept); - } else { - ServiceRegistry::Operate operate(serviceToken_); - for (auto& s : subProcesses_) { - s.writeProcessBlockAsync(task, isInputProcessBlock); - } - } - }); + auto subTasks = edm::make_waiting_task(tbb::task::allocate_root(), + [this, task, processBlockType](std::exception_ptr const* iExcept) mutable { + if (iExcept) { + task.doneWaiting(*iExcept); + } else { + ServiceRegistry::Operate operate(serviceToken_); + for (auto& s : subProcesses_) { + s.writeProcessBlockAsync(task, processBlockType); + } + } + }); schedule_->writeProcessBlockAsync(WaitingTaskHolder(subTasks), - principalCache_.processBlockPrincipal(isInputProcessBlock), + principalCache_.processBlockPrincipal(processBlockType), &processContext_, actReg_.get()); } @@ -566,11 +566,11 @@ namespace edm { [&childPhID, runNumber](auto& subProcess) { subProcess.deleteRunFromCache(childPhID, runNumber); }); } - void SubProcess::clearProcessBlockPrincipal(bool isInputProcessBlock) { - ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(isInputProcessBlock); + void SubProcess::clearProcessBlockPrincipal(ProcessBlockType processBlockType) { + ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(processBlockType); processBlockPrincipal.clearPrincipal(); for (auto& s : subProcesses_) { - s.clearProcessBlockPrincipal(isInputProcessBlock); + s.clearProcessBlockPrincipal(processBlockType); } } From 3bbae12fd042c83343c65ebcb93a1ffa1229b533 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 12 Jun 2020 17:27:33 +0200 Subject: [PATCH 09/25] Add a comment --- FWCore/Framework/test/stubs/ToyIntProducers.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FWCore/Framework/test/stubs/ToyIntProducers.cc b/FWCore/Framework/test/stubs/ToyIntProducers.cc index 9f7b3cae59941..787a1e6dea5be 100644 --- a/FWCore/Framework/test/stubs/ToyIntProducers.cc +++ b/FWCore/Framework/test/stubs/ToyIntProducers.cc @@ -608,6 +608,10 @@ namespace edmtest { check(processBlock.get(bpbGet_), bpbExpect_); } if (sleepTime_ > 0) { + // These sleeps are here to force modules to run concurrently + // in multi-threaded processes. Otherwise, the modules are so + // fast it is hard to tell whether a module finishes before the + // the Framework starts the next module. usleep(sleepTime_); } processBlock.emplace(bpbToken_, value_); From 11124c28500edcaf782e79501409bce362fbedd2 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 12 Jun 2020 19:12:05 +0200 Subject: [PATCH 10/25] Test order of transitions more carefully --- .../test/stubs/TestGlobalAnalyzers.cc | 68 ++++++++++++++++--- .../Framework/test/test_global_modules_cfg.py | 2 +- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc b/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc index bcbb3708995e4..915b50c37226d 100644 --- a/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc @@ -301,7 +301,9 @@ namespace edmtest { } }; - class ProcessBlockIntAnalyzer : public edm::global::EDAnalyzer> { + class ProcessBlockIntAnalyzer : public edm::global::EDAnalyzer, + edm::StreamCache, + edm::RunCache> { public: explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { { @@ -318,10 +320,27 @@ namespace edmtest { } } - void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + void beginJob() override { if (m_count != 0) { throw cms::Exception("transitions") - << "ProcessBlockIntAnalyzer::begin transitions " << m_count << " but it was supposed to be " << 0; + << "ProcessBlockIntAnalyzer::beginJob transition " << m_count << " but it was supposed to be " << 0; + } + ++m_count; + } + + std::unique_ptr beginStream(edm::StreamID) const override { + if (m_count < 1) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::beginStream transition " << m_count + << " but it was supposed to be at least 1"; + } + ++m_count; + return std::make_unique(); + } + + void beginProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 5) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::beginProcessBlock transition " << m_count + << " but it was supposed to be " << 5; } ++m_count; @@ -334,19 +353,36 @@ namespace edmtest { } } + std::shared_ptr globalBeginRun(edm::Run const&, edm::EventSetup const&) const override { + if (m_count < 6u) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::globalBeginRun transition " << m_count + << " but it was supposed to be at least 6"; + } + ++m_count; + return std::make_shared(); + } + void analyze(edm::StreamID iID, edm::Event const&, edm::EventSetup const&) const override { - if (m_count < 1u) { + if (m_count < 7u) { throw cms::Exception("out of sequence") << "analyze before beginProcessBlock " << m_count; } ++m_count; } - void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + void globalEndRun(edm::Run const&, edm::EventSetup const&) const override { + if (m_count < 15u) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::globalEndRun transition " << m_count + << " but it was supposed to be at least 15"; + } ++m_count; - if (m_count != trans_) { - throw cms::Exception("transitions") - << "ProcessBlockIntAnalyzer::end transitions " << m_count << " but it was supposed to be " << trans_; + } + + void endProcessBlock(edm::ProcessBlock const& processBlock) const override { + if (m_count != 646u) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::endProcessBlock transition " << m_count + << " but it was supposed to be " << 646; } + ++m_count; { const unsigned int valueToGet = 11; if (not getTokenBegin_.isUninitialized()) { @@ -367,6 +403,22 @@ namespace edmtest { } } + void endStream(edm::StreamID) const override { + if (m_count < 647u) { + throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::endStream transition " << m_count + << " but it was supposed to be at least 647"; + } + ++m_count; + } + + void endJob() override { + if (m_count != 651u) { + throw cms::Exception("transitions") + << "ProcessBlockIntAnalyzer::endJob transition " << m_count << " but it was supposed to be " << 651; + } + ++m_count; + } + ~ProcessBlockIntAnalyzer() { if (m_count != trans_) { throw cms::Exception("transitions") diff --git a/FWCore/Framework/test/test_global_modules_cfg.py b/FWCore/Framework/test/test_global_modules_cfg.py index 9417be41179ff..5a177d5deb58e 100644 --- a/FWCore/Framework/test/test_global_modules_cfg.py +++ b/FWCore/Framework/test/test_global_modules_cfg.py @@ -120,7 +120,7 @@ ) process.ProcessBlockIntAn = cms.EDAnalyzer("edmtest::global::ProcessBlockIntAnalyzer", - transitions = cms.int32(int(nEvt + 2)), + transitions = cms.int32(652), consumesBeginProcessBlock = cms.InputTag("TestBeginProcessBlockProd" ,"begin"), consumesEndProcessBlock = cms.InputTag("TestEndProcessBlockProd", "end") ) From 5e63c994bfed4a493b307176d71d31d9993a26df Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 12 Jun 2020 19:43:28 +0200 Subject: [PATCH 11/25] Add printout to sh script, test names --- FWCore/Framework/test/test_non_event_ordering.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FWCore/Framework/test/test_non_event_ordering.sh b/FWCore/Framework/test/test_non_event_ordering.sh index bb1be702ac0c7..7560521fa321f 100755 --- a/FWCore/Framework/test/test_non_event_ordering.sh +++ b/FWCore/Framework/test/test_non_event_ordering.sh @@ -5,9 +5,13 @@ function die { echo $1: status $2 ; exit $2; } TEST_DIR=src/FWCore/Framework/test +echo test_non_event_ordering_beginLumi_cfg.py cmsRun $TEST_DIR/test_non_event_ordering_beginLumi_cfg.py || die "begin Lumi test failed" $? +echo test_non_event_ordering_beginRun_cfg.py cmsRun $TEST_DIR/test_non_event_ordering_beginRun_cfg.py || die "begin Run test failed" $? +echo test_non_event_ordering_endLumi_cfg.py cmsRun $TEST_DIR/test_non_event_ordering_endLumi_cfg.py || die "end Lumi test failed" $? +echo test_non_event_ordering_endRun_cfg.py cmsRun $TEST_DIR/test_non_event_ordering_endRun_cfg.py || die "end Run test failed" $? echo test_non_event_ordering_beginProcessBlock_cfg.py cmsRun $TEST_DIR/test_non_event_ordering_beginProcessBlock_cfg.py || die "begin ProcessBlock test failed" $? From 10e6854aebfe19cd045511fbb7e98604a1f1de4b Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Tue, 16 Jun 2020 20:23:58 +0200 Subject: [PATCH 12/25] Replace throws with asserts --- DataFormats/Provenance/src/BranchType.cc | 44 ++++++------------------ 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/DataFormats/Provenance/src/BranchType.cc b/DataFormats/Provenance/src/BranchType.cc index 74d8b00ef93d7..5759cad8a84c9 100644 --- a/DataFormats/Provenance/src/BranchType.cc +++ b/DataFormats/Provenance/src/BranchType.cc @@ -1,6 +1,7 @@ #include "DataFormats/Provenance/interface/BranchType.h" -#include "FWCore/Utilities/interface/EDMException.h" + #include +#include #include #include @@ -89,71 +90,46 @@ namespace edm { std::string const& BranchTypeToString(BranchType const& branchType) { return branchTypeNames[branchType]; } std::string const& BranchTypeToProductTreeName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToProductTreeName"); - } + assert(branchType < eventLumiRunSize); return treeNames[branchType]; } std::string const& BranchTypeToMetaDataTreeName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToMetaDataTreeName"); - } + assert(branchType < eventLumiRunSize); return metaTreeNames[branchType]; } // backward compatibility std::string const& BranchTypeToInfoTreeName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToInfoTreeName"); - } + assert(branchType < eventLumiRunSize); return infoNames[branchType]; } std::string const& BranchTypeToAuxiliaryBranchName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToAuxiliaryBranchName"); - } + assert(branchType < eventLumiRunSize); return auxiliaryNames[branchType]; } // backward compatibility std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToAuxBranchName"); - } + assert(branchType < eventLumiRunSize); return auxNames[branchType]; } // backward compatibility std::string const& BranchTypeToProductStatusBranchName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToProductStatusBranchName"); - } + assert(branchType < eventLumiRunSize); return productStatusNames[branchType]; } // backward compatibility std::string const& BranchTypeToBranchEntryInfoBranchName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception(errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToBranchEntryInfoBranchName"); - } + assert(branchType < eventLumiRunSize); return eventEntryInfoNames[branchType]; } std::string const& BranchTypeToProductProvenanceBranchName(BranchType const& branchType) { - if (branchType >= InProcess) { - throw Exception( - errors::LogicError, - "branchType argument out of legal range for the function BranchTypeToProductProvenanceBranchName"); - } + assert(branchType < eventLumiRunSize); return productProvenanceNames[branchType]; } From 5db1a14bfb3ed6e27688666d7317254fbba5528b Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Tue, 16 Jun 2020 22:41:09 +0200 Subject: [PATCH 13/25] Add makeNameArray function --- DataFormats/Provenance/src/BranchType.cc | 35 +++++++++++------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/DataFormats/Provenance/src/BranchType.cc b/DataFormats/Provenance/src/BranchType.cc index 5759cad8a84c9..f00f4d14e6126 100644 --- a/DataFormats/Provenance/src/BranchType.cc +++ b/DataFormats/Provenance/src/BranchType.cc @@ -24,36 +24,33 @@ namespace edm { std::size_t constexpr eventLumiRunSize = 3; using NameArray = const std::array; - NameArray treeNames{{branchTypeNames[InEvent] + 's', branchTypeNames[InLumi] + 's', branchTypeNames[InRun] + 's'}}; + NameArray makeNameArray(std::string const& postfix) { + static_assert(InEvent == 0); + static_assert(InLumi == 1); + static_assert(InRun == 2); + return NameArray{ + {branchTypeNames[InEvent] + postfix, branchTypeNames[InLumi] + postfix, branchTypeNames[InRun] + postfix}}; + } - NameArray metaTreeNames{ - {branchTypeNames[InEvent] + metaData, branchTypeNames[InLumi] + metaData, branchTypeNames[InRun] + metaData}}; + NameArray treeNames{makeNameArray(std::string("s"))}; + + NameArray metaTreeNames{makeNameArray(metaData)}; // backward compatibility - NameArray infoNames{{branchTypeNames[InEvent] + "StatusInformation", - branchTypeNames[InLumi] + "StatusInformation", - branchTypeNames[InRun] + "StatusInformation"}}; + NameArray infoNames{makeNameArray(std::string("StatusInformation"))}; - NameArray auxiliaryNames{{branchTypeNames[InEvent] + auxiliary, - branchTypeNames[InLumi] + auxiliary, - branchTypeNames[InRun] + auxiliary}}; + NameArray auxiliaryNames{makeNameArray(auxiliary)}; // backward compatibility - NameArray productStatusNames{{branchTypeNames[InEvent] + productStatus, - branchTypeNames[InLumi] + productStatus, - branchTypeNames[InRun] + productStatus}}; + NameArray productStatusNames{makeNameArray(productStatus)}; // backward compatibility - NameArray eventEntryInfoNames{{branchTypeNames[InEvent] + branchEntryInfo, - branchTypeNames[InLumi] + branchEntryInfo, - branchTypeNames[InRun] + branchEntryInfo}}; + NameArray eventEntryInfoNames{makeNameArray(branchEntryInfo)}; - NameArray productProvenanceNames{{branchTypeNames[InEvent] + productProvenance, - branchTypeNames[InLumi] + productProvenance, - branchTypeNames[InRun] + productProvenance}}; + NameArray productProvenanceNames{makeNameArray(productProvenance)}; // backward compatibility - NameArray auxNames{{branchTypeNames[InEvent] + aux, branchTypeNames[InLumi] + aux, branchTypeNames[InRun] + aux}}; + NameArray auxNames{makeNameArray(aux)}; std::string const entryDescriptionTree = "EntryDescription"; std::string const entryDescriptionIDBranch = "Hash"; From fe579de305739a307702aec4975586372bfc7f52 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 17 Jun 2020 00:36:50 +0200 Subject: [PATCH 14/25] Use range for loop and make_unique --- DataFormats/Provenance/src/ProductRegistry.cc | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/DataFormats/Provenance/src/ProductRegistry.cc b/DataFormats/Provenance/src/ProductRegistry.cc index 5f2ce73052dd1..b31938eef56c5 100644 --- a/DataFormats/Provenance/src/ProductRegistry.cc +++ b/DataFormats/Provenance/src/ProductRegistry.cc @@ -35,10 +35,10 @@ namespace edm { : frozen_(false), productProduced_(), anyProductProduced_(false), - productLookups_{{new ProductResolverIndexHelper, - new ProductResolverIndexHelper, - new ProductResolverIndexHelper, - new ProductResolverIndexHelper}}, + productLookups_{{std::make_unique(), + std::make_unique(), + std::make_unique(), + std::make_unique()}}, nextIndexValues_(), branchIDToIndex_() { for (bool& isProduced : productProduced_) @@ -52,8 +52,8 @@ namespace edm { anyProductProduced_ = false; // propagate_const has no reset() function - for (int i = InEvent; i < NumBranchTypes; ++i) { - productLookups_[i] = std::make_unique(); + for (auto& iterProductLookup : productLookups_) { + iterProductLookup = std::make_unique(); } nextIndexValues_.fill(0); @@ -438,14 +438,14 @@ namespace edm { throwMissingDictionariesException(missingDictionaries, context, producedTypes, branchNamesForMissing); } - productLookup(InEvent)->setFrozen(); - productLookup(InLumi)->setFrozen(); - productLookup(InRun)->setFrozen(); - productLookup(InProcess)->setFrozen(); + for (auto& iterProductLookup : transient_.productLookups_) { + iterProductLookup->setFrozen(); + } - for (unsigned int i = InEvent; i < NumBranchTypes; ++i) { - BranchType branchType = static_cast(i); - transient_.nextIndexValues_[branchType] = productLookup(branchType)->nextIndexValue(); + unsigned int indexIntoNextIndexValue = 0; + for (auto const& iterProductLookup : transient_.productLookups_) { + transient_.nextIndexValues_[indexIntoNextIndexValue] = iterProductLookup->nextIndexValue(); + ++indexIntoNextIndexValue; } for (auto const& product : productList_) { From 811a437e896c66bf016c2db4fb1a53fb6b03d5bc Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 17 Jun 2020 18:34:51 +0200 Subject: [PATCH 15/25] Change enum name to BranchActionProcessBlockInput --- FWCore/Framework/interface/BranchActionType.h | 2 +- FWCore/Framework/interface/OccurrenceTraits.h | 2 +- FWCore/Framework/src/EventProcessor.cc | 2 +- FWCore/Framework/src/SubProcess.cc | 4 ++-- FWCore/Framework/src/Worker.h | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/FWCore/Framework/interface/BranchActionType.h b/FWCore/Framework/interface/BranchActionType.h index cf4279faf66fa..e5abd791349ac 100644 --- a/FWCore/Framework/interface/BranchActionType.h +++ b/FWCore/Framework/interface/BranchActionType.h @@ -13,7 +13,7 @@ namespace edm { BranchActionStreamBegin = 1, BranchActionStreamEnd = 2, BranchActionGlobalEnd = 3, - BranchActionGlobalOther = 4 + BranchActionProcessBlockInput = 4 }; } #endif diff --git a/FWCore/Framework/interface/OccurrenceTraits.h b/FWCore/Framework/interface/OccurrenceTraits.h index 4fa674bb91413..546acb63918d5 100644 --- a/FWCore/Framework/interface/OccurrenceTraits.h +++ b/FWCore/Framework/interface/OccurrenceTraits.h @@ -419,7 +419,7 @@ namespace edm { }; template <> - class OccurrenceTraits { + class OccurrenceTraits { public: using MyPrincipal = ProcessBlockPrincipal; using Context = GlobalContext; diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 985b31627e140..cb678bcfa0ba1 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -900,7 +900,7 @@ namespace edm { DelayedReader* reader = nullptr; processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName(), reader); - using Traits = OccurrenceTraits; + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 1ace20a522948..01d717af94e8e 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -413,7 +413,7 @@ namespace edm { } template <> - void SubProcess::doBeginProcessBlockAsync>( + void SubProcess::doBeginProcessBlockAsync>( WaitingTaskHolder iHolder, ProcessBlockPrincipal const& principal, IOVSyncValue const&, @@ -424,7 +424,7 @@ namespace edm { processBlockPrincipal.fillProcessBlockPrincipal(principal.processName(), principal.reader()); propagateProducts(InProcess, principal, processBlockPrincipal); - using Traits = OccurrenceTraits; + using Traits = OccurrenceTraits; beginGlobalTransitionAsync( std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); } diff --git a/FWCore/Framework/src/Worker.h b/FWCore/Framework/src/Worker.h index 0894ce507ce0d..cb69553daf3a1 100644 --- a/FWCore/Framework/src/Worker.h +++ b/FWCore/Framework/src/Worker.h @@ -832,9 +832,9 @@ namespace edm { static SerialTaskQueue* enableGlobalQueue(Worker*) { return nullptr; } }; template <> - class CallImpl> { + class CallImpl> { public: - typedef OccurrenceTraits Arg; + typedef OccurrenceTraits Arg; static bool call(Worker* iWorker, StreamID, ProcessBlockPrincipal const& pbp, From fa961fe6b719c08ae32204be43edf85926737c10 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 17 Jun 2020 21:23:26 +0200 Subject: [PATCH 16/25] Change override to final --- FWCore/Framework/interface/ProcessBlockPrincipal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Framework/interface/ProcessBlockPrincipal.h b/FWCore/Framework/interface/ProcessBlockPrincipal.h index e79876699717e..6001fc66a322f 100644 --- a/FWCore/Framework/interface/ProcessBlockPrincipal.h +++ b/FWCore/Framework/interface/ProcessBlockPrincipal.h @@ -35,7 +35,7 @@ namespace edm { unsigned int index() { return 0; } private: - unsigned int transitionIndex_() const override; + unsigned int transitionIndex_() const final; std::string processName_; }; From 97406bbb690c627ede3aa7aefceeba5304a14815 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 17 Jun 2020 21:24:12 +0200 Subject: [PATCH 17/25] Use loop in makeNameArray --- DataFormats/Provenance/src/BranchType.cc | 26 ++++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/DataFormats/Provenance/src/BranchType.cc b/DataFormats/Provenance/src/BranchType.cc index f00f4d14e6126..68f074cd887f7 100644 --- a/DataFormats/Provenance/src/BranchType.cc +++ b/DataFormats/Provenance/src/BranchType.cc @@ -22,35 +22,39 @@ namespace edm { std::array const branchTypeNames{{"Event", "LuminosityBlock", "Run", "ProcessBlock"}}; std::size_t constexpr eventLumiRunSize = 3; - using NameArray = const std::array; + using NameArray = std::array; NameArray makeNameArray(std::string const& postfix) { static_assert(InEvent == 0); static_assert(InLumi == 1); static_assert(InRun == 2); - return NameArray{ - {branchTypeNames[InEvent] + postfix, branchTypeNames[InLumi] + postfix, branchTypeNames[InRun] + postfix}}; + static_assert(InProcess == 3); + NameArray ret; + for (auto i = 0U; i != eventLumiRunSize; ++i) { + ret[i] = branchTypeNames[i] + postfix; + } + return ret; } - NameArray treeNames{makeNameArray(std::string("s"))}; + const NameArray treeNames{makeNameArray(std::string("s"))}; - NameArray metaTreeNames{makeNameArray(metaData)}; + const NameArray metaTreeNames{makeNameArray(metaData)}; // backward compatibility - NameArray infoNames{makeNameArray(std::string("StatusInformation"))}; + const NameArray infoNames{makeNameArray(std::string("StatusInformation"))}; - NameArray auxiliaryNames{makeNameArray(auxiliary)}; + const NameArray auxiliaryNames{makeNameArray(auxiliary)}; // backward compatibility - NameArray productStatusNames{makeNameArray(productStatus)}; + const NameArray productStatusNames{makeNameArray(productStatus)}; // backward compatibility - NameArray eventEntryInfoNames{makeNameArray(branchEntryInfo)}; + const NameArray eventEntryInfoNames{makeNameArray(branchEntryInfo)}; - NameArray productProvenanceNames{makeNameArray(productProvenance)}; + const NameArray productProvenanceNames{makeNameArray(productProvenance)}; // backward compatibility - NameArray auxNames{makeNameArray(aux)}; + const NameArray auxNames{makeNameArray(aux)}; std::string const entryDescriptionTree = "EntryDescription"; std::string const entryDescriptionIDBranch = "Hash"; From a8bfbf55682b47452f97570d59ae1c53e6b678ee Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 19 Jun 2020 17:05:13 +0200 Subject: [PATCH 18/25] Add curly braces for clarity --- FWCore/Framework/src/TransitionProcessors.icc | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/FWCore/Framework/src/TransitionProcessors.icc b/FWCore/Framework/src/TransitionProcessors.icc index 4daeb810c1c61..1c53bc4a1e754 100644 --- a/FWCore/Framework/src/TransitionProcessors.icc +++ b/FWCore/Framework/src/TransitionProcessors.icc @@ -257,27 +257,30 @@ private: } void gotoNewInputAndOutputFiles(EventProcessor& iEP) { - // If this is still true when we hit the destructor for - // the filesOpen_ object, then we will know an exception - // was thrown on one of the following 5 lines. - filesOpen_->closingSequenceAlreadyFailed_ = true; - - iEP.respondToCloseInputFile(); - bool cleaningUpAfterException = false; - iEP.closeInputFile(cleaningUpAfterException); - iEP.endProcessBlock(cleaningUpAfterException, filesOpen_->beginProcessBlockSucceeded_); - iEP.closeOutputFiles(); + { + // If this is still true when we hit the destructor for + // the filesOpen_ object, then we will know an exception + // was thrown on one of the following 5 lines. + filesOpen_->closingSequenceAlreadyFailed_ = true; + + iEP.respondToCloseInputFile(); + bool cleaningUpAfterException = false; + iEP.closeInputFile(cleaningUpAfterException); + iEP.endProcessBlock(cleaningUpAfterException, filesOpen_->beginProcessBlockSucceeded_); + iEP.closeOutputFiles(); + + filesOpen_->closingSequenceAlreadyFailed_ = false; + } + { + filesOpen_->beginProcessBlockSucceeded_ = false; - // Initialize these for the next output file - filesOpen_->closingSequenceAlreadyFailed_ = false; - filesOpen_->beginProcessBlockSucceeded_ = false; + iEP.readFile(); + iEP.respondToOpenInputFile(); - iEP.readFile(); - iEP.respondToOpenInputFile(); + iEP.openOutputFiles(); - iEP.openOutputFiles(); - - iEP.beginProcessBlock(filesOpen_->beginProcessBlockSucceeded_); + iEP.beginProcessBlock(filesOpen_->beginProcessBlockSucceeded_); + } iEP.inputProcessBlocks(); } From da0af141e591dea10bd5cd513ccee404ad3de8b4 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Sat, 20 Jun 2020 00:05:05 +0200 Subject: [PATCH 19/25] Remove extra space --- FWCore/ServiceRegistry/src/GlobalContext.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/ServiceRegistry/src/GlobalContext.cc b/FWCore/ServiceRegistry/src/GlobalContext.cc index db300d856fbd7..0be7f295641a0 100644 --- a/FWCore/ServiceRegistry/src/GlobalContext.cc +++ b/FWCore/ServiceRegistry/src/GlobalContext.cc @@ -99,7 +99,7 @@ namespace edm { os << "endJob"; break; case GlobalContext::Transition::kWriteProcessBlock: - os << "write ProcessBlock "; + os << "write ProcessBlock"; break; case GlobalContext::Transition::kWriteRun: os << "write Run " << RunID(gc.luminosityBlockID().run()); From c7711b50d0ecd0ecdb061ee6243488242bab69b5 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Sat, 20 Jun 2020 00:05:55 +0200 Subject: [PATCH 20/25] Initialize with BeginProcessBlock --- FWCore/Utilities/interface/Transition.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Utilities/interface/Transition.h b/FWCore/Utilities/interface/Transition.h index 8354fb56c5a0a..5e9b15210980c 100644 --- a/FWCore/Utilities/interface/Transition.h +++ b/FWCore/Utilities/interface/Transition.h @@ -18,7 +18,7 @@ namespace edm { BeginProcessBlock, EndProcessBlock, NumberOfTransitions, - NumberOfEventSetupTransitions = 5 + NumberOfEventSetupTransitions = BeginProcessBlock }; //Useful for converting EndBranchType to BranchType From 9ac7bbe624e64abaa7dbf7f6ca15a83428e90969 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 24 Jun 2020 17:16:33 +0200 Subject: [PATCH 21/25] Abilities WatchProcessBlock InputProcessBlockCache --- FWCore/Framework/interface/EDAnalyzer.h | 1 + FWCore/Framework/interface/EDFilter.h | 1 + FWCore/Framework/interface/EDProducer.h | 1 + .../Framework/interface/global/EDAnalyzer.h | 1 + .../interface/global/EDAnalyzerBase.h | 1 + FWCore/Framework/interface/global/EDFilter.h | 1 + .../Framework/interface/global/EDFilterBase.h | 1 + .../Framework/interface/global/EDProducer.h | 1 + .../interface/global/EDProducerBase.h | 1 + .../Framework/interface/global/OutputModule.h | 1 + .../interface/global/OutputModuleBase.h | 1 + .../global/analyzerAbilityToImplementor.h | 9 +++- .../global/filterAbilityToImplementor.h | 9 +++- .../Framework/interface/global/implementors.h | 42 ++++++++------- .../global/producerAbilityToImplementor.h | 9 +++- .../Framework/interface/limited/EDAnalyzer.h | 1 + .../interface/limited/EDAnalyzerBase.h | 1 + FWCore/Framework/interface/limited/EDFilter.h | 1 + .../interface/limited/EDFilterBase.h | 1 + .../Framework/interface/limited/EDProducer.h | 1 + .../interface/limited/EDProducerBase.h | 1 + .../interface/limited/OutputModule.h | 1 + .../interface/limited/OutputModuleBase.h | 1 + .../limited/analyzerAbilityToImplementor.h | 9 +++- .../limited/filterAbilityToImplementor.h | 9 +++- .../interface/limited/implementors.h | 41 +++++++------- .../limited/producerAbilityToImplementor.h | 9 +++- FWCore/Framework/interface/moduleAbilities.h | 16 ++++-- .../Framework/interface/moduleAbilityEnums.h | 3 +- FWCore/Framework/interface/one/EDAnalyzer.h | 1 + .../Framework/interface/one/EDAnalyzerBase.h | 1 + FWCore/Framework/interface/one/EDFilter.h | 1 + FWCore/Framework/interface/one/EDFilterBase.h | 1 + FWCore/Framework/interface/one/EDProducer.h | 1 + .../Framework/interface/one/EDProducerBase.h | 1 + FWCore/Framework/interface/one/OutputModule.h | 1 + .../interface/one/OutputModuleBase.h | 1 + .../one/analyzerAbilityToImplementor.h | 9 +++- .../one/filterAbilityToImplementor.h | 9 +++- FWCore/Framework/interface/one/implementors.h | 42 ++++++++------- .../one/producerAbilityToImplementor.h | 9 +++- .../interface/stream/AbilityChecker.h | 12 +++-- .../interface/stream/AbilityToImplementor.h | 9 +++- .../interface/stream/EDAnalyzerAdaptor.h | 18 ++++--- .../interface/stream/EDAnalyzerAdaptorBase.h | 1 + .../interface/stream/ProducingModuleAdaptor.h | 18 ++++--- .../stream/ProducingModuleAdaptorBase.h | 1 + .../interface/stream/callAbilities.h | 53 ++++++++++++------- .../Framework/interface/stream/implementors.h | 24 ++++++--- FWCore/Framework/src/Worker.h | 3 +- FWCore/Framework/src/WorkerT.cc | 5 ++ FWCore/Framework/src/WorkerT.h | 1 + .../src/global/analyzerImplementors.cc | 18 +++++++ .../src/global/filterImplementors.cc | 1 + .../src/global/implementorsMethods.h | 11 ++++ .../src/global/producerImplementors.cc | 1 + .../src/limited/analyzerImplementors.cc | 18 +++++++ .../src/limited/filterImplementors.cc | 1 + .../src/limited/implementorsMethods.h | 10 ++++ .../src/limited/producerImplementors.cc | 1 + .../Framework/src/one/analyzerImplementors.cc | 1 + .../Framework/src/one/filterImplementors.cc | 1 + .../Framework/src/one/implementorsMethods.h | 10 ++++ .../Framework/src/one/producerImplementors.cc | 1 + .../test/stubs/TestGlobalAnalyzers.cc | 2 +- .../Framework/test/stubs/TestGlobalFilters.cc | 2 +- .../test/stubs/TestGlobalProducers.cc | 2 +- .../test/stubs/TestLimitedAnalyzers.cc | 4 +- .../test/stubs/TestLimitedFilters.cc | 4 +- .../test/stubs/TestLimitedProducers.cc | 4 +- .../Framework/test/stubs/TestOneAnalyzers.cc | 2 +- FWCore/Framework/test/stubs/TestOneFilters.cc | 2 +- .../Framework/test/stubs/TestOneProducers.cc | 2 +- .../test/stubs/TestStreamAnalyzers.cc | 8 +-- .../Framework/test/stubs/TestStreamFilters.cc | 8 +-- .../test/stubs/TestStreamProducers.cc | 8 +-- FWCore/Integration/test/TestFindProduct.cc | 7 +-- FWCore/MessageService/test/UnitTestClient_V.h | 2 +- 78 files changed, 373 insertions(+), 155 deletions(-) create mode 100644 FWCore/Framework/src/global/analyzerImplementors.cc create mode 100644 FWCore/Framework/src/limited/analyzerImplementors.cc diff --git a/FWCore/Framework/interface/EDAnalyzer.h b/FWCore/Framework/interface/EDAnalyzer.h index cf23d2d6f600d..4fe8d75718a2f 100644 --- a/FWCore/Framework/interface/EDAnalyzer.h +++ b/FWCore/Framework/interface/EDAnalyzer.h @@ -47,6 +47,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } static bool wantsProcessBlocks() { return false; } + static bool wantsInputProcessBlocks() { return false; } static bool wantsGlobalRuns() { return true; } static bool wantsGlobalLuminosityBlocks() { return true; } static bool wantsStreamRuns() { return false; } diff --git a/FWCore/Framework/interface/EDFilter.h b/FWCore/Framework/interface/EDFilter.h index 446786f3d8506..77acdfbf45180 100644 --- a/FWCore/Framework/interface/EDFilter.h +++ b/FWCore/Framework/interface/EDFilter.h @@ -56,6 +56,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } static bool wantsProcessBlocks() { return false; } + static bool wantsInputProcessBlocks() { return false; } static bool wantsGlobalRuns() { return true; } static bool wantsGlobalLuminosityBlocks() { return true; } static bool wantsStreamRuns() { return false; } diff --git a/FWCore/Framework/interface/EDProducer.h b/FWCore/Framework/interface/EDProducer.h index 01b15bcbe7a19..6d401aef24807 100644 --- a/FWCore/Framework/interface/EDProducer.h +++ b/FWCore/Framework/interface/EDProducer.h @@ -52,6 +52,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } static bool wantsProcessBlocks() { return false; } + static bool wantsInputProcessBlocks() { return false; } static bool wantsGlobalRuns() { return true; } static bool wantsGlobalLuminosityBlocks() { return true; } static bool wantsStreamRuns() { return false; } diff --git a/FWCore/Framework/interface/global/EDAnalyzer.h b/FWCore/Framework/interface/global/EDAnalyzer.h index e118dccaf7a5b..3c4339dc46d02 100644 --- a/FWCore/Framework/interface/global/EDAnalyzer.h +++ b/FWCore/Framework/interface/global/EDAnalyzer.h @@ -40,6 +40,7 @@ namespace edm { #endif // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/global/EDAnalyzerBase.h b/FWCore/Framework/interface/global/EDAnalyzerBase.h index 13fb456ab729d..ceb28c1352e69 100644 --- a/FWCore/Framework/interface/global/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/global/EDAnalyzerBase.h @@ -63,6 +63,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; diff --git a/FWCore/Framework/interface/global/EDFilter.h b/FWCore/Framework/interface/global/EDFilter.h index 73fd40c268c25..f12cd6a632d6c 100644 --- a/FWCore/Framework/interface/global/EDFilter.h +++ b/FWCore/Framework/interface/global/EDFilter.h @@ -46,6 +46,7 @@ namespace edm { #endif // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/global/EDFilterBase.h b/FWCore/Framework/interface/global/EDFilterBase.h index 39bf65894139a..b52b595ac81af 100644 --- a/FWCore/Framework/interface/global/EDFilterBase.h +++ b/FWCore/Framework/interface/global/EDFilterBase.h @@ -66,6 +66,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; diff --git a/FWCore/Framework/interface/global/EDProducer.h b/FWCore/Framework/interface/global/EDProducer.h index 93e3d168aafaa..cb02f21862407 100644 --- a/FWCore/Framework/interface/global/EDProducer.h +++ b/FWCore/Framework/interface/global/EDProducer.h @@ -41,6 +41,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/global/EDProducerBase.h b/FWCore/Framework/interface/global/EDProducerBase.h index 8e6cbcb6fbafb..698acc25cbe7f 100644 --- a/FWCore/Framework/interface/global/EDProducerBase.h +++ b/FWCore/Framework/interface/global/EDProducerBase.h @@ -69,6 +69,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; diff --git a/FWCore/Framework/interface/global/OutputModule.h b/FWCore/Framework/interface/global/OutputModule.h index 3ed732150c52a..1d4069987f8d8 100644 --- a/FWCore/Framework/interface/global/OutputModule.h +++ b/FWCore/Framework/interface/global/OutputModule.h @@ -39,6 +39,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/global/OutputModuleBase.h b/FWCore/Framework/interface/global/OutputModuleBase.h index 75d554a4e4a04..bb06007822e35 100644 --- a/FWCore/Framework/interface/global/OutputModuleBase.h +++ b/FWCore/Framework/interface/global/OutputModuleBase.h @@ -111,6 +111,7 @@ namespace edm { bool wantsGlobalLuminosityBlocks() const { return true; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; virtual bool wantsStreamLuminosityBlocks() const = 0; diff --git a/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h b/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h index d4ee7577e0cc6..df0791109aea4 100644 --- a/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h +++ b/FWCore/Framework/interface/global/analyzerAbilityToImplementor.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::global::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::global::impl::InputProcessBlockCacheHolder Type; }; template @@ -61,6 +61,11 @@ namespace edm { struct AbilityToImplementor> { typedef edm::global::impl::LuminosityBlockSummaryCacheHolder Type; }; + + template <> + struct AbilityToImplementor { + typedef edm::global::impl::WatchProcessBlock Type; + }; } // namespace analyzer } // namespace global } // namespace edm diff --git a/FWCore/Framework/interface/global/filterAbilityToImplementor.h b/FWCore/Framework/interface/global/filterAbilityToImplementor.h index 9c623e6c39ea8..2669601b50384 100644 --- a/FWCore/Framework/interface/global/filterAbilityToImplementor.h +++ b/FWCore/Framework/interface/global/filterAbilityToImplementor.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::global::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::global::impl::InputProcessBlockCacheHolder Type; }; template @@ -62,6 +62,11 @@ namespace edm { typedef edm::global::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::global::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::global::impl::BeginProcessBlockProducer Type; diff --git a/FWCore/Framework/interface/global/implementors.h b/FWCore/Framework/interface/global/implementors.h index 0671783d94bcf..9d39d4981bca3 100644 --- a/FWCore/Framework/interface/global/implementors.h +++ b/FWCore/Framework/interface/global/implementors.h @@ -88,36 +88,26 @@ namespace edm { }; template - class ProcessBlockCacheHolder : public virtual T { + class InputProcessBlockCacheHolder : public virtual T { public: - ProcessBlockCacheHolder() = default; - ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; - ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; - ~ProcessBlockCacheHolder() override {} + InputProcessBlockCacheHolder() = default; + InputProcessBlockCacheHolder(InputProcessBlockCacheHolder const&) = delete; + InputProcessBlockCacheHolder& operator=(InputProcessBlockCacheHolder const&) = delete; + ~InputProcessBlockCacheHolder() override {} protected: // Not implemented yet - // const C* processBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } + // const C* inputProcessBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } private: - void doBeginProcessBlock_(ProcessBlock const& pb) final { beginProcessBlock(pb); } - // Not yet fully implemented, will never get called + // THINK ABOUT HOW TO CLEAR CACHES!!! void doAccessInputProcessBlock_(ProcessBlock const& pb) final { caches_.push_back(accessInputProcessBlock(pb)); } - void doEndProcessBlock_(ProcessBlock const& pb) final { - endProcessBlock(pb); - caches_.clear(); - } - - virtual void beginProcessBlock(ProcessBlock const&) const {} - // Not yet fully implemented, will never get called - virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) const { return std::shared_ptr(); } - - virtual void endProcessBlock(ProcessBlock const&) const {} + virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) const = 0; std::vector> caches_; }; @@ -253,6 +243,22 @@ namespace edm { std::mutex mutex_; }; + template + class WatchProcessBlock : public virtual T { + public: + WatchProcessBlock() = default; + WatchProcessBlock(WatchProcessBlock const&) = delete; + WatchProcessBlock& operator=(WatchProcessBlock const&) = delete; + ~WatchProcessBlock() noexcept(false) override {} + + private: + void doBeginProcessBlock_(ProcessBlock const&) final; + void doEndProcessBlock_(ProcessBlock const&) final; + + virtual void beginProcessBlock(ProcessBlock const&) const {} + virtual void endProcessBlock(ProcessBlock const&) const {} + }; + template class BeginProcessBlockProducer : public virtual T { public: diff --git a/FWCore/Framework/interface/global/producerAbilityToImplementor.h b/FWCore/Framework/interface/global/producerAbilityToImplementor.h index 85bec4ef26f85..f25ae4d7f8b1b 100644 --- a/FWCore/Framework/interface/global/producerAbilityToImplementor.h +++ b/FWCore/Framework/interface/global/producerAbilityToImplementor.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::global::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::global::impl::InputProcessBlockCacheHolder Type; }; template @@ -62,6 +62,11 @@ namespace edm { typedef edm::global::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::global::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::global::impl::BeginProcessBlockProducer Type; diff --git a/FWCore/Framework/interface/limited/EDAnalyzer.h b/FWCore/Framework/interface/limited/EDAnalyzer.h index bb16d6463df4d..ec5cd655b8e0b 100644 --- a/FWCore/Framework/interface/limited/EDAnalyzer.h +++ b/FWCore/Framework/interface/limited/EDAnalyzer.h @@ -41,6 +41,7 @@ namespace edm { #endif // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } diff --git a/FWCore/Framework/interface/limited/EDAnalyzerBase.h b/FWCore/Framework/interface/limited/EDAnalyzerBase.h index d957cbd3bb466..ae21ce79d80a7 100644 --- a/FWCore/Framework/interface/limited/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/limited/EDAnalyzerBase.h @@ -64,6 +64,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; diff --git a/FWCore/Framework/interface/limited/EDFilter.h b/FWCore/Framework/interface/limited/EDFilter.h index 74970f64a516b..e8ace6806d208 100644 --- a/FWCore/Framework/interface/limited/EDFilter.h +++ b/FWCore/Framework/interface/limited/EDFilter.h @@ -53,6 +53,7 @@ namespace edm { #endif // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } diff --git a/FWCore/Framework/interface/limited/EDFilterBase.h b/FWCore/Framework/interface/limited/EDFilterBase.h index 09067559c3f2f..bd9f026eb3dd0 100644 --- a/FWCore/Framework/interface/limited/EDFilterBase.h +++ b/FWCore/Framework/interface/limited/EDFilterBase.h @@ -66,6 +66,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; diff --git a/FWCore/Framework/interface/limited/EDProducer.h b/FWCore/Framework/interface/limited/EDProducer.h index 9650d02cb69e6..caaf7061fdcd0 100644 --- a/FWCore/Framework/interface/limited/EDProducer.h +++ b/FWCore/Framework/interface/limited/EDProducer.h @@ -48,6 +48,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } diff --git a/FWCore/Framework/interface/limited/EDProducerBase.h b/FWCore/Framework/interface/limited/EDProducerBase.h index 80e186c234a96..b3e4a23d3c677 100644 --- a/FWCore/Framework/interface/limited/EDProducerBase.h +++ b/FWCore/Framework/interface/limited/EDProducerBase.h @@ -69,6 +69,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; diff --git a/FWCore/Framework/interface/limited/OutputModule.h b/FWCore/Framework/interface/limited/OutputModule.h index f96ce9de886f7..861543cb3dd7c 100644 --- a/FWCore/Framework/interface/limited/OutputModule.h +++ b/FWCore/Framework/interface/limited/OutputModule.h @@ -39,6 +39,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsStreamRuns() const final { return WantsStreamRunTransitions::value; } bool wantsStreamLuminosityBlocks() const final { return WantsStreamLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/limited/OutputModuleBase.h b/FWCore/Framework/interface/limited/OutputModuleBase.h index c2109db01b2c1..3019b4e3d42a6 100644 --- a/FWCore/Framework/interface/limited/OutputModuleBase.h +++ b/FWCore/Framework/interface/limited/OutputModuleBase.h @@ -111,6 +111,7 @@ namespace edm { bool wantsGlobalRuns() const { return true; } bool wantsGlobalLuminosityBlocks() const { return true; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; virtual bool wantsStreamLuminosityBlocks() const = 0; diff --git a/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h b/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h index 68b9d330f7c76..c1892ca242836 100644 --- a/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h +++ b/FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::limited::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::limited::impl::InputProcessBlockCacheHolder Type; }; template @@ -61,6 +61,11 @@ namespace edm { struct AbilityToImplementor> { typedef edm::limited::impl::LuminosityBlockSummaryCacheHolder Type; }; + + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::WatchProcessBlock Type; + }; } // namespace analyzer } // namespace limited } // namespace edm diff --git a/FWCore/Framework/interface/limited/filterAbilityToImplementor.h b/FWCore/Framework/interface/limited/filterAbilityToImplementor.h index 432000883d4ae..047155773044f 100644 --- a/FWCore/Framework/interface/limited/filterAbilityToImplementor.h +++ b/FWCore/Framework/interface/limited/filterAbilityToImplementor.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::limited::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::limited::impl::InputProcessBlockCacheHolder Type; }; template @@ -62,6 +62,11 @@ namespace edm { typedef edm::limited::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::limited::impl::BeginProcessBlockProducer Type; diff --git a/FWCore/Framework/interface/limited/implementors.h b/FWCore/Framework/interface/limited/implementors.h index 25ca3a2cc51b5..701fb1234f53b 100644 --- a/FWCore/Framework/interface/limited/implementors.h +++ b/FWCore/Framework/interface/limited/implementors.h @@ -89,36 +89,25 @@ namespace edm { }; template - class ProcessBlockCacheHolder : public virtual T { + class InputProcessBlockCacheHolder : public virtual T { public: - ProcessBlockCacheHolder(edm::ParameterSet const& iPSet) : T(iPSet) {} - ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; - ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; - ~ProcessBlockCacheHolder() noexcept(false) override {} + InputProcessBlockCacheHolder(edm::ParameterSet const& iPSet) : T(iPSet) {} + InputProcessBlockCacheHolder(InputProcessBlockCacheHolder const&) = delete; + InputProcessBlockCacheHolder& operator=(InputProcessBlockCacheHolder const&) = delete; + ~InputProcessBlockCacheHolder() noexcept(false) override {} protected: // Not implemented yet - // const C* processBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } + // const C* inputProcessBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } private: - void doBeginProcessBlock_(ProcessBlock const& pb) final { beginProcessBlock(pb); } - // Not yet fully implemented, will never get called void doAccessInputProcessBlock_(ProcessBlock const& pb) final { caches_.push_back(accessInputProcessBlock(pb)); } - void doEndProcessBlock_(ProcessBlock const& pb) final { - endProcessBlock(pb); - caches_.clear(); - } - - virtual void beginProcessBlock(ProcessBlock const&) const {} - // Not yet fully implemented, will never get called - virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) const { return std::shared_ptr(); } - - virtual void endProcessBlock(ProcessBlock const&) const {} + virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) const = 0; std::vector> caches_; }; @@ -254,6 +243,22 @@ namespace edm { std::mutex mutex_; }; + template + class WatchProcessBlock : public virtual T { + public: + WatchProcessBlock(edm::ParameterSet const& iPSet) : T(iPSet) {} + WatchProcessBlock(WatchProcessBlock const&) = delete; + WatchProcessBlock& operator=(WatchProcessBlock const&) = delete; + ~WatchProcessBlock() noexcept(false) override{}; + + private: + void doBeginProcessBlock_(ProcessBlock const&) final; + void doEndProcessBlock_(ProcessBlock const&) final; + + virtual void beginProcessBlock(ProcessBlock const&) const {} + virtual void endProcessBlock(ProcessBlock const&) const {} + }; + template class BeginProcessBlockProducer : public virtual T { public: diff --git a/FWCore/Framework/interface/limited/producerAbilityToImplementor.h b/FWCore/Framework/interface/limited/producerAbilityToImplementor.h index b9ecec5b41049..89db9d304e5c3 100644 --- a/FWCore/Framework/interface/limited/producerAbilityToImplementor.h +++ b/FWCore/Framework/interface/limited/producerAbilityToImplementor.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::limited::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::limited::impl::InputProcessBlockCacheHolder Type; }; template @@ -62,6 +62,11 @@ namespace edm { typedef edm::limited::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::limited::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::limited::impl::BeginProcessBlockProducer Type; diff --git a/FWCore/Framework/interface/moduleAbilities.h b/FWCore/Framework/interface/moduleAbilities.h index ee3b324845486..67f915a2aa340 100644 --- a/FWCore/Framework/interface/moduleAbilities.h +++ b/FWCore/Framework/interface/moduleAbilities.h @@ -45,8 +45,8 @@ namespace edm { }; template - struct ProcessBlockCache { - static constexpr module::Abilities kAbilities = module::Abilities::kProcessBlockCache; + struct InputProcessBlockCache { + static constexpr module::Abilities kAbilities = module::Abilities::kInputProcessBlockCache; typedef T Type; }; @@ -74,6 +74,11 @@ namespace edm { typedef T Type; }; + struct WatchProcessBlock { + static constexpr module::Abilities kAbilities = module::Abilities::kWatchProcessBlock; + typedef module::Empty Type; + }; + struct BeginProcessBlockProducer { static constexpr module::Abilities kAbilities = module::Abilities::kBeginProcessBlockProducer; typedef module::Empty Type; @@ -140,11 +145,16 @@ namespace edm { template struct WantsProcessBlockTransitions { - static constexpr bool value = CheckAbility::kHasIt or + static constexpr bool value = CheckAbility::kHasIt or CheckAbility::kHasIt or CheckAbility::kHasIt; }; + template + struct WantsInputProcessBlockTransitions { + static constexpr bool value = CheckAbility::kHasIt; + }; + template struct WantsGlobalRunTransitions { static constexpr bool value = CheckAbility::kHasIt or diff --git a/FWCore/Framework/interface/moduleAbilityEnums.h b/FWCore/Framework/interface/moduleAbilityEnums.h index 184f7b447044d..bf89bc70f57d5 100644 --- a/FWCore/Framework/interface/moduleAbilityEnums.h +++ b/FWCore/Framework/interface/moduleAbilityEnums.h @@ -30,11 +30,12 @@ namespace edm { enum class Abilities { kGlobalCache, kStreamCache, - kProcessBlockCache, + kInputProcessBlockCache, kRunCache, kLuminosityBlockCache, kRunSummaryCache, kLuminosityBlockSummaryCache, + kWatchProcessBlock, kBeginProcessBlockProducer, kEndProcessBlockProducer, kBeginRunProducer, diff --git a/FWCore/Framework/interface/one/EDAnalyzer.h b/FWCore/Framework/interface/one/EDAnalyzer.h index 1873819359722..8cdd4e7f5bceb 100644 --- a/FWCore/Framework/interface/one/EDAnalyzer.h +++ b/FWCore/Framework/interface/one/EDAnalyzer.h @@ -43,6 +43,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/one/EDAnalyzerBase.h b/FWCore/Framework/interface/one/EDAnalyzerBase.h index 7eeb7aaaa2363..2cd41d7a74132 100644 --- a/FWCore/Framework/interface/one/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/one/EDAnalyzerBase.h @@ -64,6 +64,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } diff --git a/FWCore/Framework/interface/one/EDFilter.h b/FWCore/Framework/interface/one/EDFilter.h index 5ac4f42e002c3..82de920e814b2 100644 --- a/FWCore/Framework/interface/one/EDFilter.h +++ b/FWCore/Framework/interface/one/EDFilter.h @@ -40,6 +40,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/one/EDFilterBase.h b/FWCore/Framework/interface/one/EDFilterBase.h index 9b80b98f54fe7..c1196fe3fcb9a 100644 --- a/FWCore/Framework/interface/one/EDFilterBase.h +++ b/FWCore/Framework/interface/one/EDFilterBase.h @@ -64,6 +64,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } diff --git a/FWCore/Framework/interface/one/EDProducer.h b/FWCore/Framework/interface/one/EDProducer.h index ca2faad5a1d02..27ab9ce4bdcd4 100644 --- a/FWCore/Framework/interface/one/EDProducer.h +++ b/FWCore/Framework/interface/one/EDProducer.h @@ -44,6 +44,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/one/EDProducerBase.h b/FWCore/Framework/interface/one/EDProducerBase.h index c470fb382c5e4..2cb1fd9fe9cc4 100644 --- a/FWCore/Framework/interface/one/EDProducerBase.h +++ b/FWCore/Framework/interface/one/EDProducerBase.h @@ -64,6 +64,7 @@ namespace edm { ModuleDescription const& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } diff --git a/FWCore/Framework/interface/one/OutputModule.h b/FWCore/Framework/interface/one/OutputModule.h index 0653422881ff3..b242ad94f0729 100644 --- a/FWCore/Framework/interface/one/OutputModule.h +++ b/FWCore/Framework/interface/one/OutputModule.h @@ -41,6 +41,7 @@ namespace edm { // ---------- const member functions --------------------- bool wantsProcessBlocks() const final { return WantsProcessBlockTransitions::value; } + bool wantsInputProcessBlocks() const final { return WantsInputProcessBlockTransitions::value; } bool wantsGlobalRuns() const final { return WantsGlobalRunTransitions::value; } bool wantsGlobalLuminosityBlocks() const final { return WantsGlobalLuminosityBlockTransitions::value; } diff --git a/FWCore/Framework/interface/one/OutputModuleBase.h b/FWCore/Framework/interface/one/OutputModuleBase.h index b7d49d4189e92..7f7f2858a8ac1 100644 --- a/FWCore/Framework/interface/one/OutputModuleBase.h +++ b/FWCore/Framework/interface/one/OutputModuleBase.h @@ -105,6 +105,7 @@ namespace edm { //Output modules always need writeRun and writeLumi to be called virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return false; } diff --git a/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h b/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h index 58e8bfd4cd134..9616227d747fc 100644 --- a/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h +++ b/FWCore/Framework/interface/one/analyzerAbilityToImplementor.h @@ -50,8 +50,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::one::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::one::impl::InputProcessBlockCacheHolder Type; }; template @@ -63,6 +63,11 @@ namespace edm { struct AbilityToImplementor> { typedef edm::one::impl::LuminosityBlockCacheHolder Type; }; + + template <> + struct AbilityToImplementor { + typedef edm::one::impl::WatchProcessBlock Type; + }; } // namespace analyzer } // namespace one } // namespace edm diff --git a/FWCore/Framework/interface/one/filterAbilityToImplementor.h b/FWCore/Framework/interface/one/filterAbilityToImplementor.h index 3e7e0446dc16a..fe441596a8b33 100644 --- a/FWCore/Framework/interface/one/filterAbilityToImplementor.h +++ b/FWCore/Framework/interface/one/filterAbilityToImplementor.h @@ -49,6 +49,11 @@ namespace edm { typedef edm::one::impl::LuminosityBlockWatcher Type; }; + template <> + struct AbilityToImplementor { + typedef edm::one::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::one::impl::BeginProcessBlockProducer Type; @@ -80,8 +85,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::one::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::one::impl::InputProcessBlockCacheHolder Type; }; template diff --git a/FWCore/Framework/interface/one/implementors.h b/FWCore/Framework/interface/one/implementors.h index 455b43777b5d3..87c6160fd7f88 100644 --- a/FWCore/Framework/interface/one/implementors.h +++ b/FWCore/Framework/interface/one/implementors.h @@ -103,6 +103,22 @@ namespace edm { virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) = 0; }; + template + class WatchProcessBlock : public virtual T { + public: + WatchProcessBlock() = default; + WatchProcessBlock(WatchProcessBlock const&) = delete; + WatchProcessBlock& operator=(WatchProcessBlock const&) = delete; + ~WatchProcessBlock() noexcept(false) override {} + + private: + void doBeginProcessBlock_(ProcessBlock const&) final; + void doEndProcessBlock_(ProcessBlock const&) final; + + virtual void beginProcessBlock(ProcessBlock const&) {} + virtual void endProcessBlock(ProcessBlock const&) {} + }; + template class BeginProcessBlockProducer : public virtual T { public: @@ -188,36 +204,26 @@ namespace edm { }; template - class ProcessBlockCacheHolder : public virtual T { + class InputProcessBlockCacheHolder : public virtual T { public: - ProcessBlockCacheHolder() = default; - ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; - ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; - ~ProcessBlockCacheHolder() override {} + InputProcessBlockCacheHolder() = default; + InputProcessBlockCacheHolder(InputProcessBlockCacheHolder const&) = delete; + InputProcessBlockCacheHolder& operator=(InputProcessBlockCacheHolder const&) = delete; + ~InputProcessBlockCacheHolder() override {} protected: // Not implemented yet - // const C* processBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } + // const C* inputProcessBlockCache(ProcessBlockIndex index) const { return caches_.at(index).get(); } private: - void doBeginProcessBlock_(ProcessBlock const& pb) final { beginProcessBlock(pb); } - // Not yet fully implemented, will never get called + // THINK ABOUT HOW CACHES ARE CLEARED!!! void doAccessInputProcessBlock_(ProcessBlock const& pb) final { caches_.push_back(accessInputProcessBlock(pb)); } - void doEndProcessBlock_(ProcessBlock const& pb) final { - endProcessBlock(pb); - caches_.clear(); - } - - virtual void beginProcessBlock(ProcessBlock const&) {} - // Not yet fully implemented, will never get called - virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) { return std::shared_ptr(); } - - virtual void endProcessBlock(ProcessBlock const&) {} + virtual std::shared_ptr accessInputProcessBlock(ProcessBlock const&) = 0; std::vector> caches_; }; diff --git a/FWCore/Framework/interface/one/producerAbilityToImplementor.h b/FWCore/Framework/interface/one/producerAbilityToImplementor.h index 53f3e98065a9a..8af9bc969db5c 100644 --- a/FWCore/Framework/interface/one/producerAbilityToImplementor.h +++ b/FWCore/Framework/interface/one/producerAbilityToImplementor.h @@ -49,6 +49,11 @@ namespace edm { typedef edm::one::impl::LuminosityBlockWatcher Type; }; + template <> + struct AbilityToImplementor { + typedef edm::one::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::one::impl::BeginProcessBlockProducer Type; @@ -80,8 +85,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::one::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::one::impl::InputProcessBlockCacheHolder Type; }; template diff --git a/FWCore/Framework/interface/stream/AbilityChecker.h b/FWCore/Framework/interface/stream/AbilityChecker.h index db89a9267eb3f..2c139818b29a3 100644 --- a/FWCore/Framework/interface/stream/AbilityChecker.h +++ b/FWCore/Framework/interface/stream/AbilityChecker.h @@ -38,8 +38,8 @@ namespace edm { }; template - struct HasAbility, U...> : public HasAbility { - static constexpr bool kProcessBlockCache = true; + struct HasAbility, U...> : public HasAbility { + static constexpr bool kInputProcessBlockCache = true; }; template @@ -62,6 +62,11 @@ namespace edm { static constexpr bool kLuminosityBlockSummaryCache = true; }; + template + struct HasAbility : public HasAbility { + static constexpr bool kWatchProcessBlock = true; + }; + template struct HasAbility : public HasAbility { static constexpr bool kBeginProcessBlockProducer = true; @@ -105,11 +110,12 @@ namespace edm { template <> struct HasAbility { static constexpr bool kGlobalCache = false; - static constexpr bool kProcessBlockCache = false; + static constexpr bool kInputProcessBlockCache = false; static constexpr bool kRunCache = false; static constexpr bool kLuminosityBlockCache = false; static constexpr bool kRunSummaryCache = false; static constexpr bool kLuminosityBlockSummaryCache = false; + static constexpr bool kWatchProcessBlock = false; static constexpr bool kBeginProcessBlockProducer = false; static constexpr bool kEndProcessBlockProducer = false; static constexpr bool kBeginRunProducer = false; diff --git a/FWCore/Framework/interface/stream/AbilityToImplementor.h b/FWCore/Framework/interface/stream/AbilityToImplementor.h index 850236ed469a2..d1d9825031615 100644 --- a/FWCore/Framework/interface/stream/AbilityToImplementor.h +++ b/FWCore/Framework/interface/stream/AbilityToImplementor.h @@ -36,8 +36,8 @@ namespace edm { }; template - struct AbilityToImplementor> { - typedef edm::stream::impl::ProcessBlockCacheHolder Type; + struct AbilityToImplementor> { + typedef edm::stream::impl::InputProcessBlockCacheHolder Type; }; template @@ -60,6 +60,11 @@ namespace edm { typedef edm::stream::impl::LuminosityBlockSummaryCacheHolder Type; }; + template <> + struct AbilityToImplementor { + typedef edm::stream::impl::WatchProcessBlock Type; + }; + template <> struct AbilityToImplementor { typedef edm::stream::impl::BeginProcessBlockProducer Type; diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h index 685950e5c1e52..30d148fc34728 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptor.h @@ -64,7 +64,8 @@ namespace edm { static void fillDescriptions(ConfigurationDescriptions& descriptions) { T::fillDescriptions(descriptions); } static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); } - bool wantsProcessBlocks() const final { return T::HasAbility::kProcessBlockCache; } + bool wantsProcessBlocks() const final { return T::HasAbility::kWatchProcessBlock; } + bool wantsInputProcessBlocks() const final { return T::HasAbility::kInputProcessBlockCache; } bool wantsGlobalRuns() const final { return T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache; } bool wantsGlobalLuminosityBlocks() const final { return T::HasAbility::kLuminosityBlockCache or T::HasAbility::kLuminosityBlockSummaryCache; @@ -72,7 +73,8 @@ namespace edm { private: using MyGlobal = CallGlobal; - using MyGlobalProcessBlock = CallGlobalProcessBlock; + using MyInputProcessBlock = CallInputProcessBlock; + using MyWatchProcessBlock = CallWatchProcessBlock; using MyGlobalRun = CallGlobalRun; using MyGlobalRunSummary = CallGlobalRunSummary; using MyGlobalLuminosityBlock = CallGlobalLuminosityBlock; @@ -113,29 +115,29 @@ namespace edm { } void doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { - if constexpr (T::HasAbility::kProcessBlockCache) { + if constexpr (T::HasAbility::kWatchProcessBlock) { ProcessBlock processBlock(pbp, moduleDescription(), mcc, false); processBlock.setConsumer(consumer()); ProcessBlock const& cnstProcessBlock = processBlock; - MyGlobalProcessBlock::beginProcessBlock(cnstProcessBlock, m_global.get()); + MyWatchProcessBlock::beginProcessBlock(cnstProcessBlock, m_global.get()); } } void doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { - if constexpr (T::HasAbility::kProcessBlockCache) { + if constexpr (T::HasAbility::kInputProcessBlockCache) { ProcessBlock processBlock(pbp, moduleDescription(), mcc, false); processBlock.setConsumer(consumer()); ProcessBlock const& cnstProcessBlock = processBlock; - MyGlobalProcessBlock::accessInputProcessBlock(cnstProcessBlock, m_global.get()); + MyInputProcessBlock::accessInputProcessBlock(cnstProcessBlock, m_global.get()); } } void doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { - if constexpr (T::HasAbility::kProcessBlockCache) { + if constexpr (T::HasAbility::kWatchProcessBlock) { ProcessBlock processBlock(pbp, moduleDescription(), mcc, true); processBlock.setConsumer(consumer()); ProcessBlock const& cnstProcessBlock = processBlock; - MyGlobalProcessBlock::endProcessBlock(cnstProcessBlock, m_global.get()); + MyWatchProcessBlock::endProcessBlock(cnstProcessBlock, m_global.get()); } } diff --git a/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h b/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h index 86c10e557e6e7..b7bf3e1caa034 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerAdaptorBase.h @@ -79,6 +79,7 @@ namespace edm { const ModuleDescription& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; bool wantsStreamRuns() const { return true; } diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h index ebd9f75d2f89f..2e27df8dec14c 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptor.h @@ -53,9 +53,10 @@ namespace edm { static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); } bool wantsProcessBlocks() const final { - return T::HasAbility::kProcessBlockCache or T::HasAbility::kBeginProcessBlockProducer or + return T::HasAbility::kWatchProcessBlock or T::HasAbility::kBeginProcessBlockProducer or T::HasAbility::kEndProcessBlockProducer; } + bool wantsInputProcessBlocks() const final { return T::HasAbility::kInputProcessBlockCache; } bool wantsGlobalRuns() const final { return T::HasAbility::kRunCache or T::HasAbility::kRunSummaryCache or T::HasAbility::kBeginRunProducer or T::HasAbility::kEndRunProducer; @@ -71,7 +72,8 @@ namespace edm { private: using MyGlobal = CallGlobal; - using MyGlobalProcessBlock = CallGlobalProcessBlock; + using MyInputProcessBlock = CallInputProcessBlock; + using MyWatchProcessBlock = CallWatchProcessBlock; using MyBeginProcessBlockProduce = CallBeginProcessBlockProduce; using MyEndProcessBlockProduce = CallEndProcessBlockProduce; using MyGlobalRun = CallGlobalRun; @@ -117,11 +119,11 @@ namespace edm { } void doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { - if constexpr (T::HasAbility::kProcessBlockCache or T::HasAbility::kBeginProcessBlockProducer) { + if constexpr (T::HasAbility::kWatchProcessBlock or T::HasAbility::kBeginProcessBlockProducer) { ProcessBlock processBlock(pbp, this->moduleDescription(), mcc, false); ProcessBlock const& cnstProcessBlock = processBlock; processBlock.setConsumer(this->consumer()); - MyGlobalProcessBlock::beginProcessBlock(cnstProcessBlock, m_global.get()); + MyWatchProcessBlock::beginProcessBlock(cnstProcessBlock, m_global.get()); if constexpr (T::HasAbility::kBeginProcessBlockProducer) { processBlock.setProducer(this->producer()); MyBeginProcessBlockProduce::produce(processBlock, m_global.get()); @@ -131,20 +133,20 @@ namespace edm { } void doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { - if constexpr (T::HasAbility::kProcessBlockCache) { + if constexpr (T::HasAbility::kInputProcessBlockCache) { ProcessBlock processBlock(pbp, this->moduleDescription(), mcc, false); ProcessBlock const& cnstProcessBlock = processBlock; processBlock.setConsumer(this->consumer()); - MyGlobalProcessBlock::accessInputProcessBlock(cnstProcessBlock, m_global.get()); + MyInputProcessBlock::accessInputProcessBlock(cnstProcessBlock, m_global.get()); } } void doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) final { - if constexpr (T::HasAbility::kProcessBlockCache or T::HasAbility::kEndProcessBlockProducer) { + if constexpr (T::HasAbility::kWatchProcessBlock or T::HasAbility::kEndProcessBlockProducer) { ProcessBlock processBlock(pbp, this->moduleDescription(), mcc, true); ProcessBlock const& cnstProcessBlock = processBlock; processBlock.setConsumer(this->consumer()); - MyGlobalProcessBlock::endProcessBlock(cnstProcessBlock, m_global.get()); + MyWatchProcessBlock::endProcessBlock(cnstProcessBlock, m_global.get()); if constexpr (T::HasAbility::kEndProcessBlockProducer) { processBlock.setProducer(this->producer()); MyEndProcessBlockProduce::produce(processBlock, m_global.get()); diff --git a/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h b/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h index b3c45c2b1f89c..e5600e69beed8 100644 --- a/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h +++ b/FWCore/Framework/interface/stream/ProducingModuleAdaptorBase.h @@ -81,6 +81,7 @@ namespace edm { const ModuleDescription& moduleDescription() const { return moduleDescription_; } virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool hasAcquire() const = 0; diff --git a/FWCore/Framework/interface/stream/callAbilities.h b/FWCore/Framework/interface/stream/callAbilities.h index ced088596c2ce..9a641bfcd6742 100644 --- a/FWCore/Framework/interface/stream/callAbilities.h +++ b/FWCore/Framework/interface/stream/callAbilities.h @@ -65,33 +65,23 @@ namespace edm { using CallGlobal = CallGlobalImpl; //******************************** - // CallGlobalProcessBlock + // CallInputProcessBlock //******************************** template - struct CallGlobalProcessBlockImpl { - static void beginProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache const* iGC) { - T::beginProcessBlock(iProcessBlock, iGC); - } - - static void accessInputProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache const* iGC) { + struct CallInputProcessBlockImpl { + static void accessInputProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache* iGC) { // This is not fully implemented yet and will never be called T::accessInputProcessBlock(iProcessBlock, iGC); } - - static void endProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache const* iGC) { - T::endProcessBlock(iProcessBlock, iGC); - } }; template - struct CallGlobalProcessBlockImpl { - static void beginProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache const*) {} - static void accessInputProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache const*) {} - static void endProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache const*) {} + struct CallInputProcessBlockImpl { + static void accessInputProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache*) {} }; template - using CallGlobalProcessBlock = CallGlobalProcessBlockImpl; + using CallInputProcessBlock = CallInputProcessBlockImpl; //******************************** // CallGlobalRun @@ -253,19 +243,42 @@ namespace edm { using CallGlobalLuminosityBlockSummary = CallGlobalLuminosityBlockSummaryImpl; + //******************************** + // CallWatchProcessBlock + //******************************** + template + struct CallWatchProcessBlockImpl { + static void beginProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache* iGC) { + T::beginProcessBlock(iProcessBlock, iGC); + } + + static void endProcessBlock(edm::ProcessBlock const& iProcessBlock, typename T::GlobalCache* iGC) { + T::endProcessBlock(iProcessBlock, iGC); + } + }; + + template + struct CallWatchProcessBlockImpl { + static void beginProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache*) {} + static void endProcessBlock(edm::ProcessBlock const&, typename T::GlobalCache*) {} + }; + + template + using CallWatchProcessBlock = CallWatchProcessBlockImpl; + //******************************** // CallBeginProcessBlockProduce //******************************** template struct CallBeginProcessBlockProduceImpl { - static void produce(edm::ProcessBlock& processBlock, typename T::GlobalCache const* globalCache) { + static void produce(edm::ProcessBlock& processBlock, typename T::GlobalCache* globalCache) { T::beginProcessBlockProduce(processBlock, globalCache); } }; template struct CallBeginProcessBlockProduceImpl { - static void produce(edm::ProcessBlock&, typename T::GlobalCache const*) {} + static void produce(edm::ProcessBlock&, typename T::GlobalCache*) {} }; template @@ -276,14 +289,14 @@ namespace edm { //******************************** template struct CallEndProcessBlockProduceImpl { - static void produce(edm::ProcessBlock& processBlock, typename T::GlobalCache const* globalCache) { + static void produce(edm::ProcessBlock& processBlock, typename T::GlobalCache* globalCache) { T::endProcessBlockProduce(processBlock, globalCache); } }; template struct CallEndProcessBlockProduceImpl { - static void produce(edm::ProcessBlock&, typename T::GlobalCache const*) {} + static void produce(edm::ProcessBlock&, typename T::GlobalCache*) {} }; template diff --git a/FWCore/Framework/interface/stream/implementors.h b/FWCore/Framework/interface/stream/implementors.h index b8f889287c5a8..be2482d9e1470 100644 --- a/FWCore/Framework/interface/stream/implementors.h +++ b/FWCore/Framework/interface/stream/implementors.h @@ -54,15 +54,15 @@ namespace edm { }; template - class ProcessBlockCacheHolder { + class InputProcessBlockCacheHolder { public: - ProcessBlockCacheHolder() = default; - ProcessBlockCacheHolder(ProcessBlockCacheHolder const&) = delete; - ProcessBlockCacheHolder& operator=(ProcessBlockCacheHolder const&) = delete; + InputProcessBlockCacheHolder() = default; + InputProcessBlockCacheHolder(InputProcessBlockCacheHolder const&) = delete; + InputProcessBlockCacheHolder& operator=(InputProcessBlockCacheHolder const&) = delete; //void setProcessBlockCache(C const* iCache) { cache_ = iCache; } protected: - //C const* processBlockCache() const { return cache_; } + //C const* inputProcessBlockCache() const { return cache_; } private: //C const* cache_; @@ -122,6 +122,16 @@ namespace edm { virtual void endLuminosityBlockSummary(edm::LuminosityBlock const&, edm::EventSetup const&, C*) const = 0; }; + class WatchProcessBlock { + public: + WatchProcessBlock() = default; + WatchProcessBlock(WatchProcessBlock const&) = delete; + WatchProcessBlock& operator=(WatchProcessBlock const&) = delete; + + ///requires the following be defined in the inheriting class + ///static void beginProcessBlockProduce(edm::ProcessBlock const&, GlobalCache*); + }; + class BeginProcessBlockProducer { public: BeginProcessBlockProducer() = default; @@ -129,7 +139,7 @@ namespace edm { BeginProcessBlockProducer& operator=(BeginProcessBlockProducer const&) = delete; ///requires the following be defined in the inheriting class - ///static void beginProcessBlockProduce(edm::ProcessBlock&, GlobalCache const* ); + ///static void beginProcessBlockProduce(edm::ProcessBlock&, GlobalCache*); }; class EndProcessBlockProducer { @@ -139,7 +149,7 @@ namespace edm { EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete; ///requires the following be defined in the inheriting class - /// static void endProcessBlockProduce(edm::ProcessBlock&, GlobalCache const* ) + /// static void endProcessBlockProduce(edm::ProcessBlock&, GlobalCache*) }; class BeginRunProducer { diff --git a/FWCore/Framework/src/Worker.h b/FWCore/Framework/src/Worker.h index cb69553daf3a1..dd4dfb5993fdc 100644 --- a/FWCore/Framework/src/Worker.h +++ b/FWCore/Framework/src/Worker.h @@ -120,6 +120,7 @@ namespace edm { Worker& operator=(Worker const&) = delete; // Disallow copying and moving virtual bool wantsProcessBlocks() const = 0; + virtual bool wantsInputProcessBlocks() const = 0; virtual bool wantsGlobalRuns() const = 0; virtual bool wantsGlobalLuminosityBlocks() const = 0; virtual bool wantsStreamRuns() const = 0; @@ -845,7 +846,7 @@ namespace edm { ModuleSignalSentry cpp(actReg, context, mcc); return iWorker->implDoAccessInputProcessBlock(pbp, mcc); } - static bool wantsTransition(Worker const* iWorker) { return iWorker->wantsProcessBlocks(); } + static bool wantsTransition(Worker const* iWorker) { return iWorker->wantsInputProcessBlocks(); } static bool needToRunSelection(Worker const* iWorker) { return false; } static SerialTaskQueue* pauseGlobalQueue(Worker* iWorker) { return nullptr; } static SerialTaskQueue* enableGlobalQueue(Worker*) { return nullptr; } diff --git a/FWCore/Framework/src/WorkerT.cc b/FWCore/Framework/src/WorkerT.cc index 63828eafe0ca0..03e9071739998 100644 --- a/FWCore/Framework/src/WorkerT.cc +++ b/FWCore/Framework/src/WorkerT.cc @@ -122,6 +122,11 @@ namespace edm { return module_->wantsProcessBlocks(); } + template + bool WorkerT::wantsInputProcessBlocks() const { + return module_->wantsInputProcessBlocks(); + } + template bool WorkerT::wantsGlobalRuns() const { return module_->wantsGlobalRuns(); diff --git a/FWCore/Framework/src/WorkerT.h b/FWCore/Framework/src/WorkerT.h index e7f86c7d6e7c9..3102967830118 100644 --- a/FWCore/Framework/src/WorkerT.h +++ b/FWCore/Framework/src/WorkerT.h @@ -44,6 +44,7 @@ namespace edm { Types moduleType() const override; bool wantsProcessBlocks() const final; + bool wantsInputProcessBlocks() const final; bool wantsGlobalRuns() const final; bool wantsGlobalLuminosityBlocks() const final; bool wantsStreamRuns() const final; diff --git a/FWCore/Framework/src/global/analyzerImplementors.cc b/FWCore/Framework/src/global/analyzerImplementors.cc new file mode 100644 index 0000000000000..b48e076fc2e73 --- /dev/null +++ b/FWCore/Framework/src/global/analyzerImplementors.cc @@ -0,0 +1,18 @@ +// -*- C++ -*- +// +// Implementation: +// Explicitly instantiate implementor templates for EDAnalyzerBase +// +// Original Author: W. David Dagenhart +// Created: 23 June 2020 + +#include "FWCore/Framework/src/global/implementorsMethods.h" +#include "FWCore/Framework/interface/global/EDAnalyzerBase.h" + +namespace edm { + namespace global { + namespace impl { + template class WatchProcessBlock; + } // namespace impl + } // namespace global +} // namespace edm diff --git a/FWCore/Framework/src/global/filterImplementors.cc b/FWCore/Framework/src/global/filterImplementors.cc index 747e6cedcd30d..2096ca080a04d 100644 --- a/FWCore/Framework/src/global/filterImplementors.cc +++ b/FWCore/Framework/src/global/filterImplementors.cc @@ -19,6 +19,7 @@ namespace edm { namespace global { namespace impl { + template class WatchProcessBlock; template class BeginProcessBlockProducer; template class EndProcessBlockProducer; template class BeginRunProducer; diff --git a/FWCore/Framework/src/global/implementorsMethods.h b/FWCore/Framework/src/global/implementorsMethods.h index f353384cb61f9..e4b0828a9f164 100644 --- a/FWCore/Framework/src/global/implementorsMethods.h +++ b/FWCore/Framework/src/global/implementorsMethods.h @@ -29,6 +29,17 @@ namespace edm { namespace global { namespace impl { + + template + void WatchProcessBlock::doBeginProcessBlock_(ProcessBlock const& pb) { + this->beginProcessBlock(pb); + } + + template + void WatchProcessBlock::doEndProcessBlock_(ProcessBlock const& pb) { + this->endProcessBlock(pb); + } + template void BeginProcessBlockProducer::doBeginProcessBlockProduce_(ProcessBlock& pb) { this->beginProcessBlockProduce(pb); diff --git a/FWCore/Framework/src/global/producerImplementors.cc b/FWCore/Framework/src/global/producerImplementors.cc index 58c939153c385..577355b35192e 100644 --- a/FWCore/Framework/src/global/producerImplementors.cc +++ b/FWCore/Framework/src/global/producerImplementors.cc @@ -19,6 +19,7 @@ namespace edm { namespace global { namespace impl { + template class WatchProcessBlock; template class BeginProcessBlockProducer; template class EndProcessBlockProducer; template class BeginRunProducer; diff --git a/FWCore/Framework/src/limited/analyzerImplementors.cc b/FWCore/Framework/src/limited/analyzerImplementors.cc new file mode 100644 index 0000000000000..9fb322c915591 --- /dev/null +++ b/FWCore/Framework/src/limited/analyzerImplementors.cc @@ -0,0 +1,18 @@ +// -*- C++ -*- + +// Implementation: +// Explicitly instantiate implementor templates for EDAnalyzerBase +// +// Original Author: W. David Dagenhart +// Created: 23 June 2020 + +#include "FWCore/Framework/src/limited/implementorsMethods.h" +#include "FWCore/Framework/interface/limited/EDAnalyzerBase.h" + +namespace edm { + namespace limited { + namespace impl { + template class WatchProcessBlock; + } // namespace impl + } // namespace limited +} // namespace edm diff --git a/FWCore/Framework/src/limited/filterImplementors.cc b/FWCore/Framework/src/limited/filterImplementors.cc index f473eda71df44..37cb6548f3859 100644 --- a/FWCore/Framework/src/limited/filterImplementors.cc +++ b/FWCore/Framework/src/limited/filterImplementors.cc @@ -19,6 +19,7 @@ namespace edm { namespace limited { namespace impl { + template class WatchProcessBlock; template class BeginProcessBlockProducer; template class EndProcessBlockProducer; template class BeginRunProducer; diff --git a/FWCore/Framework/src/limited/implementorsMethods.h b/FWCore/Framework/src/limited/implementorsMethods.h index bd4a8d463452a..f6012ef446ca3 100644 --- a/FWCore/Framework/src/limited/implementorsMethods.h +++ b/FWCore/Framework/src/limited/implementorsMethods.h @@ -28,6 +28,16 @@ namespace edm { namespace limited { namespace impl { + template + void WatchProcessBlock::doBeginProcessBlock_(ProcessBlock const& pb) { + this->beginProcessBlock(pb); + } + + template + void WatchProcessBlock::doEndProcessBlock_(ProcessBlock const& pb) { + this->endProcessBlock(pb); + } + template void BeginProcessBlockProducer::doBeginProcessBlockProduce_(ProcessBlock& pb) { this->beginProcessBlockProduce(pb); diff --git a/FWCore/Framework/src/limited/producerImplementors.cc b/FWCore/Framework/src/limited/producerImplementors.cc index f6d7540f594d6..09cae7679752b 100644 --- a/FWCore/Framework/src/limited/producerImplementors.cc +++ b/FWCore/Framework/src/limited/producerImplementors.cc @@ -19,6 +19,7 @@ namespace edm { namespace limited { namespace impl { + template class WatchProcessBlock; template class BeginProcessBlockProducer; template class EndProcessBlockProducer; template class BeginRunProducer; diff --git a/FWCore/Framework/src/one/analyzerImplementors.cc b/FWCore/Framework/src/one/analyzerImplementors.cc index f52c560b76988..a4ffacc89b859 100644 --- a/FWCore/Framework/src/one/analyzerImplementors.cc +++ b/FWCore/Framework/src/one/analyzerImplementors.cc @@ -22,6 +22,7 @@ namespace edm { template class SharedResourcesUser; template class RunWatcher; template class LuminosityBlockWatcher; + template class WatchProcessBlock; } // namespace impl } // namespace one } // namespace edm diff --git a/FWCore/Framework/src/one/filterImplementors.cc b/FWCore/Framework/src/one/filterImplementors.cc index e2eda045cb887..14bead72081e7 100644 --- a/FWCore/Framework/src/one/filterImplementors.cc +++ b/FWCore/Framework/src/one/filterImplementors.cc @@ -22,6 +22,7 @@ namespace edm { template class SharedResourcesUser; template class RunWatcher; template class LuminosityBlockWatcher; + template class WatchProcessBlock; template class BeginProcessBlockProducer; template class EndProcessBlockProducer; template class BeginRunProducer; diff --git a/FWCore/Framework/src/one/implementorsMethods.h b/FWCore/Framework/src/one/implementorsMethods.h index 6c0d99d0875de..46fba4548e164 100644 --- a/FWCore/Framework/src/one/implementorsMethods.h +++ b/FWCore/Framework/src/one/implementorsMethods.h @@ -64,6 +64,16 @@ namespace edm { this->endLuminosityBlock(rp, c); } + template + void WatchProcessBlock::doBeginProcessBlock_(ProcessBlock const& pb) { + this->beginProcessBlock(pb); + } + + template + void WatchProcessBlock::doEndProcessBlock_(ProcessBlock const& pb) { + this->endProcessBlock(pb); + } + template void BeginProcessBlockProducer::doBeginProcessBlockProduce_(ProcessBlock& pb) { this->beginProcessBlockProduce(pb); diff --git a/FWCore/Framework/src/one/producerImplementors.cc b/FWCore/Framework/src/one/producerImplementors.cc index bab7c7059411f..94d481a041efc 100644 --- a/FWCore/Framework/src/one/producerImplementors.cc +++ b/FWCore/Framework/src/one/producerImplementors.cc @@ -22,6 +22,7 @@ namespace edm { template class SharedResourcesUser; template class RunWatcher; template class LuminosityBlockWatcher; + template class WatchProcessBlock; template class BeginProcessBlockProducer; template class EndProcessBlockProducer; template class BeginRunProducer; diff --git a/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc b/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc index 915b50c37226d..0c8a75e357997 100644 --- a/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestGlobalAnalyzers.cc @@ -301,7 +301,7 @@ namespace edmtest { } }; - class ProcessBlockIntAnalyzer : public edm::global::EDAnalyzer, + class ProcessBlockIntAnalyzer : public edm::global::EDAnalyzer, edm::RunCache> { public: diff --git a/FWCore/Framework/test/stubs/TestGlobalFilters.cc b/FWCore/Framework/test/stubs/TestGlobalFilters.cc index 280e0769282cd..89e480b02690b 100644 --- a/FWCore/Framework/test/stubs/TestGlobalFilters.cc +++ b/FWCore/Framework/test/stubs/TestGlobalFilters.cc @@ -418,7 +418,7 @@ namespace edmtest { } }; - class ProcessBlockIntFilter : public edm::global::EDFilter> { + class ProcessBlockIntFilter : public edm::global::EDFilter { public: explicit ProcessBlockIntFilter(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { produces(); diff --git a/FWCore/Framework/test/stubs/TestGlobalProducers.cc b/FWCore/Framework/test/stubs/TestGlobalProducers.cc index 2dca928ec0e43..6b43b60808274 100644 --- a/FWCore/Framework/test/stubs/TestGlobalProducers.cc +++ b/FWCore/Framework/test/stubs/TestGlobalProducers.cc @@ -463,7 +463,7 @@ namespace edmtest { } }; - class ProcessBlockIntProducer : public edm::global::EDProducer> { + class ProcessBlockIntProducer : public edm::global::EDProducer { public: explicit ProcessBlockIntProducer(edm::ParameterSet const& p) : trans_(p.getParameter("transitions")) { produces(); diff --git a/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc b/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc index 3e4edc75a66a8..0cdf8b14af93b 100644 --- a/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestLimitedAnalyzers.cc @@ -316,11 +316,11 @@ namespace edmtest { } }; - class ProcessBlockIntAnalyzer : public edm::limited::EDAnalyzer> { + class ProcessBlockIntAnalyzer : public edm::limited::EDAnalyzer { public: explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& pset) : edm::limited::EDAnalyzerBase(pset), - edm::limited::EDAnalyzer>(pset), + edm::limited::EDAnalyzer(pset), trans_(pset.getParameter("transitions")) { { auto tag = pset.getParameter("consumesBeginProcessBlock"); diff --git a/FWCore/Framework/test/stubs/TestLimitedFilters.cc b/FWCore/Framework/test/stubs/TestLimitedFilters.cc index 5502c69c3bf3e..e0ec00d2e0f39 100644 --- a/FWCore/Framework/test/stubs/TestLimitedFilters.cc +++ b/FWCore/Framework/test/stubs/TestLimitedFilters.cc @@ -433,11 +433,11 @@ namespace edmtest { } }; - class ProcessBlockIntFilter : public edm::limited::EDFilter> { + class ProcessBlockIntFilter : public edm::limited::EDFilter { public: explicit ProcessBlockIntFilter(edm::ParameterSet const& pset) : edm::limited::EDFilterBase(pset), - edm::limited::EDFilter>(pset), + edm::limited::EDFilter(pset), trans_(pset.getParameter("transitions")) { produces(); { diff --git a/FWCore/Framework/test/stubs/TestLimitedProducers.cc b/FWCore/Framework/test/stubs/TestLimitedProducers.cc index 8679180fb8564..916fe13cd3439 100644 --- a/FWCore/Framework/test/stubs/TestLimitedProducers.cc +++ b/FWCore/Framework/test/stubs/TestLimitedProducers.cc @@ -479,11 +479,11 @@ namespace edmtest { } }; - class ProcessBlockIntProducer : public edm::limited::EDProducer> { + class ProcessBlockIntProducer : public edm::limited::EDProducer { public: explicit ProcessBlockIntProducer(edm::ParameterSet const& pset) : edm::limited::EDProducerBase(pset), - edm::limited::EDProducer>(pset), + edm::limited::EDProducer(pset), trans_(pset.getParameter("transitions")) { produces(); diff --git a/FWCore/Framework/test/stubs/TestOneAnalyzers.cc b/FWCore/Framework/test/stubs/TestOneAnalyzers.cc index cd54442ecc07c..94043349a3e3c 100644 --- a/FWCore/Framework/test/stubs/TestOneAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestOneAnalyzers.cc @@ -225,7 +225,7 @@ namespace edmtest { } }; - class ProcessBlockIntAnalyzer : public edm::one::EDAnalyzer> { + class ProcessBlockIntAnalyzer : public edm::one::EDAnalyzer { public: explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& pset) : trans_(pset.getParameter("transitions")) { { diff --git a/FWCore/Framework/test/stubs/TestOneFilters.cc b/FWCore/Framework/test/stubs/TestOneFilters.cc index a6614bb306d1a..ffa99ecf6bd90 100644 --- a/FWCore/Framework/test/stubs/TestOneFilters.cc +++ b/FWCore/Framework/test/stubs/TestOneFilters.cc @@ -229,7 +229,7 @@ namespace edmtest { } }; - class ProcessBlockIntFilter : public edm::one::EDFilter> { + class ProcessBlockIntFilter : public edm::one::EDFilter { public: explicit ProcessBlockIntFilter(edm::ParameterSet const& pset) : trans_(pset.getParameter("transitions")) { produces(); diff --git a/FWCore/Framework/test/stubs/TestOneProducers.cc b/FWCore/Framework/test/stubs/TestOneProducers.cc index 44e5c11509dff..95c349048a54d 100644 --- a/FWCore/Framework/test/stubs/TestOneProducers.cc +++ b/FWCore/Framework/test/stubs/TestOneProducers.cc @@ -230,7 +230,7 @@ namespace edmtest { } }; - class ProcessBlockIntProducer : public edm::one::EDProducer> { + class ProcessBlockIntProducer : public edm::one::EDProducer { public: explicit ProcessBlockIntProducer(edm::ParameterSet const& pset) : trans_(pset.getParameter("transitions")) { produces(); diff --git a/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc b/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc index c59ca78c3d752..d2bbbccfe247b 100644 --- a/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc +++ b/FWCore/Framework/test/stubs/TestStreamAnalyzers.cc @@ -453,7 +453,7 @@ namespace edmtest { }; class ProcessBlockIntAnalyzer - : public edm::stream::EDAnalyzer, edm::GlobalCache> { + : public edm::stream::EDAnalyzer> { public: explicit ProcessBlockIntAnalyzer(edm::ParameterSet const& pset, TestGlobalCacheAn const* testGlobalCache) { { @@ -476,7 +476,7 @@ namespace edmtest { return testGlobalCache; } - static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheAn const* testGlobalCache) { + static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheAn* testGlobalCache) { if (testGlobalCache->m_count != 0) { throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::begin transitions " << testGlobalCache->m_count << " but it was supposed to be " << 0; @@ -492,7 +492,7 @@ namespace edmtest { } } - static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCacheAn const*) { + static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCacheAn*) { return std::make_shared(); } @@ -504,7 +504,7 @@ namespace edmtest { ++testGlobalCache->m_count; } - static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheAn const* testGlobalCache) { + static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheAn* testGlobalCache) { ++testGlobalCache->m_count; if (testGlobalCache->m_count != testGlobalCache->trans_) { throw cms::Exception("transitions") << "ProcessBlockIntAnalyzer::end transitions " << testGlobalCache->m_count diff --git a/FWCore/Framework/test/stubs/TestStreamFilters.cc b/FWCore/Framework/test/stubs/TestStreamFilters.cc index fe89a436b5485..1511cd850919e 100644 --- a/FWCore/Framework/test/stubs/TestStreamFilters.cc +++ b/FWCore/Framework/test/stubs/TestStreamFilters.cc @@ -438,7 +438,7 @@ namespace edmtest { }; class ProcessBlockIntFilter - : public edm::stream::EDFilter, edm::GlobalCache> { + : public edm::stream::EDFilter> { public: explicit ProcessBlockIntFilter(edm::ParameterSet const& pset, TestGlobalCacheFil const* testGlobalCache) { produces(); @@ -463,7 +463,7 @@ namespace edmtest { return testGlobalCache; } - static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheFil const* testGlobalCache) { + static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheFil* testGlobalCache) { if (testGlobalCache->m_count != 0) { throw cms::Exception("transitions") << "ProcessBlockIntFilter::begin transitions " << testGlobalCache->m_count << " but it was supposed to be " << 0; @@ -478,7 +478,7 @@ namespace edmtest { } } - static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCacheFil const*) { + static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCacheFil*) { return std::make_shared(); } @@ -491,7 +491,7 @@ namespace edmtest { return true; } - static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheFil const* testGlobalCache) { + static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCacheFil* testGlobalCache) { ++testGlobalCache->m_count; if (testGlobalCache->m_count != testGlobalCache->trans_) { throw cms::Exception("transitions") << "ProcessBlockIntFilter::end transitions " << testGlobalCache->m_count diff --git a/FWCore/Framework/test/stubs/TestStreamProducers.cc b/FWCore/Framework/test/stubs/TestStreamProducers.cc index bace26ee82cb4..cfeb917d88aa8 100644 --- a/FWCore/Framework/test/stubs/TestStreamProducers.cc +++ b/FWCore/Framework/test/stubs/TestStreamProducers.cc @@ -459,7 +459,7 @@ namespace edmtest { }; class ProcessBlockIntProducer - : public edm::stream::EDProducer, edm::GlobalCache> { + : public edm::stream::EDProducer> { public: explicit ProcessBlockIntProducer(edm::ParameterSet const& pset, TestGlobalCache const* testGlobalCache) { produces(); @@ -484,7 +484,7 @@ namespace edmtest { return testGlobalCache; } - static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCache const* testGlobalCache) { + static void beginProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCache* testGlobalCache) { if (testGlobalCache->m_count != 0) { throw cms::Exception("transitions") << "ProcessBlockIntProducer::begin transitions " << testGlobalCache->m_count << " but it was supposed to be " << 0; @@ -500,7 +500,7 @@ namespace edmtest { } } - static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCache const*) { + static std::shared_ptr accessInputProcessBlock(edm::ProcessBlock const&, TestGlobalCache*) { return std::make_shared(); } @@ -512,7 +512,7 @@ namespace edmtest { ++testGlobalCache->m_count; } - static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCache const* testGlobalCache) { + static void endProcessBlock(edm::ProcessBlock const& processBlock, TestGlobalCache* testGlobalCache) { ++testGlobalCache->m_count; if (testGlobalCache->m_count != testGlobalCache->trans_) { throw cms::Exception("transitions") << "ProcessBlockIntProducer::end transitions " << testGlobalCache->m_count diff --git a/FWCore/Integration/test/TestFindProduct.cc b/FWCore/Integration/test/TestFindProduct.cc index 8617467049ca4..2c6405c00a42c 100644 --- a/FWCore/Integration/test/TestFindProduct.cc +++ b/FWCore/Integration/test/TestFindProduct.cc @@ -31,11 +31,8 @@ namespace edmtest { - struct DummyTestFindProduct {}; - - class TestFindProduct : public edm::one::EDAnalyzer> { + class TestFindProduct + : public edm::one::EDAnalyzer { public: explicit TestFindProduct(edm::ParameterSet const& pset); virtual ~TestFindProduct(); diff --git a/FWCore/MessageService/test/UnitTestClient_V.h b/FWCore/MessageService/test/UnitTestClient_V.h index bcd2aef75b13a..c876f1e3c0df4 100644 --- a/FWCore/MessageService/test/UnitTestClient_V.h +++ b/FWCore/MessageService/test/UnitTestClient_V.h @@ -16,7 +16,7 @@ namespace edm { namespace edmtest { class UTC_V1 - : public edm::one::EDAnalyzer> { + : public edm::one::EDAnalyzer { public: explicit UTC_V1(edm::ParameterSet const& p) : ev(0) { identifier = p.getUntrackedParameter("identifier", 99); } From 41823e57833ac1928f5e5d528c186f381fd22807 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 25 Jun 2020 21:54:58 +0200 Subject: [PATCH 22/25] Resolve logical conflicts after PR rebase --- FWCore/Framework/interface/EDConsumerBase.h | 5 ++++- FWCore/Framework/interface/OccurrenceTraits.h | 3 +++ FWCore/Framework/src/Worker.cc | 3 +++ FWCore/Framework/src/Worker.h | 5 ++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/FWCore/Framework/interface/EDConsumerBase.h b/FWCore/Framework/interface/EDConsumerBase.h index 2698899e1f123..df9bde9b6b43e 100644 --- a/FWCore/Framework/interface/EDConsumerBase.h +++ b/FWCore/Framework/interface/EDConsumerBase.h @@ -23,6 +23,7 @@ #include #include #include +#include // user include files #include "DataFormats/Provenance/interface/BranchType.h" @@ -119,10 +120,12 @@ namespace edm { } std::vector const& esGetTokenIndicesVector(edm::Transition iTrans) const { + assert(iTrans < edm::Transition::NumberOfEventSetupTransitions); return esItemsToGetFromTransition_[static_cast(iTrans)]; } std::vector const& esGetTokenRecordIndicesVector(edm::Transition iTrans) const { + assert(iTrans < edm::Transition::NumberOfEventSetupTransitions); return esRecordsToGetFromTransition_[static_cast(iTrans)]; } @@ -259,7 +262,7 @@ namespace edm { edm::SoATuple m_esTokenInfo; std::array, static_cast(edm::Transition::NumberOfEventSetupTransitions)> esItemsToGetFromTransition_; - std::array, static_cast(edm::Transition::NumberOfTransitions)> + std::array, static_cast(edm::Transition::NumberOfEventSetupTransitions)> esRecordsToGetFromTransition_; bool frozen_; bool containsCurrentProcessAlias_; diff --git a/FWCore/Framework/interface/OccurrenceTraits.h b/FWCore/Framework/interface/OccurrenceTraits.h index 546acb63918d5..ad062e93efcaf 100644 --- a/FWCore/Framework/interface/OccurrenceTraits.h +++ b/FWCore/Framework/interface/OccurrenceTraits.h @@ -389,6 +389,7 @@ namespace edm { using MyPrincipal = ProcessBlockPrincipal; using Context = GlobalContext; static bool constexpr isEvent_ = false; + static Transition constexpr transition_ = Transition::BeginProcessBlock; static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { return GlobalContext(GlobalContext::Transition::kBeginProcessBlock, @@ -424,6 +425,7 @@ namespace edm { using MyPrincipal = ProcessBlockPrincipal; using Context = GlobalContext; static bool constexpr isEvent_ = false; + static Transition constexpr transition_ = Transition::BeginProcessBlock; static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { return GlobalContext(GlobalContext::Transition::kAccessInputProcessBlock, @@ -459,6 +461,7 @@ namespace edm { using MyPrincipal = ProcessBlockPrincipal; using Context = GlobalContext; static bool constexpr isEvent_ = false; + static Transition constexpr transition_ = Transition::EndProcessBlock; static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { return GlobalContext(GlobalContext::Transition::kEndProcessBlock, diff --git a/FWCore/Framework/src/Worker.cc b/FWCore/Framework/src/Worker.cc index 2f49328b2004a..6e09f17ab79b9 100644 --- a/FWCore/Framework/src/Worker.cc +++ b/FWCore/Framework/src/Worker.cc @@ -277,6 +277,9 @@ namespace edm { } void Worker::esPrefetchAsync(WaitingTask* iTask, EventSetupImpl const& iImpl, Transition iTrans) { + if (iTrans >= edm::Transition::NumberOfEventSetupTransitions) { + return; + } auto const& recs = esRecordsToGetFrom(iTrans); auto const& items = esItemsToGetFrom(iTrans); diff --git a/FWCore/Framework/src/Worker.h b/FWCore/Framework/src/Worker.h index dd4dfb5993fdc..a163499927782 100644 --- a/FWCore/Framework/src/Worker.h +++ b/FWCore/Framework/src/Worker.h @@ -51,6 +51,7 @@ the worker is reset(). #include "FWCore/Utilities/interface/propagate_const.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" #include "FWCore/Utilities/interface/ESIndices.h" +#include "FWCore/Utilities/interface/Transition.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -356,7 +357,9 @@ namespace edm { EventSetupImpl const& iEventSetup, edm::Transition); - bool needsESPrefetching(Transition iTrans) const noexcept { return not esItemsToGetFrom(iTrans).empty(); } + bool needsESPrefetching(Transition iTrans) const noexcept { + return iTrans < edm::Transition::NumberOfEventSetupTransitions ? not esItemsToGetFrom(iTrans).empty() : false; + } void esPrefetchAsync(WaitingTask* iHolder, EventSetupImpl const&, Transition); void emitPostModuleEventPrefetchingSignal() { From 9a21b34e93fa8fb66b553710eb1438ab88644970 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Mon, 29 Jun 2020 18:00:14 +0200 Subject: [PATCH 23/25] Improve interface in globalTransitionAsync.h --- FWCore/Framework/interface/EventSetupImpl.h | 8 +- FWCore/Framework/interface/OccurrenceTraits.h | 44 ++-- FWCore/Framework/interface/SubProcess.h | 30 +-- FWCore/Framework/src/EventProcessor.cc | 51 ++--- FWCore/Framework/src/SubProcess.cc | 140 +++++------- FWCore/Framework/src/TransitionInfoTypes.cc | 11 + FWCore/Framework/src/TransitionInfoTypes.h | 73 ++++++ FWCore/Framework/src/globalTransitionAsync.h | 212 ++++++------------ FWCore/TestProcessor/src/TestProcessor.cc | 73 +++--- 9 files changed, 288 insertions(+), 354 deletions(-) create mode 100644 FWCore/Framework/src/TransitionInfoTypes.cc create mode 100644 FWCore/Framework/src/TransitionInfoTypes.h diff --git a/FWCore/Framework/interface/EventSetupImpl.h b/FWCore/Framework/interface/EventSetupImpl.h index 6b46177bf61f7..f4b4e348146ef 100644 --- a/FWCore/Framework/interface/EventSetupImpl.h +++ b/FWCore/Framework/interface/EventSetupImpl.h @@ -34,6 +34,7 @@ class testEventsetup; namespace edm { class ESInputTag; + class ProcessBlockTransitionInfo; class Schedule; class ServiceToken; class WaitingTaskHolder; @@ -72,12 +73,7 @@ namespace edm { friend class eventsetup::EventSetupProvider; friend class eventsetup::EventSetupRecordProvider; friend class ::testEventsetup; - - template - friend void beginGlobalTransitionAsync(WaitingTaskHolder, Schedule&, P&, ServiceToken const&, SC&); - - template - friend void endGlobalTransitionAsync(WaitingTaskHolder, Schedule&, P&, ServiceToken const&, SC&, bool); + friend class ProcessBlockTransitionInfo; protected: void addRecordImpl(const eventsetup::EventSetupRecordImpl& iRecord); diff --git a/FWCore/Framework/interface/OccurrenceTraits.h b/FWCore/Framework/interface/OccurrenceTraits.h index ad062e93efcaf..a2f0f42c53ca3 100644 --- a/FWCore/Framework/interface/OccurrenceTraits.h +++ b/FWCore/Framework/interface/OccurrenceTraits.h @@ -15,6 +15,7 @@ #include "FWCore/Framework/interface/ProcessBlockPrincipal.h" #include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Framework/interface/RunPrincipal.h" +#include "FWCore/Framework/src/TransitionInfoTypes.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" @@ -36,8 +37,8 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef EventPrincipal MyPrincipal; - typedef StreamContext Context; + using MyPrincipal = EventPrincipal; + using Context = StreamContext; static BranchType constexpr branchType_ = InEvent; static bool constexpr begin_ = true; static bool constexpr isEvent_ = true; @@ -68,8 +69,9 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef RunPrincipal MyPrincipal; - typedef GlobalContext Context; + using MyPrincipal = RunPrincipal; + using TransitionInfoType = RunTransitionInfo; + using Context = GlobalContext; static BranchType constexpr branchType_ = InRun; static bool constexpr begin_ = true; static bool constexpr isEvent_ = false; @@ -108,8 +110,8 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef RunPrincipal MyPrincipal; - typedef StreamContext Context; + using MyPrincipal = RunPrincipal; + using Context = StreamContext; static BranchType constexpr branchType_ = InRun; static bool constexpr begin_ = true; static bool constexpr isEvent_ = false; @@ -147,8 +149,8 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef RunPrincipal MyPrincipal; - typedef StreamContext Context; + using MyPrincipal = RunPrincipal; + using Context = StreamContext; static BranchType constexpr branchType_ = InRun; static bool constexpr begin_ = false; static bool constexpr isEvent_ = false; @@ -186,8 +188,9 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef RunPrincipal MyPrincipal; - typedef GlobalContext Context; + using MyPrincipal = RunPrincipal; + using TransitionInfoType = RunTransitionInfo; + using Context = GlobalContext; static BranchType constexpr branchType_ = InRun; static bool constexpr begin_ = false; static bool constexpr isEvent_ = false; @@ -226,8 +229,9 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef LuminosityBlockPrincipal MyPrincipal; - typedef GlobalContext Context; + using MyPrincipal = LuminosityBlockPrincipal; + using TransitionInfoType = LumiTransitionInfo; + using Context = GlobalContext; static BranchType constexpr branchType_ = InLumi; static bool constexpr begin_ = true; static bool constexpr isEvent_ = false; @@ -266,8 +270,8 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef LuminosityBlockPrincipal MyPrincipal; - typedef StreamContext Context; + using MyPrincipal = LuminosityBlockPrincipal; + using Context = StreamContext; static BranchType constexpr branchType_ = InLumi; static bool constexpr begin_ = true; static bool constexpr isEvent_ = false; @@ -305,8 +309,8 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef LuminosityBlockPrincipal MyPrincipal; - typedef StreamContext Context; + using MyPrincipal = LuminosityBlockPrincipal; + using Context = StreamContext; static BranchType constexpr branchType_ = InLumi; static bool constexpr begin_ = false; static bool constexpr isEvent_ = false; @@ -346,8 +350,9 @@ namespace edm { template <> class OccurrenceTraits { public: - typedef LuminosityBlockPrincipal MyPrincipal; - typedef GlobalContext Context; + using MyPrincipal = LuminosityBlockPrincipal; + using TransitionInfoType = LumiTransitionInfo; + using Context = GlobalContext; static BranchType constexpr branchType_ = InLumi; static bool constexpr begin_ = false; static bool constexpr isEvent_ = false; @@ -387,6 +392,7 @@ namespace edm { class OccurrenceTraits { public: using MyPrincipal = ProcessBlockPrincipal; + using TransitionInfoType = ProcessBlockTransitionInfo; using Context = GlobalContext; static bool constexpr isEvent_ = false; static Transition constexpr transition_ = Transition::BeginProcessBlock; @@ -423,6 +429,7 @@ namespace edm { class OccurrenceTraits { public: using MyPrincipal = ProcessBlockPrincipal; + using TransitionInfoType = ProcessBlockTransitionInfo; using Context = GlobalContext; static bool constexpr isEvent_ = false; static Transition constexpr transition_ = Transition::BeginProcessBlock; @@ -459,6 +466,7 @@ namespace edm { class OccurrenceTraits { public: using MyPrincipal = ProcessBlockPrincipal; + using TransitionInfoType = ProcessBlockTransitionInfo; using Context = GlobalContext; static bool constexpr isEvent_ = false; static Transition constexpr transition_ = Transition::EndProcessBlock; diff --git a/FWCore/Framework/interface/SubProcess.h b/FWCore/Framework/interface/SubProcess.h index 216d294d568eb..f8e13ebaad72d 100644 --- a/FWCore/Framework/interface/SubProcess.h +++ b/FWCore/Framework/interface/SubProcess.h @@ -32,10 +32,13 @@ namespace edm { class EventSetupImpl; class HistoryAppender; class IOVSyncValue; + class LumiTransitionInfo; class MergeableRunProductMetadata; class ParameterSet; + class ProcessBlockTransitionInfo; class ProductRegistry; class PreallocationConfiguration; + class RunTransitionInfo; class ThinnedAssociationsHelper; class SubProcessParentageHelper; class WaitingTaskHolder; @@ -80,37 +83,22 @@ namespace edm { std::vector> const*); template - void doBeginProcessBlockAsync(WaitingTaskHolder iHolder, - ProcessBlockPrincipal const& principal, - IOVSyncValue const&, - std::vector> const*); + void doBeginProcessBlockAsync(WaitingTaskHolder iHolder, ProcessBlockTransitionInfo const& iTransitionInfo); void doEndProcessBlockAsync(WaitingTaskHolder iHolder, - ProcessBlockPrincipal const& principal, - IOVSyncValue const&, - std::vector> const*, + ProcessBlockTransitionInfo const& iTransitionInfo, bool cleaningUpAfterException); - void doBeginRunAsync(WaitingTaskHolder iHolder, - RunPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const*); + void doBeginRunAsync(WaitingTaskHolder iHolder, RunTransitionInfo const& iTransitionInfo); void doEndRunAsync(WaitingTaskHolder iHolder, - RunPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const*, + RunTransitionInfo const& iTransitionInfo, bool cleaningUpAfterException); - void doBeginLuminosityBlockAsync(WaitingTaskHolder iHolder, - LuminosityBlockPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const*); + void doBeginLuminosityBlockAsync(WaitingTaskHolder iHolder, LumiTransitionInfo const& iTransitionInfo); void doEndLuminosityBlockAsync(WaitingTaskHolder iHolder, - LuminosityBlockPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const*, + LumiTransitionInfo const& iTransitionInfo, bool cleaningUpAfterException); void doBeginStream(unsigned int); diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index cb678bcfa0ba1..e6ec01e510696 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -35,6 +35,7 @@ #include "FWCore/Framework/src/InputSourceFactory.h" #include "FWCore/Framework/src/SharedResourcesRegistry.h" #include "FWCore/Framework/src/streamTransitionAsync.h" +#include "FWCore/Framework/src/TransitionInfoTypes.h" #include "FWCore/Framework/src/globalTransitionAsync.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -879,8 +880,9 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); beginGlobalTransitionAsync( - WaitingTaskHolder(globalWaitTask.get()), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, subProcesses_); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { @@ -904,8 +906,9 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); beginGlobalTransitionAsync( - WaitingTaskHolder(globalWaitTask.get()), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, subProcesses_); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { @@ -934,9 +937,10 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), *schedule_, - processBlockPrincipal, + transitionInfo, serviceToken_, subProcesses_, cleaningUpAfterException); @@ -996,14 +1000,9 @@ namespace edm { using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - beginGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), - *schedule_, - runPrincipal, - ts, - es, - nullptr, - serviceToken_, - subProcesses_); + RunTransitionInfo transitionInfo(runPrincipal, es); + beginGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, subProcesses_); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { std::rethrow_exception(*(globalWaitTask->exceptionPtr())); @@ -1115,13 +1114,11 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); + RunTransitionInfo transitionInfo(runPrincipal, es); using Traits = OccurrenceTraits; endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), *schedule_, - runPrincipal, - ts, - es, - nullptr, + transitionInfo, serviceToken_, subProcesses_, cleaningUpAfterException); @@ -1275,15 +1272,10 @@ namespace edm { EventSetupImpl const& es = status->eventSetupImpl(esp_->subProcessIndex()); { + LumiTransitionInfo transitionInfo(lumiPrincipal, es, &status->eventSetupImpls()); using Traits = OccurrenceTraits; - beginGlobalTransitionAsync(beginStreamsHolder, - *schedule_, - lumiPrincipal, - ts, - es, - &status->eventSetupImpls(), - serviceToken_, - subProcesses_); + beginGlobalTransitionAsync( + beginStreamsHolder, *schedule_, transitionInfo, serviceToken_, subProcesses_); } } catch (...) { status->resetResources(); @@ -1459,17 +1451,10 @@ namespace edm { IOVSyncValue ts(EventID(lp.run(), lp.luminosityBlock(), EventID::maxEventNumber()), lp.beginTime()); + LumiTransitionInfo transitionInfo(lp, es, eventSetupImpls); using Traits = OccurrenceTraits; - - endGlobalTransitionAsync(WaitingTaskHolder(writeT), - *schedule_, - lp, - ts, - es, - eventSetupImpls, - serviceToken_, - subProcesses_, - cleaningUpAfterException); + endGlobalTransitionAsync( + WaitingTaskHolder(writeT), *schedule_, transitionInfo, serviceToken_, subProcesses_, cleaningUpAfterException); } void EventProcessor::streamEndLumiAsync(edm::WaitingTaskHolder iTask, unsigned int iStreamIndex) { diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 01d717af94e8e..12b8b9349c870 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -26,6 +26,7 @@ #include "FWCore/Framework/src/SignallingProductRegistry.h" #include "FWCore/Framework/src/PreallocationConfiguration.h" #include "FWCore/Framework/src/streamTransitionAsync.h" +#include "FWCore/Framework/src/TransitionInfoTypes.h" #include "FWCore/Framework/src/globalTransitionAsync.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/ParameterSet/interface/IllegalParameters.h" @@ -414,99 +415,88 @@ namespace edm { template <> void SubProcess::doBeginProcessBlockAsync>( - WaitingTaskHolder iHolder, - ProcessBlockPrincipal const& principal, - IOVSyncValue const&, - std::vector> const*) { + WaitingTaskHolder iHolder, ProcessBlockTransitionInfo const& iTransitionInfo) { ServiceRegistry::Operate operate(serviceToken_); ProcessBlockPrincipal& processBlockPrincipal = principalCache_.inputProcessBlockPrincipal(); - processBlockPrincipal.fillProcessBlockPrincipal(principal.processName(), principal.reader()); - propagateProducts(InProcess, principal, processBlockPrincipal); + ProcessBlockPrincipal const& parentPrincipal = iTransitionInfo.principal(); + processBlockPrincipal.fillProcessBlockPrincipal(parentPrincipal.processName(), parentPrincipal.reader()); + propagateProducts(InProcess, parentPrincipal, processBlockPrincipal); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); using Traits = OccurrenceTraits; - beginGlobalTransitionAsync( - std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + beginGlobalTransitionAsync(std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_); } template <> void SubProcess::doBeginProcessBlockAsync>( - WaitingTaskHolder iHolder, - ProcessBlockPrincipal const& principal, - IOVSyncValue const&, - std::vector> const*) { + WaitingTaskHolder iHolder, ProcessBlockTransitionInfo const& iTransitionInfo) { ServiceRegistry::Operate operate(serviceToken_); ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); + ProcessBlockPrincipal const& parentPrincipal = iTransitionInfo.principal(); processBlockPrincipal.fillProcessBlockPrincipal(processConfiguration_->processName()); - propagateProducts(InProcess, principal, processBlockPrincipal); + propagateProducts(InProcess, parentPrincipal, processBlockPrincipal); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); using Traits = OccurrenceTraits; - beginGlobalTransitionAsync( - std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_); + beginGlobalTransitionAsync(std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_); } void SubProcess::doEndProcessBlockAsync(WaitingTaskHolder iHolder, - ProcessBlockPrincipal const& principal, - IOVSyncValue const&, - std::vector> const*, + ProcessBlockTransitionInfo const& iTransitionInfo, bool cleaningUpAfterException) { ProcessBlockPrincipal& processBlockPrincipal = principalCache_.processBlockPrincipal(); - propagateProducts(InProcess, principal, processBlockPrincipal); + ProcessBlockPrincipal const& parentPrincipal = iTransitionInfo.principal(); + propagateProducts(InProcess, parentPrincipal, processBlockPrincipal); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); using Traits = OccurrenceTraits; endGlobalTransitionAsync( - std::move(iHolder), *schedule_, processBlockPrincipal, serviceToken_, subProcesses_, cleaningUpAfterException); + std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_, cleaningUpAfterException); } - void SubProcess::doBeginRunAsync(WaitingTaskHolder iHolder, - RunPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const* iEventSetupImpls) { + void SubProcess::doBeginRunAsync(WaitingTaskHolder iHolder, RunTransitionInfo const& iTransitionInfo) { ServiceRegistry::Operate operate(serviceToken_); - auto aux = std::make_shared(principal.aux()); - aux->setProcessHistoryID(principal.processHistoryID()); + RunPrincipal const& parentPrincipal = iTransitionInfo.principal(); + auto aux = std::make_shared(parentPrincipal.aux()); + aux->setProcessHistoryID(parentPrincipal.processHistoryID()); auto rpp = std::make_shared(aux, preg_, *processConfiguration_, - &(historyAppenders_[historyRunOffset_ + principal.index()]), - principal.index(), + &(historyAppenders_[historyRunOffset_ + parentPrincipal.index()]), + parentPrincipal.index(), false); - auto& processHistoryRegistry = processHistoryRegistries_[historyRunOffset_ + principal.index()]; - processHistoryRegistry.registerProcessHistory(principal.processHistory()); - rpp->fillRunPrincipal(processHistoryRegistry, principal.reader()); + auto& processHistoryRegistry = processHistoryRegistries_[historyRunOffset_ + parentPrincipal.index()]; + processHistoryRegistry.registerProcessHistory(parentPrincipal.processHistory()); + rpp->fillRunPrincipal(processHistoryRegistry, parentPrincipal.reader()); principalCache_.insert(rpp); - ProcessHistoryID const& parentInputReducedPHID = principal.reducedProcessHistoryID(); + ProcessHistoryID const& parentInputReducedPHID = parentPrincipal.reducedProcessHistoryID(); ProcessHistoryID const& inputReducedPHID = rpp->reducedProcessHistoryID(); parentToChildPhID_.insert(std::make_pair(parentInputReducedPHID, inputReducedPHID)); RunPrincipal& rp = *principalCache_.runPrincipalPtr(); - propagateProducts(InRun, principal, rp); + propagateProducts(InRun, parentPrincipal, rp); + + RunTransitionInfo transitionInfo(rp, esp_->eventSetupImpl()); using Traits = OccurrenceTraits; - beginGlobalTransitionAsync( - std::move(iHolder), *schedule_, rp, ts, esp_->eventSetupImpl(), iEventSetupImpls, serviceToken_, subProcesses_); + beginGlobalTransitionAsync(std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_); } void SubProcess::doEndRunAsync(WaitingTaskHolder iHolder, - RunPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const* iEventSetupImpls, + RunTransitionInfo const& iTransitionInfo, bool cleaningUpAfterException) { + RunPrincipal const& parentPrincipal = iTransitionInfo.principal(); RunPrincipal& rp = *principalCache_.runPrincipalPtr(); - propagateProducts(InRun, principal, rp); + propagateProducts(InRun, parentPrincipal, rp); + + RunTransitionInfo transitionInfo(rp, esp_->eventSetupImpl()); using Traits = OccurrenceTraits; - endGlobalTransitionAsync(std::move(iHolder), - *schedule_, - rp, - ts, - esp_->eventSetupImpl(), - iEventSetupImpls, - serviceToken_, - subProcesses_, - cleaningUpAfterException); + endGlobalTransitionAsync( + std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_, cleaningUpAfterException); } void SubProcess::writeProcessBlockAsync(edm::WaitingTaskHolder task, ProcessBlockType processBlockType) { @@ -574,52 +564,40 @@ namespace edm { } } - void SubProcess::doBeginLuminosityBlockAsync( - WaitingTaskHolder iHolder, - LuminosityBlockPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const* iEventSetupImpls) { + void SubProcess::doBeginLuminosityBlockAsync(WaitingTaskHolder iHolder, LumiTransitionInfo const& iTransitionInfo) { ServiceRegistry::Operate operate(serviceToken_); - auto aux = principal.aux(); - aux.setProcessHistoryID(principal.processHistoryID()); + LuminosityBlockPrincipal const& parentPrincipal = iTransitionInfo.principal(); + auto aux = parentPrincipal.aux(); + aux.setProcessHistoryID(parentPrincipal.processHistoryID()); auto lbpp = principalCache_.getAvailableLumiPrincipalPtr(); lbpp->setAux(aux); auto& processHistoryRegistry = processHistoryRegistries_[historyLumiOffset_ + lbpp->index()]; - inUseLumiPrincipals_[principal.index()] = lbpp; - processHistoryRegistry.registerProcessHistory(principal.processHistory()); - lbpp->fillLuminosityBlockPrincipal(&principal.processHistory(), principal.reader()); + inUseLumiPrincipals_[parentPrincipal.index()] = lbpp; + processHistoryRegistry.registerProcessHistory(parentPrincipal.processHistory()); + lbpp->fillLuminosityBlockPrincipal(&parentPrincipal.processHistory(), parentPrincipal.reader()); lbpp->setRunPrincipal(principalCache_.runPrincipalPtr()); LuminosityBlockPrincipal& lbp = *lbpp; - propagateProducts(InLumi, principal, lbp); + propagateProducts(InLumi, parentPrincipal, lbp); + + std::vector> const* eventSetupImpls = iTransitionInfo.eventSetupImpls(); + LumiTransitionInfo transitionInfo(lbp, *((*eventSetupImpls)[esp_->subProcessIndex()]), eventSetupImpls); using Traits = OccurrenceTraits; - beginGlobalTransitionAsync(std::move(iHolder), - *schedule_, - lbp, - ts, - *((*iEventSetupImpls)[esp_->subProcessIndex()]), - iEventSetupImpls, - serviceToken_, - subProcesses_); + beginGlobalTransitionAsync(std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_); } void SubProcess::doEndLuminosityBlockAsync(WaitingTaskHolder iHolder, - LuminosityBlockPrincipal const& principal, - IOVSyncValue const& ts, - std::vector> const* iEventSetupImpls, + LumiTransitionInfo const& iTransitionInfo, bool cleaningUpAfterException) { - LuminosityBlockPrincipal& lbp = *inUseLumiPrincipals_[principal.index()]; - propagateProducts(InLumi, principal, lbp); + LuminosityBlockPrincipal const& parentPrincipal = iTransitionInfo.principal(); + LuminosityBlockPrincipal& lbp = *inUseLumiPrincipals_[parentPrincipal.index()]; + propagateProducts(InLumi, parentPrincipal, lbp); + + std::vector> const* eventSetupImpls = iTransitionInfo.eventSetupImpls(); + LumiTransitionInfo transitionInfo(lbp, *((*eventSetupImpls)[esp_->subProcessIndex()]), eventSetupImpls); using Traits = OccurrenceTraits; - endGlobalTransitionAsync(std::move(iHolder), - *schedule_, - lbp, - ts, - *((*iEventSetupImpls)[esp_->subProcessIndex()]), - iEventSetupImpls, - serviceToken_, - subProcesses_, - cleaningUpAfterException); + endGlobalTransitionAsync( + std::move(iHolder), *schedule_, transitionInfo, serviceToken_, subProcesses_, cleaningUpAfterException); } void SubProcess::writeLumiAsync(WaitingTaskHolder task, LuminosityBlockPrincipal& principal) { diff --git a/FWCore/Framework/src/TransitionInfoTypes.cc b/FWCore/Framework/src/TransitionInfoTypes.cc new file mode 100644 index 0000000000000..a728e5bb39f99 --- /dev/null +++ b/FWCore/Framework/src/TransitionInfoTypes.cc @@ -0,0 +1,11 @@ +#include "FWCore/Framework/src/TransitionInfoTypes.h" +#include "FWCore/Framework/interface/EventSetupImpl.h" + +namespace edm { + + EventSetupImpl const& ProcessBlockTransitionInfo::eventSetupImpl() const { + static const EventSetupImpl dummyEventSetupImpl; + return dummyEventSetupImpl; + } + +} // namespace edm diff --git a/FWCore/Framework/src/TransitionInfoTypes.h b/FWCore/Framework/src/TransitionInfoTypes.h new file mode 100644 index 0000000000000..faec26234743b --- /dev/null +++ b/FWCore/Framework/src/TransitionInfoTypes.h @@ -0,0 +1,73 @@ +#ifndef FWCore_Framework_TransitionInfoTypes_h +#define FWCore_Framework_TransitionInfoTypes_h +// +// Package: FWCore/Framework +// +/** + + Description: The types here are used by + the functions beginGlobalTransitionAsync and + endGlobalTransitionAsync. They hold some of the data + passed as input arguments to those functions. + +*/ +// +// Original Author: W. David Dagenhart +// Created: 26 June 2020 + +#include +#include + +namespace edm { + class EventSetupImpl; + class LuminosityBlockPrincipal; + class ProcessBlockPrincipal; + class RunPrincipal; + + class LumiTransitionInfo { + public: + LumiTransitionInfo(LuminosityBlockPrincipal& iPrincipal, + EventSetupImpl const& iEventSetupImpl, + std::vector> const* iEventSetupImpls) + : luminosityBlockPrincipal_(iPrincipal), eventSetupImpl_(iEventSetupImpl), eventSetupImpls_(iEventSetupImpls) {} + + LuminosityBlockPrincipal& principal() { return luminosityBlockPrincipal_; } + LuminosityBlockPrincipal const& principal() const { return luminosityBlockPrincipal_; } + EventSetupImpl const& eventSetupImpl() const { return eventSetupImpl_; } + std::vector> const* eventSetupImpls() const { return eventSetupImpls_; } + + private: + LuminosityBlockPrincipal& luminosityBlockPrincipal_; + EventSetupImpl const& eventSetupImpl_; + std::vector> const* eventSetupImpls_; + }; + + class RunTransitionInfo { + public: + RunTransitionInfo(RunPrincipal& iPrincipal, EventSetupImpl const& iEventSetupImpl) + : runPrincipal_(iPrincipal), eventSetupImpl_(iEventSetupImpl) {} + + RunPrincipal& principal() { return runPrincipal_; } + RunPrincipal const& principal() const { return runPrincipal_; } + EventSetupImpl const& eventSetupImpl() const { return eventSetupImpl_; } + + private: + RunPrincipal& runPrincipal_; + EventSetupImpl const& eventSetupImpl_; + }; + + class ProcessBlockTransitionInfo { + public: + ProcessBlockTransitionInfo(ProcessBlockPrincipal& iPrincipal) : processBlockPrincipal_(iPrincipal) {} + + ProcessBlockPrincipal& principal() { return processBlockPrincipal_; } + ProcessBlockPrincipal const& principal() const { return processBlockPrincipal_; } + EventSetupImpl const& eventSetupImpl() const; + + private: + ProcessBlockPrincipal& processBlockPrincipal_; + }; + +}; // namespace edm + +#endif diff --git a/FWCore/Framework/src/globalTransitionAsync.h b/FWCore/Framework/src/globalTransitionAsync.h index 0c18ea73e387b..8ca4292ae2258 100644 --- a/FWCore/Framework/src/globalTransitionAsync.h +++ b/FWCore/Framework/src/globalTransitionAsync.h @@ -18,161 +18,105 @@ // Created: Tue, 06 Sep 2016 16:04:26 GMT // -// system include files -#include "FWCore/Framework/interface/EventSetupImpl.h" -#include "FWCore/Framework/interface/IOVSyncValue.h" #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/SubProcess.h" +#include "FWCore/Framework/src/TransitionInfoTypes.h" #include "FWCore/Concurrency/interface/WaitingTask.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" -#include +#include +#include #include -// user include files - -// forward declarations - namespace edm { - class LuminosityBlockPrincipal; - class ProcessBlockPrincipal; - class RunPrincipal; //This is code in common between beginStreamRun and beginGlobalLuminosityBlock template - inline void subProcessDoGlobalBeginTransitionAsync( - WaitingTaskHolder iHolder, - SubProcess& iSubProcess, - LuminosityBlockPrincipal& iPrincipal, - IOVSyncValue const& iTS, - std::vector> const* iEventSetupImpls) { - iSubProcess.doBeginLuminosityBlockAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls); + inline void subProcessDoGlobalBeginTransitionAsync(WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + LumiTransitionInfo const& iTransitionInfo) { + iSubProcess.doBeginLuminosityBlockAsync(std::move(iHolder), iTransitionInfo); } template - inline void subProcessDoGlobalBeginTransitionAsync( - WaitingTaskHolder iHolder, - SubProcess& iSubProcess, - RunPrincipal& iPrincipal, - IOVSyncValue const& iTS, - std::vector> const* iEventSetupImpls) { - iSubProcess.doBeginRunAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls); + inline void subProcessDoGlobalBeginTransitionAsync(WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + RunTransitionInfo const& iTransitionInfo) { + iSubProcess.doBeginRunAsync(std::move(iHolder), iTransitionInfo); } template - inline void subProcessDoGlobalBeginTransitionAsync( - WaitingTaskHolder iHolder, - SubProcess& iSubProcess, - ProcessBlockPrincipal& iPrincipal, - IOVSyncValue const& iTS, - std::vector> const* iEventSetupImpls) { - iSubProcess.doBeginProcessBlockAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls); + inline void subProcessDoGlobalBeginTransitionAsync(WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + ProcessBlockTransitionInfo const& iTransitionInfo) { + iSubProcess.doBeginProcessBlockAsync(std::move(iHolder), iTransitionInfo); } - inline void subProcessDoGlobalEndTransitionAsync( - WaitingTaskHolder iHolder, - SubProcess& iSubProcess, - LuminosityBlockPrincipal& iPrincipal, - IOVSyncValue const& iTS, - std::vector> const* iEventSetupImpls, - bool cleaningUpAfterException) { - iSubProcess.doEndLuminosityBlockAsync( - std::move(iHolder), iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); + inline void subProcessDoGlobalEndTransitionAsync(WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + LumiTransitionInfo const& iTransitionInfo, + bool cleaningUpAfterException) { + iSubProcess.doEndLuminosityBlockAsync(std::move(iHolder), iTransitionInfo, cleaningUpAfterException); } - inline void subProcessDoGlobalEndTransitionAsync( - WaitingTaskHolder iHolder, - SubProcess& iSubProcess, - RunPrincipal& iPrincipal, - IOVSyncValue const& iTS, - std::vector> const* iEventSetupImpls, - bool cleaningUpAfterException) { - iSubProcess.doEndRunAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); + inline void subProcessDoGlobalEndTransitionAsync(WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + RunTransitionInfo const& iTransitionInfo, + bool cleaningUpAfterException) { + iSubProcess.doEndRunAsync(std::move(iHolder), iTransitionInfo, cleaningUpAfterException); } - inline void subProcessDoGlobalEndTransitionAsync( - WaitingTaskHolder iHolder, - SubProcess& iSubProcess, - ProcessBlockPrincipal& iPrincipal, - IOVSyncValue const& iTS, - std::vector> const* iEventSetupImpls, - bool cleaningUpAfterException) { - iSubProcess.doEndProcessBlockAsync(std::move(iHolder), iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); + inline void subProcessDoGlobalEndTransitionAsync(WaitingTaskHolder iHolder, + SubProcess& iSubProcess, + ProcessBlockTransitionInfo const& iTransitionInfo, + bool cleaningUpAfterException) { + iSubProcess.doEndProcessBlockAsync(std::move(iHolder), iTransitionInfo, cleaningUpAfterException); } - template - void beginGlobalTransitionAsync( - WaitingTaskHolder iWait, - Schedule& iSchedule, - P& iPrincipal, - IOVSyncValue const& iTS, - EventSetupImpl const& iES, - std::vector> const* - iEventSetupImpls, // always null for runs until we enable concurrent run processing - ServiceToken const& token, - SC& iSubProcesses) { - //When we are done processing the global for this process, + template + void beginGlobalTransitionAsync(WaitingTaskHolder iWait, + Schedule& iSchedule, + typename Traits::TransitionInfoType& transitionInfo, + ServiceToken const& token, + std::vector& iSubProcesses) { + // When we are done processing the global for this process, // we need to run the global for all SubProcesses - auto subs = make_waiting_task( - tbb::task::allocate_root(), - [&iSubProcesses, iWait, &iPrincipal, iTS, iEventSetupImpls](std::exception_ptr const* iPtr) mutable { - if (iPtr) { - auto excpt = *iPtr; - auto delayError = - make_waiting_task(tbb::task::allocate_root(), + auto subs = + make_waiting_task(tbb::task::allocate_root(), + [&iSubProcesses, iWait, info = transitionInfo](std::exception_ptr const* iPtr) mutable { + if (iPtr) { + auto excpt = *iPtr; + auto delayError = make_waiting_task( + tbb::task::allocate_root(), [iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); - WaitingTaskHolder h(delayError); - for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalBeginTransitionAsync(h, subProcess, iPrincipal, iTS, iEventSetupImpls); - } - } else { - for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalBeginTransitionAsync(iWait, subProcess, iPrincipal, iTS, iEventSetupImpls); - } - } - }); + WaitingTaskHolder h(delayError); + for (auto& subProcess : iSubProcesses) { + subProcessDoGlobalBeginTransitionAsync(h, subProcess, info); + } + } else { + for (auto& subProcess : iSubProcesses) { + subProcessDoGlobalBeginTransitionAsync(iWait, subProcess, info); + } + } + }); WaitingTaskHolder h(subs); - iSchedule.processOneGlobalAsync(std::move(h), iPrincipal, iES, token); - } - - // The only purpose of this function is to create dummy values for the - // EventSetup arguments needed by the generic function beginGlobalTransitionsAsync - template - void beginGlobalTransitionAsync( - WaitingTaskHolder iWait, Schedule& iSchedule, P& iPrincipal, ServiceToken const& token, SC& iSubProcesses) { - // There is no EventSetup for ProcessBlock transitions - // so we just pass in dummy values that are not used. - IOVSyncValue dummyIOVSyncValue; - EventSetupImpl dummyEventSetupImpl; - std::vector> const* dummyEventSetupImpls = nullptr; - - beginGlobalTransitionAsync(std::move(iWait), - iSchedule, - iPrincipal, - dummyIOVSyncValue, - dummyEventSetupImpl, - dummyEventSetupImpls, - token, - iSubProcesses); + iSchedule.processOneGlobalAsync( + std::move(h), transitionInfo.principal(), transitionInfo.eventSetupImpl(), token); } - template + template void endGlobalTransitionAsync(WaitingTaskHolder iWait, Schedule& iSchedule, - P& iPrincipal, - IOVSyncValue const& iTS, - EventSetupImpl const& iES, - std::vector> const* - iEventSetupImpls, // always null for runs until we enable concurrent run processing + typename Traits::TransitionInfoType& transitionInfo, ServiceToken const& token, - SC& iSubProcesses, + std::vector& iSubProcesses, bool cleaningUpAfterException) { - //When we are done processing the global for this process, + // When we are done processing the global for this process, // we need to run the global for all SubProcesses auto subs = make_waiting_task(tbb::task::allocate_root(), - [&iSubProcesses, iWait, &iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException]( + [&iSubProcesses, iWait, info = transitionInfo, cleaningUpAfterException]( std::exception_ptr const* iPtr) mutable { if (iPtr) { auto excpt = *iPtr; @@ -181,46 +125,20 @@ namespace edm { [iWait, excpt](std::exception_ptr const*) mutable { iWait.doneWaiting(excpt); }); WaitingTaskHolder h(delayError); for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalEndTransitionAsync( - h, subProcess, iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); + subProcessDoGlobalEndTransitionAsync(h, subProcess, info, cleaningUpAfterException); } } else { for (auto& subProcess : iSubProcesses) { - subProcessDoGlobalEndTransitionAsync( - iWait, subProcess, iPrincipal, iTS, iEventSetupImpls, cleaningUpAfterException); + subProcessDoGlobalEndTransitionAsync(iWait, subProcess, info, cleaningUpAfterException); } } }); WaitingTaskHolder h(subs); - iSchedule.processOneGlobalAsync(std::move(h), iPrincipal, iES, token, cleaningUpAfterException); + iSchedule.processOneGlobalAsync( + std::move(h), transitionInfo.principal(), transitionInfo.eventSetupImpl(), token, cleaningUpAfterException); } - // The only purpose of this function is to create dummy values for the - // EventSetup arguments needed by the generic function endGlobalTransitionsAsync - template - void endGlobalTransitionAsync(WaitingTaskHolder iWait, - Schedule& iSchedule, - P& iPrincipal, - ServiceToken const& token, - SC& iSubProcesses, - bool cleaningUpAfterException) { - // There is no EventSetup for ProcessBlock transitions - // so we just pass in dummy values that are not used. - IOVSyncValue dummyIOVSyncValue; - EventSetupImpl dummyEventSetupImpl; - std::vector> const* dummyEventSetupImpls = nullptr; - - endGlobalTransitionAsync(std::move(iWait), - iSchedule, - iPrincipal, - dummyIOVSyncValue, - dummyEventSetupImpl, - dummyEventSetupImpls, - token, - iSubProcesses, - cleaningUpAfterException); - } }; // namespace edm #endif diff --git a/FWCore/TestProcessor/src/TestProcessor.cc b/FWCore/TestProcessor/src/TestProcessor.cc index e6a18e1417ce8..60e491415285c 100644 --- a/FWCore/TestProcessor/src/TestProcessor.cc +++ b/FWCore/TestProcessor/src/TestProcessor.cc @@ -25,8 +25,9 @@ #include "FWCore/Framework/interface/PathsAndConsumesOfModules.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/Framework/src/EventSetupsController.h" -#include "FWCore/Framework/src/streamTransitionAsync.h" #include "FWCore/Framework/src/globalTransitionAsync.h" +#include "FWCore/Framework/src/streamTransitionAsync.h" +#include "FWCore/Framework/src/TransitionInfoTypes.h" #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" @@ -404,12 +405,13 @@ namespace edm { std::vector emptyList; { - typedef OccurrenceTraits Traits; + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); beginGlobalTransitionAsync( - WaitingTaskHolder(globalWaitTask.get()), *schedule_, processBlockPrincipal, serviceToken_, emptyList); + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, emptyList); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { @@ -434,17 +436,12 @@ namespace edm { std::vector emptyList; { - typedef OccurrenceTraits Traits; + RunTransitionInfo transitionInfo(runPrincipal, es); + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - beginGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), - *schedule_, - runPrincipal, - ts, - es, - nullptr, - serviceToken_, - emptyList); + beginGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, emptyList); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { std::rethrow_exception(*(globalWaitTask->exceptionPtr())); @@ -491,17 +488,12 @@ namespace edm { std::vector emptyList; { - typedef OccurrenceTraits Traits; + LumiTransitionInfo transitionInfo(*lumiPrincipal_, es, nullptr); + using Traits = OccurrenceTraits; auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - beginGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), - *schedule_, - *lumiPrincipal_, - ts, - es, - nullptr, - serviceToken_, - emptyList); + beginGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, emptyList); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { std::rethrow_exception(*(globalWaitTask->exceptionPtr())); @@ -610,16 +602,10 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - typedef OccurrenceTraits Traits; - endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), - *schedule_, - *lumiPrincipal, - ts, - es, - nullptr, - serviceToken_, - emptyList, - false); + LumiTransitionInfo transitionInfo(*lumiPrincipal, es, nullptr); + using Traits = OccurrenceTraits; + endGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, emptyList, false); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { std::rethrow_exception(*(globalWaitTask->exceptionPtr())); @@ -673,16 +659,10 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - typedef OccurrenceTraits Traits; - endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), - *schedule_, - runPrincipal, - ts, - es, - nullptr, - serviceToken_, - emptyList, - false); + RunTransitionInfo transitionInfo(runPrincipal, es); + using Traits = OccurrenceTraits; + endGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, emptyList, false); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { std::rethrow_exception(*(globalWaitTask->exceptionPtr())); @@ -704,13 +684,10 @@ namespace edm { auto globalWaitTask = make_empty_waiting_task(); globalWaitTask->increment_ref_count(); - typedef OccurrenceTraits Traits; - endGlobalTransitionAsync(WaitingTaskHolder(globalWaitTask.get()), - *schedule_, - processBlockPrincipal, - serviceToken_, - emptyList, - false); + ProcessBlockTransitionInfo transitionInfo(processBlockPrincipal); + using Traits = OccurrenceTraits; + endGlobalTransitionAsync( + WaitingTaskHolder(globalWaitTask.get()), *schedule_, transitionInfo, serviceToken_, emptyList, false); globalWaitTask->wait_for_all(); if (globalWaitTask->exceptionPtr() != nullptr) { std::rethrow_exception(*(globalWaitTask->exceptionPtr())); From fb30b13a7733a7413314ca6d92d90ad2d5cc6c26 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Mon, 29 Jun 2020 23:13:25 +0200 Subject: [PATCH 24/25] Test modes Runs and RunsAndLumis --- FWCore/Integration/test/run_TestGetBy.sh | 6 +++ .../test/testGetByRunsLumisMode_cfg.py | 41 +++++++++++++++++++ .../Integration/test/testGetByRunsMode_cfg.py | 41 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 FWCore/Integration/test/testGetByRunsLumisMode_cfg.py create mode 100644 FWCore/Integration/test/testGetByRunsMode_cfg.py diff --git a/FWCore/Integration/test/run_TestGetBy.sh b/FWCore/Integration/test/run_TestGetBy.sh index bc323163d6d18..98526eb827230 100755 --- a/FWCore/Integration/test/run_TestGetBy.sh +++ b/FWCore/Integration/test/run_TestGetBy.sh @@ -42,6 +42,12 @@ pushd ${LOCAL_TMP_DIR} echo "testProducesCollector" cmsRun -p ${LOCAL_TEST_DIR}/testProducesCollector_cfg.py || die "cmsRun testProducesCollector_cfg.py" $? + echo "testGetByRunsMode_cfg.py" + cmsRun -p ${LOCAL_TEST_DIR}/testGetByRunsMode_cfg.py || die "cmsRun testGetByRunsMode_cfg.py" $? + + echo "testGetByRunsLumisMode_cfg.py" + cmsRun -p ${LOCAL_TEST_DIR}/testGetByRunsLumisMode_cfg.py || die "cmsRun testGetByRunsLumisMode_cfg.py" $? + popd exit 0 diff --git a/FWCore/Integration/test/testGetByRunsLumisMode_cfg.py b/FWCore/Integration/test/testGetByRunsLumisMode_cfg.py new file mode 100644 index 0000000000000..9c10f2ab44abe --- /dev/null +++ b/FWCore/Integration/test/testGetByRunsLumisMode_cfg.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("PROD2") + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:testGetBy1.root' + ), + processingMode=cms.untracked.string('RunsAndLumis') +) + +process.intProducerBeginProcessBlock = cms.EDProducer("IntProducerBeginProcessBlock", ivalue = cms.int32(10000)) + +process.intProducerEndProcessBlock = cms.EDProducer("IntProducerEndProcessBlock", ivalue = cms.int32(100000)) + +process.a1 = cms.EDAnalyzer("TestFindProduct", + inputTags = cms.untracked.VInputTag(), + expectedSum = cms.untracked.int32(110000), + inputTagsBeginProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerBeginProcessBlock"), + ), + inputTagsEndProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock"), + ), + inputTagsEndProcessBlock2 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "two"), + ), + inputTagsEndProcessBlock3 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "three"), + ), + inputTagsEndProcessBlock4 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "four"), + ) +) + + +process.p1 = cms.Path(process.intProducerBeginProcessBlock + + process.intProducerEndProcessBlock + + process.a1 +) + diff --git a/FWCore/Integration/test/testGetByRunsMode_cfg.py b/FWCore/Integration/test/testGetByRunsMode_cfg.py new file mode 100644 index 0000000000000..228138da69946 --- /dev/null +++ b/FWCore/Integration/test/testGetByRunsMode_cfg.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("PROD2") + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:testGetBy1.root' + ), + processingMode=cms.untracked.string('Runs') +) + +process.intProducerBeginProcessBlock = cms.EDProducer("IntProducerBeginProcessBlock", ivalue = cms.int32(10000)) + +process.intProducerEndProcessBlock = cms.EDProducer("IntProducerEndProcessBlock", ivalue = cms.int32(100000)) + +process.a1 = cms.EDAnalyzer("TestFindProduct", + inputTags = cms.untracked.VInputTag(), + expectedSum = cms.untracked.int32(110000), + inputTagsBeginProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerBeginProcessBlock"), + ), + inputTagsEndProcessBlock = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock"), + ), + inputTagsEndProcessBlock2 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "two"), + ), + inputTagsEndProcessBlock3 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "three"), + ), + inputTagsEndProcessBlock4 = cms.untracked.VInputTag( + cms.InputTag("intProducerEndProcessBlock", "four"), + ) +) + + +process.p1 = cms.Path(process.intProducerBeginProcessBlock + + process.intProducerEndProcessBlock + + process.a1 +) + From 3c64a1bb3271a38084718505e36198856f710051 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 1 Jul 2020 23:07:43 +0200 Subject: [PATCH 25/25] Add enum value Transition::AccessInputProcessBlock --- FWCore/Framework/interface/OccurrenceTraits.h | 2 +- FWCore/Utilities/interface/Transition.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/FWCore/Framework/interface/OccurrenceTraits.h b/FWCore/Framework/interface/OccurrenceTraits.h index a2f0f42c53ca3..4781b24964231 100644 --- a/FWCore/Framework/interface/OccurrenceTraits.h +++ b/FWCore/Framework/interface/OccurrenceTraits.h @@ -432,7 +432,7 @@ namespace edm { using TransitionInfoType = ProcessBlockTransitionInfo; using Context = GlobalContext; static bool constexpr isEvent_ = false; - static Transition constexpr transition_ = Transition::BeginProcessBlock; + static Transition constexpr transition_ = Transition::AccessInputProcessBlock; static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) { return GlobalContext(GlobalContext::Transition::kAccessInputProcessBlock, diff --git a/FWCore/Utilities/interface/Transition.h b/FWCore/Utilities/interface/Transition.h index 5e9b15210980c..40b8827fc1227 100644 --- a/FWCore/Utilities/interface/Transition.h +++ b/FWCore/Utilities/interface/Transition.h @@ -17,6 +17,7 @@ namespace edm { EndRun, BeginProcessBlock, EndProcessBlock, + AccessInputProcessBlock, NumberOfTransitions, NumberOfEventSetupTransitions = BeginProcessBlock };