30 exception <<
"ProductResolverBase::resolveProduct_: The product matching all criteria was already deleted\n" 32 <<
"Looking for module label: " <<
moduleLabel() <<
"\n" 35 <<
"This means there is a configuration error.\n" 36 <<
"The module which is asking for this data must be configured to state that it will read this data.";
42 template <
bool callResolver,
typename FUNC>
49 auto presentStatus =
status();
54 auto failedStatusSetter = [
this](
ProductStatus* presentStatus) {
58 *presentStatus = this->
status();
60 std::unique_ptr<ProductStatus, decltype(failedStatusSetter)> failedStatusGuard(&presentStatus, failedStatusSetter);
69 if(pd->wrapper()->isPresent()) {
80 if(not iFrom) {
return;}
87 }
else if(
original->hasIsProductEqual()) {
88 if(!
original->isProductEqual(iFrom.get())) {
91 <<
"ProductResolver::mergeTheProduct\n" 92 <<
"Two run/lumi products for the same run/lumi which should be equal are not\n" 93 <<
"Using the first, ignoring the second\n" 94 <<
"className = " << bd.className() <<
"\n" 95 <<
"moduleLabel = " << bd.moduleLabel() <<
"\n" 96 <<
"instance = " << bd.productInstanceName() <<
"\n" 97 <<
"process = " << bd.processName() <<
"\n";
102 <<
"ProductResolver::mergeTheProduct\n" 103 <<
"Run/lumi product has neither a mergeProduct nor isProductEqual function\n" 104 <<
"Using the first, ignoring the second in merge\n" 105 <<
"className = " << bd.className() <<
"\n" 106 <<
"moduleLabel = " << bd.moduleLabel() <<
"\n" 107 <<
"instance = " << bd.productInstanceName() <<
"\n" 108 <<
"process = " << bd.processName() <<
"\n";
118 return resolveProductImpl<true>([
this,&
principal,mcc]() {
132 aux_->postModuleDelayedGetSignal_.emit(*(iContext->
getStreamContext()), *iContext); }
135 if(
auto reader=principal.reader()) {
136 std::unique_lock<std::recursive_mutex> guard;
137 if(
auto sr =
reader->sharedResources().second) {
138 guard =std::unique_lock<std::recursive_mutex>(*sr);
153 std::unique_lock<std::recursive_mutex> guard;
154 if(
auto sr =
reader->sharedResources().second) {
155 guard =std::unique_lock<std::recursive_mutex>(*sr);
161 std::unique_ptr<WrapperBase> edp(
reader->getProduct(bk, &principal));
163 if(edp.get() !=
nullptr) {
174 bool skipCurrentProcess,
177 m_waitingTasks.add(waitTask);
179 bool expected =
false;
180 if( m_prefetchRequested.compare_exchange_strong(expected,
true) ) {
184 auto workToDo = [
this, mcc, &
principal, token] () {
187 resolveProductImpl<true>([
this,&
principal,mcc]() {
188 if(principal.branchType() !=
InEvent) {
return; }
189 if(
auto reader = principal.reader()) {
190 std::unique_lock<std::recursive_mutex> guard;
191 if(
auto sr =
reader->sharedResources().second) {
192 guard =std::unique_lock<std::recursive_mutex>(*sr);
201 this->m_waitingTasks.doneWaiting(std::current_exception());
204 this->m_waitingTasks.doneWaiting(
nullptr);
208 if(
auto reader = principal.reader()) {
209 if (
auto shared_res =
reader->sharedResources().first) {
210 queue = &(shared_res->serialQueueChain());
214 queue->
push(workToDo);
219 tbb::task::spawn(*
t);
226 m_prefetchRequested =
false;
227 m_waitingTasks.reset();
245 bool skipCurrentProcess,
248 if (!skipCurrentProcess) {
250 return resolveProductImpl<false>([](){
return;});
257 bool skipCurrentProcess,
260 if(not skipCurrentProcess) {
265 m_waitingTasks.add(waitTask);
267 bool expected =
false;
268 if(worker_ and prefetchRequested_.compare_exchange_strong(expected,
true)) {
275 [
this](std::exception_ptr
const * iException) {
276 if(
nullptr != iException) {
277 m_waitingTasks.doneWaiting(*iException);
279 m_waitingTasks.doneWaiting(std::exception_ptr());
282 worker_->callWhenDoneAsync(waiting);
290 bool expected =
false;
291 if(prefetchRequested_.compare_exchange_strong(expected,
true)) {
292 m_waitingTasks.doneWaiting(std::exception_ptr());
299 m_waitingTasks.reset();
301 prefetchRequested_ =
false;
314 assert(worker_ !=
nullptr);
320 bool skipCurrentProcess,
323 if (!skipCurrentProcess and worker_) {
324 return resolveProductImpl<true>(
331 auto workCall = [
this,&
event,&parentContext,mcc] () {
336 *(aux_->eventSetup()),
350 std::ostringstream ost;
351 ost <<
"Calling produce method for unscheduled module " 352 << worker_->description().moduleName() <<
"/'" 353 << worker_->description().moduleLabel() <<
"'";
365 bool skipCurrentProcess,
369 if(skipCurrentProcess) {
return; }
370 waitingTasks_.add(waitTask);
371 bool expected =
false;
372 if(prefetchRequested_.compare_exchange_strong(expected,
true)) {
377 [
this](std::exception_ptr
const* iPtr)
382 resolveProductImpl<true>([iPtr]() {
384 std::rethrow_exception(*iPtr);
388 waitingTasks_.doneWaiting(std::current_exception());
391 waitingTasks_.doneWaiting(
nullptr);
398 *(aux_->eventSetup()),
407 prefetchRequested_ =
false;
408 waitingTasks_.reset();
451 if(not prod) {
return;}
471 <<
"It is actually of type " << typeID.className() <<
".\n";
491 auto presentStatus =
status();
553 realProduct_.setProvenance(provRetriever,ph,pid);
557 realProduct_.setProcessHistory(ph);
565 realProduct_.resetProductData_(deleteEarly);
574 <<
"AliasProductResolver::putProduct_() not implemented and should never be called.\n" 575 <<
"Contact a Framework developer\n";
580 <<
"AliasProductResolver::putOrMergeProduct_(std::unique_ptr<WrapperBase> edp) not implemented and should never be called.\n" 581 <<
"Contact a Framework developer\n";
587 provRetriever_ = provRetriever;
594 return provRetriever_? provRetriever_->branchIDToProvenance(bd_->originalBranchID()):
nullptr;
606 <<
"ParentProcessProductResolver::putProduct_() not implemented and should never be called.\n" 607 <<
"Contact a Framework developer\n";
612 <<
"ParentProcessProductResolver::putOrMergeProduct_(std::unique_ptr<WrapperBase> edp) not implemented and should never be called.\n" 613 <<
"Contact a Framework developer\n";
633 <<
"ParentProcessProductResolver::throwNullRealProduct RealProduct pointer not set in this context.\n" 634 <<
"Contact a Framework developer\n";
639 std::vector<bool>
const& ambiguous) :
640 matchingHolders_(matchingHolders),
641 ambiguous_(ambiguous),
643 lastSkipCurrentCheckIndex_(lastCheckIndex_.
load()),
644 prefetchRequested_(
false),
645 skippingPrefetchRequested_(
false),
646 recheckedAtEnd_(
false) {
653 bool skipCurrentProcess,
657 return productResolver->
resolveProduct(principal, skipCurrentProcess, sra, mcc);
663 bool skipCurrentProcess,
668 const unsigned int choiceSize =
ambiguous_.size();
679 return tryResolver(checkCacheIndex, principal, skipCurrentProcess,
688 auto setTrue = [](std::atomic<bool>* iBool) { *iBool =
true; };
689 using TrueGuard = std::unique_ptr<std::atomic<bool>, decltype(setTrue)>;
693 for(
unsigned int k : lookupProcessOrder) {
703 updateCacheIndex =
k;
716 bool skipCurrentProcess,
719 if(not skipCurrentProcess) {
724 bool needToRecheckAtEnd =
false;
726 bool expected =
false;
727 needToRecheckAtEnd =
recheckedAtEnd_.compare_exchange_strong(expected,
true);
728 if(needToRecheckAtEnd) {
733 bool expected =
false;
740 bool expected =
false;
750 std::exception_ptr iExceptPtr)
const {
751 if( not iSkipCurrentProcess) {
765 unsigned int iResolverIndex,
769 bool iSkipCurrentProcess,
771 resolver_(iResolver),
772 principal_(iPrincipal),
775 serviceToken_(iToken),
776 index_(iResolverIndex),
777 skipCurrentProcess_(iSkipCurrentProcess){}
779 tbb::task*
execute()
override {
780 auto exceptPtr =exceptionPtr();
782 resolver_->prefetchFailed(index_, *principal_, skipCurrentProcess_, *exceptPtr);
784 if(not resolver_->dataValidFromResolver(index_, *principal_, skipCurrentProcess_)) {
785 resolver_->tryPrefetchResolverAsync(index_+1,
803 bool skipCurrentProcess_;
810 bool iSkipCurrentProcess,
811 std::exception_ptr iExceptPtr)
const {
813 auto k = lookupProcessOrder[iProcessingIndex];
815 setCache(iSkipCurrentProcess,
k, iExceptPtr);
822 bool iSkipCurrentProcess)
const {
824 auto k = lookupProcessOrder[iProcessingIndex];
829 setCache(iSkipCurrentProcess, k,
nullptr);
839 bool skipCurrentProcess,
844 auto index = iProcessingIndex;
846 const unsigned int choiceSize =
ambiguous_.size();
848 while(
index < lookupProcessOrder.size()) {
849 auto k = lookupProcessOrder[
index];
861 auto task =
new (tbb::task::allocate_root()) TryNextResolverWaitingTask(
870 task->increment_ref_count();
880 if(0 == task->decrement_ref_count()) {
881 tbb::task::spawn(*task);
888 setCache(skipCurrentProcess, newCacheIndex,
nullptr);
920 <<
"NoProcessProductResolver::unscheduledWasNotRun_() not implemented and should never be called.\n" 921 <<
"Contact a Framework developer\n";
926 <<
"NoProcessProductResolver::productUnavailable_() not implemented and should never be called.\n" 927 <<
"Contact a Framework developer\n";
932 <<
"NoProcessProductResolver::productResolved_() not implemented and should never be called.\n" 933 <<
"Contact a Framework developer\n";
938 <<
"NoProcessProductResolver::productWasDeleted_() not implemented and should never be called.\n" 939 <<
"Contact a Framework developer\n";
944 <<
"NoProcessProductResolver::productWasFetchedAndIsValid_() not implemented and should never be called.\n" 945 <<
"Contact a Framework developer\n";
950 <<
"NoProcessProductResolver::putProduct_() not implemented and should never be called.\n" 951 <<
"Contact a Framework developer\n";
956 <<
"NoProcessProductResolver::putOrMergeProduct_(std::unique_ptr<WrapperBase> edp) not implemented and should never be called.\n" 957 <<
"Contact a Framework developer\n";
962 <<
"NoProcessProductResolver::branchDescription_() not implemented and should never be called.\n" 963 <<
"Contact a Framework developer\n";
968 <<
"NoProcessProductResolver::resetBranchDescription_() not implemented and should never be called.\n" 969 <<
"Contact a Framework developer\n";
974 <<
"NoProcessProductResolver::provenance_() not implemented and should never be called.\n" 975 <<
"Contact a Framework developer\n";
980 <<
"NoProcessProductResolver::connectTo() not implemented and should never be called.\n" 981 <<
"Contact a Framework developer\n";
988 bool skipCurrentProcess,
995 ->resolveProduct(principal,
996 skipCurrentProcess, sra, mcc);
1001 bool skipCurrentProcess,
1005 ->prefetchAsync(waitTask,principal,
1006 skipCurrentProcess, sra, mcc);
1028 <<
"SingleChoiceNoProcessProductResolver::unscheduledWasNotRun_() not implemented and should never be called.\n" 1029 <<
"Contact a Framework developer\n";
1034 <<
"SingleChoiceNoProcessProductResolver::productUnavailable_() not implemented and should never be called.\n" 1035 <<
"Contact a Framework developer\n";
1040 <<
"SingleChoiceNoProcessProductResolver::productResolved_() not implemented and should never be called.\n" 1041 <<
"Contact a Framework developer\n";
1046 <<
"SingleChoiceNoProcessProductResolver::productWasDeleted_() not implemented and should never be called.\n" 1047 <<
"Contact a Framework developer\n";
1052 <<
"SingleChoiceNoProcessProductResolver::productWasFetchedAndIsValid_() not implemented and should never be called.\n" 1053 <<
"Contact a Framework developer\n";
1059 <<
"SingleChoiceNoProcessProductResolver::putProduct_() not implemented and should never be called.\n" 1060 <<
"Contact a Framework developer\n";
1065 <<
"SingleChoiceNoProcessProductResolver::putOrMergeProduct_(std::unique_ptr<WrapperBase> edp) not implemented and should never be called.\n" 1066 <<
"Contact a Framework developer\n";
1071 <<
"SingleChoiceNoProcessProductResolver::branchDescription_() not implemented and should never be called.\n" 1072 <<
"Contact a Framework developer\n";
1077 <<
"SingleChoiceNoProcessProductResolver::resetBranchDescription_() not implemented and should never be called.\n" 1078 <<
"Contact a Framework developer\n";
1083 <<
"SingleChoiceNoProcessProductResolver::provenance_() not implemented and should never be called.\n" 1084 <<
"Contact a Framework developer\n";
1089 <<
"SingleChoiceNoProcessProductResolver::connectTo() not implemented and should never be called.\n" 1090 <<
"Contact a Framework developer\n";
void connectTo(ProductResolverBase const &iOther, Principal const *) final
Resolution resolveProduct_(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
std::string const & branchName() const
std::string const & productInstanceName() const
std::unique_ptr< T, F > make_sentry(T *iObject, F iFunc)
NOTE: if iObject is null, then iFunc will not be called.
void resetProductData_(bool deleteEarly) override
Provenance const * provenance() const
void setProcessHistory(ProcessHistory const &ph)
unsigned int ProductResolverIndex
StreamContext const * getStreamContext() const
void prefetchAsync(WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
void checkType(WrapperBase const &prod) const
std::type_info const & dynamicTypeInfo() const
unsigned int unsetIndexValue() const
void prefetchAsync_(WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
void resetProductData_(bool deleteEarly) override
FunctorTask< F > * make_functor_task(ALLOC &&iAlloc, F f)
void setCache(bool skipCurrentProcess, ProductResolverIndex index, std::exception_ptr exceptionPtr) const
void add(WaitingTask *)
Adds task to the waiting list.
void setProcessHistory_(ProcessHistory const &ph) override
ProductStatus status() const
bool singleProduct_() const override
bool unscheduledWasNotRun_() const override
void putProduct_(std::unique_ptr< WrapperBase > edp) const override
void throwNullRealProduct() const
Resolution tryResolver(unsigned int index, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
WrapperBase const * wrapper() const
WaitingTaskList skippingWaitingTasks_
bool singleProduct_() const override
void resetProductData_(bool deleteEarly) override
ProductProvenance const * productProvenance() const
void push(T &&iAction)
asynchronously pushes functor iAction into queue
Resolution resolveProduct(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
void setProvenance_(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) override
void reset()
Resets access to the resource so that added tasks will wait.
void connectTo(ProductResolverBase const &iOther, Principal const *) final
BranchDescription const & branchDescription_() const override
bool productResolved_() const final
static unsigned int kUnsetOffset
ServiceToken presentToken() const
void resetProductData_(bool deleteEarly) override
std::string const & processName() const
void connectTo(ProductResolverBase const &, Principal const *) final
void putProduct_(std::unique_ptr< WrapperBase > edp) const override
void putOrMergeProduct_(std::unique_ptr< WrapperBase > prod) const final
void throwProductDeletedException() const
void prefetchAsync_(WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
bool productUnavailable_() const final
void prefetchAsync_(WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
ProductProvenance const * productProvenancePtr_() const override
static unsigned int kMissingOffset
bool productResolved_() const final
void putProduct(std::unique_ptr< WrapperBase > edp) const
WaitingTaskList waitingTasks_
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
void prefetchFailed(unsigned int iProcessingIndex, Principal const &principal, bool iSkipCurrentProcess, std::exception_ptr iExceptPtr) const
void resetFailedFromThisProcess() override
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
void setProvenance(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
std::string const & className() const
std::atomic< unsigned int > lastSkipCurrentCheckIndex_
bool singleProduct_() const override
bool productWasDeleted() const
Provenance const * provenance_() const override
std::vector< unsigned int > const & lookupProcessOrder() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void putOrMergeProduct_(std::unique_ptr< WrapperBase > prod) const final
Provenance const * provenance_() const override
bool dataValidFromResolver(unsigned int iProcessingIndex, Principal const &principal, bool iSkipCurrentProcess) const
void setProvenance_(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) override
TypeID unwrappedTypeID() const
void resetProductData_(bool deleteEarly) override
static ServiceRegistry & instance()
void setProcessHistory_(ProcessHistory const &ph) override
ProductProvenance const * productProvenancePtr_() const override
bool isFromCurrentProcess() const final
bool productUnavailable_() const override
void resetBranchDescription_(std::shared_ptr< BranchDescription const > bd) override
void mergeProduct(std::unique_ptr< WrapperBase > edp) const
ProductProvenance const * productProvenancePtr_() const override
void putOrMergeProduct_(std::unique_ptr< WrapperBase > prod) const final
std::atomic< bool > prefetchRequested_
ProductProvenance const * productProvenancePtr_() const override
bool productResolved_() const final
std::atomic< unsigned int > lastCheckIndex_
TypeWithDict const & unwrappedType() const
void setProvenance_(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) final
void prefetchAsync_(WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::type_info const & unvalidatedTypeInfo() const
bool productWasDeleted_() const override
void putProduct_(std::unique_ptr< WrapperBase > edp) const override
virtual bool isFromCurrentProcess() const =0
Resolution resolveProduct_(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
void setProduct(std::unique_ptr< WrapperBase > edp) const
std::atomic< bool > skippingPrefetchRequested_
std::atomic< ProductStatus > theStatus_
std::vector< bool > ambiguous_
Resolution resolveProductImpl(FUNC resolver) const
DelayedReader * reader() const
UnscheduledAuxiliary const * auxiliary() const
void resetProductData_(bool deleteEarly) override
static unsigned int kAmbiguousOffset
void setupUnscheduled(UnscheduledConfigurator const &) final
ProductStatus defaultStatus() const
bool productWasFetchedAndIsValid(bool iSkipCurrentProcess) const
bool productWasFetchedAndIsValid_(bool iSkipCurrentProcess) const final
void setProcessHistory_(ProcessHistory const &ph) override
BranchDescription const & branchDescription_() const override
bool productWasDeleted_() const final
FunctorWaitingTask< F > * make_waiting_task(ALLOC &&iAlloc, F f)
bool productUnavailable_() const override
void addContext(std::string const &context)
bool singleProduct_() const override
std::vector< ProductResolverIndex > matchingHolders_
void resetBranchDescription_(std::shared_ptr< BranchDescription const > bd) override
void tryPrefetchResolverAsync(unsigned int iProcessingIndex, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc, ServiceToken token) const
BranchDescription const & branchDescription() const
Worker * findWorker(std::string const &iLabel) const
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
ProductProvenance const * productProvenancePtr_() const final
void putProduct_(std::unique_ptr< WrapperBase > edp) const override
void putOrMergeProduct_(std::unique_ptr< WrapperBase > prod) const final
void setProvenance_(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) override
void setProcessHistory_(ProcessHistory const &ph) override
void putProduct_(std::unique_ptr< WrapperBase > edp) const override
void setupUnscheduled(UnscheduledConfigurator const &) final
bool productResolved() const
ProductData const & getProductData() const
bool productWasDeleted_() const override
Resolution resolveProduct_(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
void putOrMergeProduct_(std::unique_ptr< WrapperBase > prod) const final
bool productWasFetchedAndIsValid_(bool iSkipCurrentProcess) const override
void resetProductData_(bool deleteEarly) override
NoProcessProductResolver(std::vector< ProductResolverIndex > const &matchingHolders, std::vector< bool > const &ambiguous)
bool unscheduledWasNotRun_() const override
bool singleProduct_() const final
Resolution resolveProduct_(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override
void putOrMergeProduct(std::unique_ptr< WrapperBase > edp) const
void setProvenance_(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) override
static Resolution makeAmbiguous()
void setProcessHistory_(ProcessHistory const &ph) final
std::atomic< bool > recheckedAtEnd_
bool productWasFetchedAndIsValid_(bool iSkipCurrentProcess) const override
def branchType(schema, name)
std::string const & moduleLabel() const
WrapperBase * unsafe_wrapper() const
static HepMC::HEPEVT_Wrapper wrapper
void putProduct_(std::unique_ptr< WrapperBase > edp) const override
void setFailedStatus() const
bool atEndTransition() const