39 namespace eventsetup {
46 eventSetupRecordIOVQueue->endIOVAsync(iEndTask);
53 unsigned int maxConcurrentIOVs,
58 std::shared_ptr<EventSetupProvider> returnValue(
102 std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls,
106 bool iForceCacheClear) {
107 auto asyncEventSetup =
108 [
this, &endIOVWaitingTasks, &eventSetupImpls, &queueWhichWaitsForIOVsToFinish, actReg, iForceCacheClear](
110 queueWhichWaitsForIOVsToFinish.pause();
112 if (iForceCacheClear) {
116 actReg->preESSyncIOVSignal_.emit(iSync);
120 task.doneWaiting(std::current_exception());
130 queueWhichWaitsForIOVsToFinish.push(*
group,
131 [iSync, taskToStartAfterIOVInit, asyncEventSetup, weakToken]()
mutable {
133 asyncEventSetup(iSync, taskToStartAfterIOVInit);
136 asyncEventSetup(iSync, taskToStartAfterIOVInit);
144 std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls) {
147 bool newEventSetupImpl =
false;
148 eventSetupImpls.clear();
155 eventSetupProvider->setAllValidityIntervals(syncValue);
163 eventSetupRecordIOVQueue->setNewIntervalForAnySubProcess();
171 eventSetupImpls.push_back(eventSetupProvider->eventSetupForInstance(syncValue, newEventSetupImpl));
175 eventSetupRecordIOVQueue->checkForNewIOVs(taskToStartAfterIOVInit, endIOVWaitingTasks, newEventSetupImpl);
182 if (eventSetupProvider->doWeNeedToWaitForIOVsToFinish(syncValue)) {
192 eventSetupProvider->forceCacheClear();
204 it->second.subProcessIndexes().push_back(subProcessIndex);
206 return it->second.provider();
210 return std::shared_ptr<DataProxyProvider>();
214 std::shared_ptr<DataProxyProvider>
const& component,
215 unsigned subProcessIndex) {
219 newElement->second.subProcessIndexes().push_back(subProcessIndex);
230 it->second.subProcessIndexes().push_back(subProcessIndex);
232 return it->second.finder();
236 return std::shared_ptr<EventSetupRecordIntervalFinder>();
240 std::shared_ptr<EventSetupRecordIntervalFinder>
const& component,
241 unsigned subProcessIndex) {
245 newElement->second.subProcessIndexes().push_back(subProcessIndex);
254 unsigned subProcessIndex,
255 unsigned precedingProcessIndex,
256 bool& firstProcessWithThisPSet,
257 bool& precedingHasMatchingPSet)
const {
260 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
262 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
263 if (iFound == subProcessIndexes.end()) {
267 if (iFound == subProcessIndexes.begin()) {
268 firstProcessWithThisPSet =
true;
269 precedingHasMatchingPSet =
false;
271 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
272 if (iFoundPreceding == iFound) {
273 firstProcessWithThisPSet =
false;
274 precedingHasMatchingPSet =
false;
276 firstProcessWithThisPSet =
false;
277 precedingHasMatchingPSet =
true;
283 <<
"Subprocess index not found. This should never happen\n" 284 <<
"Please report this to a Framework Developer\n";
288 unsigned subProcessIndex,
289 unsigned precedingProcessIndex)
const {
292 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
294 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
295 if (iFound == subProcessIndexes.end()) {
299 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
300 if (iFoundPreceding == iFound) {
303 return iFoundPreceding == subProcessIndexes.begin();
307 <<
"Subprocess index not found. This should never happen\n" 308 <<
"Please report this to a Framework Developer\n";
313 unsigned subProcessIndex,
314 unsigned precedingProcessIndex)
const {
317 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
319 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
320 if (iFound == subProcessIndexes.end()) {
324 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
325 if (iFoundPreceding == iFound) {
328 return (++iFoundPreceding) == iFound;
332 <<
"Subprocess index not found. This should never happen\n" 333 <<
"Please report this to a Framework Developer\n";
338 unsigned subProcessIndex,
339 unsigned precedingProcessIndex)
const {
342 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
344 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
345 if (iFound == subProcessIndexes.end()) {
349 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
350 if (iFoundPreceding == iFound) {
357 <<
"Subprocess index not found. This should never happen\n" 358 <<
"Please report this to a Framework Developer\n";
363 unsigned subProcessIndex,
364 unsigned precedingProcessIndex)
const {
367 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
369 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
370 if (iFound == subProcessIndexes.end()) {
374 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
375 if (iFoundPreceding == iFound) {
382 <<
"Subprocess index not found. This should never happen\n" 383 <<
"Please report this to a Framework Developer\n";
390 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
392 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
393 if (iFound == subProcessIndexes.end()) {
396 return *it->second.pset();
399 <<
"Subprocess index not found. This should never happen\n" 400 <<
"Please report this to a Framework Developer\n";
407 if (esProvider != esProviderEnd)
409 for (; esProvider != esProviderEnd; ++esProvider) {
417 std::set<ParameterSetIDHolder> sharingCheckDone;
424 std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>> referencedESProducers;
430 for (
auto precedingESProvider =
providers_.begin(); precedingESProvider != esProvider; ++precedingESProvider) {
432 ->checkESProducerSharing(
433 typeResolver_, **precedingESProvider, sharingCheckDone, referencedESProducers, *
this);
436 (*esProvider)->resetRecordToProxyPointers();
439 eventSetupProvider->clearInitializationData();
444 std::set<EventSetupRecordKey>
keys;
446 provider->fillKeys(
keys);
463 oneapi::tbb::task_group& iGroup,
469 std::vector<std::shared_ptr<const EventSetupImpl>> dummyEventSetupImpls;
472 WaitingTaskHolder waitingTaskHolder(iGroup, &waitUntilIOVInitializationCompletes);
477 syncValue, waitingTaskHolder, dummyWaitingTaskList, dummyEventSetupImpls);
478 dummyWaitingTaskList.
doneWaiting(std::exception_ptr{});
480 dummyWaitingTaskList.
doneWaiting(std::exception_ptr{});
481 waitingTaskHolder.
doneWaiting(std::current_exception());
484 waitUntilIOVInitializationCompletes.wait();
std::shared_ptr< EventSetupRecordIntervalFinder > getESSourceAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
void addRecProvider(EventSetupRecordProvider *recProvider)
void checkESProducerSharing()
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_
void putESSource(ParameterSet const &pset, std::shared_ptr< EventSetupRecordIntervalFinder > const &component, unsigned subProcessIndex)
bool isMatchingESSource(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
std::unique_ptr< EventSetupProvider > makeEventSetupProvider(ParameterSet const ¶ms, unsigned subProcessIndex, ActivityRegistry *activityRegistry)
bool mustFinishConfiguration_
ModuleTypeResolverBase const * typeResolver_
void lookForMatches(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex, bool &firstProcessWithThisPSet, bool &precedingHasMatchingPSet) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool hasNonconcurrentFinder() const
void synchronousEventSetupForInstance(IOVSyncValue const &syncValue, oneapi::tbb::task_group &iGroup, eventsetup::EventSetupsController &espController)
oneapi::tbb::task_group * group() const noexcept
ParameterSet & getESProducerPSet(ParameterSetID const &psetID, unsigned subProcessIndex)
bool isLastMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
void putESProducer(ParameterSet &pset, std::shared_ptr< DataProxyProvider > const &component, unsigned subProcessIndex)
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
std::shared_ptr< DataProxyProvider > getESProducerAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
void doneWaiting(std::exception_ptr iExcept)
void fillRecordsNotAllowingConcurrentIOVs(EventSetupProvider const &)
std::multimap< ParameterSetID, ESSourceInfo > essources_
bool isMatchingESProducer(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
std::shared_ptr< EventSetupProvider > makeProvider(ParameterSet &, ActivityRegistry *, ParameterSet const *eventSetupPset=nullptr, unsigned int maxConcurrentIOVs=0, bool dumpOptions=false)
void initializeEventSetupRecordIOVQueues()
void eventSetupForInstanceAsync(IOVSyncValue const &, WaitingTaskHolder const &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &)
ServiceToken lock() const
void readConfigurationParameters(ParameterSet const *eventSetupPset, unsigned int maxConcurrentIOVs, bool dumpOptions)
void finishConfiguration()
void fillEventSetupProvider(ModuleTypeResolverBase const *resolver, EventSetupsController &esController, EventSetupProvider &cp, ParameterSet ¶ms)
bool hasNonconcurrentFinder_
bool isFirstMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
void completedSuccessfully()
void endIOVsAsync(edm::WaitingTaskHolder iEndTask)
void runOrQueueEventSetupForInstanceAsync(IOVSyncValue const &, WaitingTaskHolder &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &, edm::SerialTaskQueue &queueWhichWaitsForIOVsToFinish, ActivityRegistry *, ServiceToken const &, bool iForceCacheClear=false)
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_
bool isTransientEqual(ParameterSet const &a, ParameterSet const &b)
unsigned int numberOfConcurrentIOVs(EventSetupRecordKey const &, bool printInfoMsg=false) const
NumberOfConcurrentIOVs numberOfConcurrentIOVs_