Skip to content

Commit

Permalink
Merge pull request #46871 from wddgit/bugFixESUpdateLookup
Browse files Browse the repository at this point in the history
SubProcess bug fix, updateLookup called too early
  • Loading branch information
cmsbuild authored Dec 10, 2024
2 parents 113e79b + 126bf82 commit 87f3f24
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
2 changes: 2 additions & 0 deletions FWCore/Framework/interface/EventSetupProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ namespace edm {
std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>>& referencedESProducers,
EventSetupsController& esController);

void updateLookup();

bool doRecordsMatch(EventSetupProvider& precedingESProvider,
EventSetupRecordKey const& eventSetupRecordKey,
std::map<EventSetupRecordKey, bool>& allComponentsMatch,
Expand Down
4 changes: 4 additions & 0 deletions FWCore/Framework/interface/EventSetupRecordProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "FWCore/Framework/interface/EventSetupRecordImpl.h"
#include "FWCore/Framework/interface/ValidityInterval.h"
#include "FWCore/Utilities/interface/get_underlying_safe.h"
#include "FWCore/Utilities/interface/propagate_const.h"

// system include files
#include <map>
Expand All @@ -40,6 +41,7 @@ namespace edm {
struct ComponentDescription;
class DataKey;
class ESProductResolverProvider;
class ESRecordsToProductResolverIndices;
class EventSetupProvider;
class EventSetupRecordImpl;
class ParameterSetIDHolder;
Expand Down Expand Up @@ -157,6 +159,8 @@ namespace edm {

IntervalStatus intervalStatus() const { return intervalStatus_; }

void updateLookup(ESRecordsToProductResolverIndices const&);

protected:
void addResolversToRecordHelper(edm::propagate_const<std::shared_ptr<ESProductResolverProvider>>& dpp,
DataToPreferredProviderMap const& mp) {
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/src/ESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ namespace edm {
sharedResourceNames_.reset();
}

itemsToGetFromRecords_.reserve(consumesInfos_.size());
recordsUsedDuringGet_.reserve(consumesInfos_.size());

if (itemsToGetFromRecords_.size() == consumesInfos_.size()) {
return;
}

itemsToGetFromRecords_.reserve(consumesInfos_.size());
recordsUsedDuringGet_.reserve(consumesInfos_.size());

for (auto& info : consumesInfos_) {
auto& items = itemsToGetFromRecords_.emplace_back();
items.reserve(info->size());
Expand Down
11 changes: 7 additions & 4 deletions FWCore/Framework/src/EventSetupProvider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,6 @@ namespace edm {
}
}

auto indices = recordsToResolverIndices();
for (auto& provider : *dataProviders_) {
provider->updateLookup(indices);
}
dataProviders_.reset();

mustFinishConfiguration_ = false;
Expand Down Expand Up @@ -541,6 +537,13 @@ namespace edm {
}
}

void EventSetupProvider::updateLookup() {
auto indices = recordsToResolverIndices();
for (auto& recordProvider : recordProviders_) {
recordProvider->updateLookup(indices);
}
}

bool EventSetupProvider::doRecordsMatch(EventSetupProvider& precedingESProvider,
EventSetupRecordKey const& eventSetupRecordKey,
std::map<EventSetupRecordKey, bool>& allComponentsMatch,
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Framework/src/EventSetupRecordProvider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ namespace edm {
for_all(providers_, std::bind(&EventSetupRecordProvider::addResolversToRecordHelper, this, _1, iMap));
}

void EventSetupRecordProvider::updateLookup(ESRecordsToProductResolverIndices const& iResolverToIndices) {
for (auto& productResolverProvider : providers_) {
productResolverProvider->updateLookup(iResolverToIndices);
}
}

std::set<EventSetupRecordKey> EventSetupRecordProvider::dependentRecords() const { return dependencies(key()); }

std::set<ComponentDescription> EventSetupRecordProvider::resolverProviderDescriptions() const {
Expand Down
8 changes: 8 additions & 0 deletions FWCore/Framework/src/EventSetupsController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ namespace edm {
// In the following function, all the other components that contribute
// to the same record and also the records that record depends on are
// also checked. The component sharing is appropriately fixed as necessary.
// (this needs to be done before updateLookup because this can cause new
// ESProducers to be constructed).
checkESProducerSharing();
clearComponents();

// updateLookup needs to be called after checkESProducerSharing because
// that can cause new ESProducers to be constructed
for (auto& eventSetupProvider : providers_) {
eventSetupProvider->updateLookup();
}

initializeEventSetupRecordIOVQueues();
numberOfConcurrentIOVs_.clear();
mustFinishConfiguration_ = false;
Expand Down

0 comments on commit 87f3f24

Please sign in to comment.