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 (WaitingTaskHolder 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 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_ (WaitingTaskHolder waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const final
 
bool productUnavailable_ () 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 420 of file ProductResolvers.h.

Constructor & Destructor Documentation

◆ SwitchAliasProductResolver()

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

Definition at line 422 of file ProductResolvers.h.

SwitchBaseProductResolver(std::shared_ptr< BranchDescription const > bd, DataManagingOrAliasProductResolver &realProduct)
DataManagingOrAliasProductResolver const & realProduct() const
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ prefetchAsync_()

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

Implements edm::ProductResolverBase.

Definition at line 857 of file ProductResolvers.cc.

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

862  {
863  if (skipCurrentProcess) {
864  return;
865  }
866 
867  //need to try changing prefetchRequested_ before adding to waitingTasks_
868  bool expected = false;
869  bool doPrefetchRequested = prefetchRequested().compare_exchange_strong(expected, true);
870  waitingTasks().add(waitTask);
871 
872  if (doPrefetchRequested) {
873  //using a waiting task to do a callback guarantees that
874  // the waitingTasks() list will be released from waiting even
875  // if the module does not put this data product or the
876  // module has an exception while running
877  auto waiting = make_waiting_task([this](std::exception_ptr const* iException) {
878  if (nullptr != iException) {
879  waitingTasks().doneWaiting(*iException);
880  } else {
882  waitingTasks().doneWaiting(std::exception_ptr());
883  }
884  });
886  WaitingTaskHolder(*waitTask.group(), waiting), principal, skipCurrentProcess, token, sra, mcc);
887  }
888  }
WaitingTaskList & waitingTasks() const
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
DataManagingOrAliasProductResolver const & realProduct() const
void add(oneapi::tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
FunctorWaitingTask< F > * make_waiting_task(F f)
Definition: WaitingTask.h:92
void prefetchAsync(WaitingTaskHolder waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
std::atomic< bool > & prefetchRequested() const

◆ productUnavailable_()

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

Implements edm::ProductResolverBase.

Definition at line 438 of file ProductResolvers.h.

References edm::ProductResolverBase::productUnavailable().

438 { return realProduct().productUnavailable(); }
DataManagingOrAliasProductResolver const & realProduct() const

◆ resolveProduct_()

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

Implements edm::ProductResolverBase.

Definition at line 850 of file ProductResolvers.cc.

References edm::SwitchBaseProductResolver::realProduct(), edm::ProductResolverBase::resolveProduct(), and edm::SwitchBaseProductResolver::resolveProductImpl().

853  {
854  return resolveProductImpl(realProduct().resolveProduct(principal, skipCurrentProcess, sra, mcc));
855  }
Resolution resolveProduct(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
DataManagingOrAliasProductResolver const & realProduct() const
Resolution resolveProductImpl(Resolution) const

◆ unscheduledWasNotRun_()

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

Implements edm::ProductResolverBase.

Definition at line 437 of file ProductResolvers.h.

References edm::ProductResolverBase::unscheduledWasNotRun().

437 { return realProduct().unscheduledWasNotRun(); }
DataManagingOrAliasProductResolver const & realProduct() const