CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
edm::SwitchAliasProductResolver Class Reference

#include <ProductResolvers.h>

Inheritance diagram for edm::SwitchAliasProductResolver:
edm::SwitchBaseProductResolver edm::DataManagingOrAliasProductResolver edm::ProductResolverBase

Public Member Functions

 SwitchAliasProductResolver (std::shared_ptr< BranchDescription const > bd, DataManagingOrAliasProductResolver &realProduct)
 
- Public Member Functions inherited from edm::SwitchBaseProductResolver
void connectTo (ProductResolverBase const &iOther, Principal const *iParentPrincipal) final
 
void setupUnscheduled (UnscheduledConfigurator const &iConfigure) final
 
 SwitchBaseProductResolver (std::shared_ptr< BranchDescription const > bd, DataManagingOrAliasProductResolver &realProduct)
 
- Public Member Functions inherited from edm::DataManagingOrAliasProductResolver
 DataManagingOrAliasProductResolver ()
 
- Public Member Functions inherited from edm::ProductResolverBase
BranchDescription const & branchDescription () const
 
std::string const & moduleLabel () const
 
ProductResolverBaseoperator= (ProductResolverBase const &)=delete
 
void prefetchAsync (WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
std::string const & processName () const
 
ProductID const & productID () const
 
std::string const & productInstanceName () const
 
ProductProvenance const * productProvenancePtr () const
 
bool productResolved () const
 
 ProductResolverBase ()
 
 ProductResolverBase (ProductResolverBase const &)=delete
 
TypeID productType () const
 
bool productUnavailable () const
 
bool productWasDeleted () const
 
bool productWasFetchedAndIsValid (bool iSkipCurrentProcess) const
 
Provenance const * provenance () const
 
bool provenanceAvailable () const
 
void putOrMergeProduct (std::unique_ptr< WrapperBase > edp, MergeableRunProductMetadata const *mergeableRunProductMetadata=nullptr) const
 
void putProduct (std::unique_ptr< WrapperBase > edp) const
 
void resetBranchDescription (std::shared_ptr< BranchDescription const > bd)
 
void resetProductData ()
 
std::string const & resolvedModuleLabel () const
 
Resolution resolveProduct (Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void retrieveAndMerge (Principal const &principal, MergeableRunProductMetadata const *mergeableRunProductMetadata) const
 
void setMergeableRunProductMetadata (MergeableRunProductMetadata const *mrpm)
 
void setProductID (ProductID const &pid)
 
void setProductProvenanceRetriever (ProductProvenanceRetriever const *provRetriever)
 
bool singleProduct () const
 
StableProvenance const * stableProvenance () const
 
void unsafe_deleteProduct () const
 
bool unscheduledWasNotRun () const
 
void write (std::ostream &os) const
 
virtual ~ProductResolverBase ()
 

Private Member Functions

void prefetchAsync_ (WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const final
 
bool productUnavailable_ () const final
 
void putProduct_ (std::unique_ptr< WrapperBase > edp) const final
 
Resolution resolveProduct_ (Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const final
 
bool unscheduledWasNotRun_ () const final
 

Additional Inherited Members

- Public Types inherited from edm::SwitchBaseProductResolver
using ProductStatus = DataManagingProductResolver::ProductStatus
 
- Protected Member Functions inherited from edm::SwitchBaseProductResolver
std::atomic< bool > & prefetchRequested () const
 
DataManagingOrAliasProductResolver const & realProduct () const
 
void resetProductData_ (bool deleteEarly) override
 
Resolution resolveProductImpl (Resolution) const
 
void unsafe_setWrapperAndProvenance () const
 
WaitingTaskListwaitingTasks () const
 
Workerworker () const
 

Detailed Description

Definition at line 347 of file ProductResolvers.h.

Constructor & Destructor Documentation

◆ SwitchAliasProductResolver()

edm::SwitchAliasProductResolver::SwitchAliasProductResolver ( std::shared_ptr< BranchDescription const >  bd,
DataManagingOrAliasProductResolver realProduct 
)
inline

Definition at line 349 of file ProductResolvers.h.

Member Function Documentation

◆ prefetchAsync_()

void edm::SwitchAliasProductResolver::prefetchAsync_ ( WaitingTask waitTask,
Principal const &  principal,
bool  skipCurrentProcess,
ServiceToken const &  token,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 768 of file ProductResolvers.cc.

773  {
774  if (skipCurrentProcess) {
775  return;
776  }
777 
778  //need to try changing prefetchRequested_ before adding to waitingTasks_
779  bool expected = false;
780  bool doPrefetchRequested = prefetchRequested().compare_exchange_strong(expected, true);
781  waitingTasks().add(waitTask);
782 
783  if (doPrefetchRequested) {
784  //using a waiting task to do a callback guarantees that
785  // the waitingTasks() list will be released from waiting even
786  // if the module does not put this data product or the
787  // module has an exception while running
788  auto waiting = make_waiting_task(tbb::task::allocate_root(), [this](std::exception_ptr const* iException) {
789  if (nullptr != iException) {
790  waitingTasks().doneWaiting(*iException);
791  } else {
793  waitingTasks().doneWaiting(std::exception_ptr());
794  }
795  });
796  realProduct().prefetchAsync(waiting, principal, skipCurrentProcess, token, sra, mcc);
797  }
798  }

References edm::WaitingTaskList::add(), edm::WaitingTaskList::doneWaiting(), edm::make_waiting_task(), edm::ProductResolverBase::prefetchAsync(), edm::SwitchBaseProductResolver::prefetchRequested(), edm::SwitchBaseProductResolver::realProduct(), unpackBuffers-CaloStage2::token, edm::SwitchBaseProductResolver::unsafe_setWrapperAndProvenance(), and edm::SwitchBaseProductResolver::waitingTasks().

◆ productUnavailable_()

bool edm::SwitchAliasProductResolver::productUnavailable_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 366 of file ProductResolvers.h.

366 { return realProduct().productUnavailable(); }

References edm::ProductResolverBase::productUnavailable().

◆ putProduct_()

void edm::SwitchAliasProductResolver::putProduct_ ( std::unique_ptr< WrapperBase edp) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 800 of file ProductResolvers.cc.

800  {
802  << "SwitchAliasProductResolver::putProduct() not implemented and should never be called.\n"
803  << "Contact a Framework developer\n";
804  }

References Exception, and edm::errors::LogicError.

◆ resolveProduct_()

ProductResolverBase::Resolution edm::SwitchAliasProductResolver::resolveProduct_ ( Principal const &  principal,
bool  skipCurrentProcess,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
finalprivatevirtual

◆ unscheduledWasNotRun_()

bool edm::SwitchAliasProductResolver::unscheduledWasNotRun_ ( ) const
inlinefinalprivatevirtual
edm::errors::LogicError
Definition: EDMException.h:37
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
edm::WaitingTaskList::add
void add(WaitingTask *)
Adds task to the waiting list.
Definition: WaitingTaskList.cc:90
edm::SwitchBaseProductResolver::waitingTasks
WaitingTaskList & waitingTasks() const
Definition: ProductResolvers.h:275
edm::ProductResolverBase::productUnavailable
bool productUnavailable() const
Definition: ProductResolverBase.h:87
edm::ProductResolverBase::unscheduledWasNotRun
bool unscheduledWasNotRun() const
Definition: ProductResolverBase.h:97
edm::SwitchBaseProductResolver::resolveProductImpl
Resolution resolveProductImpl(Resolution) const
Definition: ProductResolvers.cc:634
edm::WaitingTaskList::doneWaiting
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
Definition: WaitingTaskList.cc:170
edm::SwitchBaseProductResolver::realProduct
DataManagingOrAliasProductResolver const & realProduct() const
Definition: ProductResolvers.h:277
edm::ProductResolverBase::resolveProduct
Resolution resolveProduct(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: ProductResolverBase.h:60
edm::make_waiting_task
FunctorWaitingTask< F > * make_waiting_task(ALLOC &&iAlloc, F f)
Definition: WaitingTask.h:87
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
edm::ProductResolverBase::prefetchAsync
void prefetchAsync(WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: ProductResolverBase.h:69
edm::SwitchBaseProductResolver::prefetchRequested
std::atomic< bool > & prefetchRequested() const
Definition: ProductResolvers.h:278
edm::SwitchBaseProductResolver::unsafe_setWrapperAndProvenance
void unsafe_setWrapperAndProvenance() const
Definition: ProductResolvers.cc:674
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318
edm::SwitchBaseProductResolver::SwitchBaseProductResolver
SwitchBaseProductResolver(std::shared_ptr< BranchDescription const > bd, DataManagingOrAliasProductResolver &realProduct)
Definition: ProductResolvers.cc:614