45 #include "tbb/task_scheduler_init.h" 47 #define xstr(s) str(s) 62 bool oneTimeInitializationImpl() {
65 static std::unique_ptr<tbb::task_scheduler_init> tsiPtr = std::make_unique<tbb::task_scheduler_init>(1);
75 bool oneTimeInitialization() {
76 static const bool s_init{oneTimeInitializationImpl()};
85 : espController_(
std::make_unique<eventsetup::EventSetupsController>()),
89 (void)oneTimeInitialization();
99 auto procDesc = desc.processDesc();
104 auto& serviceSets = procDesc->getServicesPSets();
120 esp_->add(std::dynamic_pointer_cast<eventsetup::DataProxyProvider>(
esHelper_));
121 esp_->add(std::dynamic_pointer_cast<EventSetupRecordIntervalFinder>(
esHelper_));
126 auto nConcurrentLumis = 1
U;
127 auto nConcurrentRuns = 1
U;
135 auto psetid = emptyPSet.
id();
151 produce.moduleLabel_,
154 twd.friendlyClassName(),
155 produce.instanceLabel_,
162 dataProducts_.emplace_back(product, std::unique_ptr<WrapperBase>());
163 preg_->addProduct(product);
180 auto ep = std::make_shared<EventPrincipal>(
preg_,
203 throw cms::Exception(
"LogicError") <<
"Products must be declared to the TestProcessor::Config object\n" 204 "with a call to the function \'produces\' BEFORE passing the\n" 205 "TestProcessor::Config object to the TestProcessor constructor";
257 actReg_->preallocateSignal_(bounds);
270 actReg_->postBeginJobSignal_();
289 auto const& es =
esp_->eventSetupImpl();
291 std::vector<edm::SubProcess> emptyList;
295 globalWaitTask->increment_ref_count();
304 globalWaitTask->wait_for_all();
305 if (globalWaitTask->exceptionPtr() !=
nullptr) {
306 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
312 streamLoopWaitTask->increment_ref_count();
316 beginStreamsTransitionAsync<Traits>(streamLoopWaitTask.get(),
326 streamLoopWaitTask->wait_for_all();
327 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
328 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
345 auto const& es =
esp_->eventSetupImpl();
347 std::vector<edm::SubProcess> emptyList;
351 globalWaitTask->increment_ref_count();
360 globalWaitTask->wait_for_all();
361 if (globalWaitTask->exceptionPtr() !=
nullptr) {
362 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
368 streamLoopWaitTask->increment_ref_count();
372 beginStreamsTransitionAsync<Traits>(streamLoopWaitTask.get(),
382 streamLoopWaitTask->wait_for_all();
383 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
384 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
394 pep->clearEventPrincipal();
395 pep->fillEventPrincipal(
408 auto r = pep->getProductResolver(
p.first.branchID());
409 r->putProduct(std::unique_ptr<WrapperBase>());
416 waitTask->increment_ref_count();
421 waitTask->wait_for_all();
422 if (waitTask->exceptionPtr() !=
nullptr) {
423 std::rethrow_exception(*(waitTask->exceptionPtr()));
437 auto const& es =
esp_->eventSetupImpl();
439 std::vector<edm::SubProcess> emptyList;
444 streamLoopWaitTask->increment_ref_count();
459 streamLoopWaitTask->wait_for_all();
460 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
461 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
466 globalWaitTask->increment_ref_count();
478 globalWaitTask->wait_for_all();
479 if (globalWaitTask->exceptionPtr() !=
nullptr) {
480 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
498 auto const& es =
esp_->eventSetupImpl();
500 std::vector<edm::SubProcess> emptyList;
505 streamLoopWaitTask->increment_ref_count();
520 streamLoopWaitTask->wait_for_all();
521 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
522 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
527 globalWaitTask->increment_ref_count();
539 globalWaitTask->wait_for_all();
540 if (globalWaitTask->exceptionPtr() !=
nullptr) {
541 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
552 "Multiple exceptions were thrown while executing endJob. An exception message follows for each.\n");
562 c.
call([actReg]() { actReg->preEndJobSignal_(); });
564 c.
call([actReg]() { actReg->postEndJobSignal_(); });
std::shared_ptr< ActivityRegistry > actReg_
void insert(std::shared_ptr< RunPrincipal > rp)
void put(std::pair< edm::EDPutTokenT< T >, std::unique_ptr< T >> &&iPut)
std::shared_ptr< ActivityRegistry > actReg_
std::unique_ptr< edm::ParameterSet > parameterSet() const
static PluginManager & configure(const Config &)
void setNumberOfConcurrentPrincipals(PreallocationConfiguration const &)
std::unique_ptr< ExceptionToActionTable const > act_table_
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
std::vector< std::pair< edm::BranchDescription, std::unique_ptr< WrapperBase > > > dataProducts_
ParameterSetID id() const
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
unsigned int numberOfRuns() const
bool registerProcessHistory(ProcessHistory const &processHistory)
LuminosityBlockNumber_t lumiNumber_
unsigned long long EventNumber_t
unsigned int numberOfThreads() const
EventNumber_t eventNumber_
ProcessContext processContext_
unsigned int LuminosityBlockNumber_t
void beginLuminosityBlock()
void endLuminosityBlock()
void emplace_back(Args &&...args)
PreallocationConfiguration preallocations_
void validateTopLevelParameterSets(ParameterSet *processParameterSet)
void setEventNumber(edm::EventNumber_t)
std::shared_ptr< BranchIDListHelper > branchIDListHelper_
PluginManager::Config config()
std::shared_ptr< EventSetupTestHelper > esHelper_
std::shared_ptr< CommonParams > initMisc(ParameterSet ¶meterSet)
std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Timestamp const & beginTime() const
std::unique_ptr< edm::EmptyWaitingTask, waitingtask::TaskDestroyer > make_empty_waiting_task()
Create an EmptyWaitingTask which will properly be destroyed.
std::string labelOfTestModule_
std::unique_ptr< eventsetup::EventSetupsController > espController_
edm::test::Event testImpl()
std::shared_ptr< eventsetup::EventSetupProvider > esp_
std::vector< ProduceEntry > const & produceEntries() const
Timestamp const & endTime() const
std::vector< ESProduceEntry > const & esProduceEntries() const
void teardownProcessing()
std::unique_ptr< Schedule > schedule_
std::shared_ptr< ProcessConfiguration const > processConfiguration_
ServiceToken serviceToken_
unsigned int numberOfLuminosityBlocks() const
TestProcessor(Config const &iConfig)
void setProcessConfiguration(ProcessConfiguration const *processConfiguration)
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
void setProcessHistoryRegistry(ProcessHistoryRegistry const &phr)
std::shared_ptr< ProcessConfiguration const > processConfiguration() const
void setLuminosityBlockNumber(edm::LuminosityBlockNumber_t)
PrincipalCache principalCache_
ServiceToken initServices(std::vector< ParameterSet > &servicePSets, ParameterSet &processPSet, ServiceToken const &iToken, serviceregistry::ServiceLegacy iLegacy, bool associate)
std::shared_ptr< ProductRegistry > preg_
void deleteRun(ProcessHistoryID const &phid, RunNumber_t run)
std::unique_ptr< ExceptionToActionTable const > act_table_
ServiceToken addCPRandTNS(ParameterSet const ¶meterSet, ServiceToken const &token)
static EventNumber_t maxEventNumber()
std::shared_ptr< RunPrincipal > const & runPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run) const
void setRunNumber(edm::RunNumber_t)
std::unique_ptr< HistoryAppender > historyAppender_
unsigned int numberOfStreams() const
std::shared_ptr< SignallingProductRegistry const > preg() const
std::shared_ptr< LuminosityBlockPrincipal > getAvailableLumiPrincipalPtr()
void call(std::function< void(void)>)
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
static ParentageRegistry * instance()
ProcessHistoryRegistry processHistoryRegistry_
std::unique_ptr< Schedule > initSchedule(ParameterSet ¶meterSet, bool hasSubprocesses, PreallocationConfiguration const &iAllocConfig, ProcessContext const *)
ParameterSet const & registerIt()
std::string const & pythonConfiguration() const
bool insertMapped(value_type const &v)
std::vector< std::string > const & extraProcesses() const
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const