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();
119 esp_->add(std::dynamic_pointer_cast<eventsetup::DataProxyProvider>(
esHelper_));
120 esp_->add(std::dynamic_pointer_cast<EventSetupRecordIntervalFinder>(
esHelper_));
125 auto nConcurrentLumis = 1
U;
126 auto nConcurrentRuns = 1
U;
134 auto psetid = emptyPSet.
id();
150 produce.moduleLabel_,
153 twd.friendlyClassName(),
154 produce.instanceLabel_,
161 dataProducts_.emplace_back(product, std::unique_ptr<WrapperBase>());
162 preg_->addProduct(product);
179 auto ep = std::make_shared<EventPrincipal>(
preg_,
202 throw cms::Exception(
"LogicError") <<
"Products must be declared to the TestProcessor::Config object\n" 203 "with a call to the function \'produces\' BEFORE passing the\n" 204 "TestProcessor::Config object to the TestProcessor constructor";
335 actReg_->preallocateSignal_(bounds);
348 actReg_->postBeginJobSignal_();
367 auto const& es =
esp_->eventSetup();
369 std::vector<edm::SubProcess> emptyList;
373 globalWaitTask->increment_ref_count();
374 beginGlobalTransitionAsync<Traits>(
376 globalWaitTask->wait_for_all();
377 if (globalWaitTask->exceptionPtr() !=
nullptr) {
378 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
384 streamLoopWaitTask->increment_ref_count();
388 beginStreamsTransitionAsync<Traits>(streamLoopWaitTask.get(),
397 streamLoopWaitTask->wait_for_all();
398 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
399 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
417 auto const& es =
esp_->eventSetup();
419 std::vector<edm::SubProcess> emptyList;
423 globalWaitTask->increment_ref_count();
424 beginGlobalTransitionAsync<Traits>(
426 globalWaitTask->wait_for_all();
427 if (globalWaitTask->exceptionPtr() !=
nullptr) {
428 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
434 streamLoopWaitTask->increment_ref_count();
438 beginStreamsTransitionAsync<Traits>(streamLoopWaitTask.get(),
447 streamLoopWaitTask->wait_for_all();
448 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
449 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
459 pep->clearEventPrincipal();
460 pep->fillEventPrincipal(
473 auto r = pep->getProductResolver(
p.first.branchID());
474 r->putProduct(std::unique_ptr<WrapperBase>());
481 waitTask->increment_ref_count();
486 waitTask->wait_for_all();
487 if (waitTask->exceptionPtr() !=
nullptr) {
488 std::rethrow_exception(*(waitTask->exceptionPtr()));
502 auto const& es =
esp_->eventSetup();
504 std::vector<edm::SubProcess> emptyList;
509 streamLoopWaitTask->increment_ref_count();
523 streamLoopWaitTask->wait_for_all();
524 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
525 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
530 globalWaitTask->increment_ref_count();
541 globalWaitTask->wait_for_all();
542 if (globalWaitTask->exceptionPtr() !=
nullptr) {
543 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
547 return lumiPrincipal;
551 std::shared_ptr<RunPrincipal> rp;
563 auto const& es =
esp_->eventSetup();
565 std::vector<edm::SubProcess> emptyList;
570 streamLoopWaitTask->increment_ref_count();
584 streamLoopWaitTask->wait_for_all();
585 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
586 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
591 globalWaitTask->increment_ref_count();
602 globalWaitTask->wait_for_all();
603 if (globalWaitTask->exceptionPtr() !=
nullptr) {
604 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
616 "Multiple exceptions were thrown while executing endJob. An exception message follows for each.\n");
626 c.
call([actReg]() { actReg->preEndJobSignal_(); });
628 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< LuminosityBlockPrincipal > endLuminosityBlock()
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_
edm::test::LuminosityBlock testBeginLuminosityBlockImpl(edm::LuminosityBlockNumber_t iNum, std::pair< edm::test::ESPutTokenT< T >, std::unique_ptr< T >> &&iPut, U &&...iArgs)
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
edm::test::LuminosityBlock testEndLuminosityBlockImpl()
unsigned int numberOfThreads() const
EventNumber_t eventNumber_
ProcessContext processContext_
unsigned int LuminosityBlockNumber_t
void beginLuminosityBlock()
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
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_
edm::test::Run testBeginRunImpl(edm::RunNumber_t iNum, std::pair< edm::test::ESPutTokenT< T >, std::unique_ptr< T >> &&iPut, U &&...iArgs)
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
edm::test::Run testEndRunImpl()
void setRunNumber(edm::RunNumber_t)
std::unique_ptr< HistoryAppender > historyAppender_
unsigned int numberOfStreams() const
std::shared_ptr< SignallingProductRegistry const > preg() const
TestProcessor(Config const &iConfig, ServiceToken iToken=ServiceToken())
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::shared_ptr< RunPrincipal > endRun()
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
def operate(timelog, memlog, json_f, num)