39 namespace eventsetup {
43 : typeResolverMaker_(resolverMaker) {}
47 eventSetupRecordIOVQueue->endIOVAsync(iEndTask);
54 unsigned int maxConcurrentIOVs,
59 std::shared_ptr<EventSetupProvider> returnValue(
103 std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls,
107 bool iForceCacheClear) {
108 auto asyncEventSetup =
109 [
this, &endIOVWaitingTasks, &eventSetupImpls, &queueWhichWaitsForIOVsToFinish, actReg, iForceCacheClear](
111 queueWhichWaitsForIOVsToFinish.pause();
113 if (iForceCacheClear) {
121 actReg->preESSyncIOVSignal_.emit(iSync);
122 auto postSignal = [&iSync](
ActivityRegistry* actReg) { actReg->postESSyncIOVSignal_.emit(iSync); };
123 std::unique_ptr<ActivityRegistry, decltype(postSignal)> guard(actReg, postSignal);
128 task.doneWaiting(std::current_exception());
138 queueWhichWaitsForIOVsToFinish.push(*
group,
139 [iSync, taskToStartAfterIOVInit, asyncEventSetup, weakToken]()
mutable {
141 asyncEventSetup(iSync, taskToStartAfterIOVInit);
144 asyncEventSetup(iSync, taskToStartAfterIOVInit);
152 std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls) {
155 bool newEventSetupImpl =
false;
156 eventSetupImpls.clear();
163 eventSetupProvider->setAllValidityIntervals(syncValue);
171 eventSetupRecordIOVQueue->setNewIntervalForAnySubProcess();
179 eventSetupImpls.push_back(eventSetupProvider->eventSetupForInstance(syncValue, newEventSetupImpl));
183 eventSetupRecordIOVQueue->checkForNewIOVs(taskToStartAfterIOVInit, endIOVWaitingTasks, newEventSetupImpl);
190 if (eventSetupProvider->doWeNeedToWaitForIOVsToFinish(syncValue)) {
200 eventSetupProvider->forceCacheClear();
212 it->second.subProcessIndexes().push_back(subProcessIndex);
214 return it->second.provider();
218 return std::shared_ptr<ESProductResolverProvider>();
222 std::shared_ptr<ESProductResolverProvider>
const& component,
223 unsigned subProcessIndex) {
227 newElement->second.subProcessIndexes().push_back(subProcessIndex);
238 it->second.subProcessIndexes().push_back(subProcessIndex);
240 return it->second.finder();
244 return std::shared_ptr<EventSetupRecordIntervalFinder>();
248 std::shared_ptr<EventSetupRecordIntervalFinder>
const& component,
249 unsigned subProcessIndex) {
253 newElement->second.subProcessIndexes().push_back(subProcessIndex);
262 unsigned subProcessIndex,
263 unsigned precedingProcessIndex,
264 bool& firstProcessWithThisPSet,
265 bool& precedingHasMatchingPSet)
const {
268 std::vector<unsigned>
const& subProcessIndexes =
it->second.subProcessIndexes();
270 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
271 if (iFound == subProcessIndexes.end()) {
275 if (iFound == subProcessIndexes.begin()) {
276 firstProcessWithThisPSet =
true;
277 precedingHasMatchingPSet =
false;
279 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
280 if (iFoundPreceding == iFound) {
281 firstProcessWithThisPSet =
false;
282 precedingHasMatchingPSet =
false;
284 firstProcessWithThisPSet =
false;
285 precedingHasMatchingPSet =
true;
291 <<
"Subprocess index not found. This should never happen\n" 292 <<
"Please report this to a Framework Developer\n";
296 unsigned subProcessIndex,
297 unsigned precedingProcessIndex)
const {
300 std::vector<unsigned>
const& subProcessIndexes =
it->second.subProcessIndexes();
302 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
303 if (iFound == subProcessIndexes.end()) {
307 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
308 if (iFoundPreceding == iFound) {
311 return iFoundPreceding == subProcessIndexes.begin();
315 <<
"Subprocess index not found. This should never happen\n" 316 <<
"Please report this to a Framework Developer\n";
321 unsigned subProcessIndex,
322 unsigned precedingProcessIndex)
const {
325 std::vector<unsigned>
const& subProcessIndexes =
it->second.subProcessIndexes();
327 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
328 if (iFound == subProcessIndexes.end()) {
332 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
333 if (iFoundPreceding == iFound) {
336 return (++iFoundPreceding) == iFound;
340 <<
"Subprocess index not found. This should never happen\n" 341 <<
"Please report this to a Framework Developer\n";
346 unsigned subProcessIndex,
347 unsigned precedingProcessIndex)
const {
350 std::vector<unsigned>
const& subProcessIndexes =
it->second.subProcessIndexes();
352 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
353 if (iFound == subProcessIndexes.end()) {
357 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
358 if (iFoundPreceding == iFound) {
365 <<
"Subprocess index not found. This should never happen\n" 366 <<
"Please report this to a Framework Developer\n";
371 unsigned subProcessIndex,
372 unsigned precedingProcessIndex)
const {
375 std::vector<unsigned>
const& subProcessIndexes =
it->second.subProcessIndexes();
377 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
378 if (iFound == subProcessIndexes.end()) {
382 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
383 if (iFoundPreceding == iFound) {
390 <<
"Subprocess index not found. This should never happen\n" 391 <<
"Please report this to a Framework Developer\n";
398 std::vector<unsigned>
const& subProcessIndexes =
it->second.subProcessIndexes();
400 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
401 if (iFound == subProcessIndexes.end()) {
404 return *
it->second.pset();
407 <<
"Subprocess index not found. This should never happen\n" 408 <<
"Please report this to a Framework Developer\n";
415 if (esProvider != esProviderEnd)
417 for (; esProvider != esProviderEnd; ++esProvider) {
425 std::set<ParameterSetIDHolder> sharingCheckDone;
432 std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>> referencedESProducers;
438 for (
auto precedingESProvider =
providers_.begin(); precedingESProvider != esProvider; ++precedingESProvider) {
440 ->checkESProducerSharing(
441 typeResolverMaker_, **precedingESProvider, sharingCheckDone, referencedESProducers, *
this);
444 (*esProvider)->resetRecordToResolverPointers();
447 eventSetupProvider->clearInitializationData();
452 std::set<EventSetupRecordKey>
keys;
454 provider->fillKeys(
keys);
471 oneapi::tbb::task_group& iGroup,
477 std::vector<std::shared_ptr<const EventSetupImpl>> dummyEventSetupImpls;
480 WaitingTaskHolder waitingTaskHolder(iGroup, &waitUntilIOVInitializationCompletes);
485 syncValue, waitingTaskHolder, dummyWaitingTaskList, dummyEventSetupImpls);
486 dummyWaitingTaskList.
doneWaiting(std::exception_ptr{});
488 dummyWaitingTaskList.
doneWaiting(std::exception_ptr{});
489 waitingTaskHolder.
doneWaiting(std::current_exception());
492 waitUntilIOVInitializationCompletes.wait();
std::shared_ptr< EventSetupRecordIntervalFinder > getESSourceAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
std::shared_ptr< ESProductResolverProvider > getESProducerAndRegisterProcess(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_
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 fillEventSetupProvider(ModuleTypeResolverMaker const *resolverMaker, EventSetupsController &esController, EventSetupProvider &cp, ParameterSet ¶ms)
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 doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
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 putESProducer(ParameterSet &pset, std::shared_ptr< ESProductResolverProvider > const &component, unsigned subProcessIndex)
void initializeEventSetupRecordIOVQueues()
key
prepare the HTCondor submission files and eventually submit them
void eventSetupForInstanceAsync(IOVSyncValue const &, WaitingTaskHolder const &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &)
ServiceToken lock() const
void doneWaiting(std::exception_ptr iExcept) noexcept
void readConfigurationParameters(ParameterSet const *eventSetupPset, unsigned int maxConcurrentIOVs, bool dumpOptions)
void finishConfiguration()
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_
ModuleTypeResolverMaker const * typeResolverMaker_