CMS 3D CMS Logo

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

#include <ProductResolvers.h>

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

Public Member Functions

 SwitchProducerProductResolver (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 setProcessHistory (ProcessHistory const &ph)
 
void setProvenance (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
 
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
 
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
 
Resolution resolveProductImpl (Resolution) const
 
ProductStatus status () const
 
WaitingTaskListwaitingTasks () const
 
Workerworker () const
 

Detailed Description

Definition at line 324 of file ProductResolvers.h.

Constructor & Destructor Documentation

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

Definition at line 326 of file ProductResolvers.h.

References edm::ProductResolverBase::prefetchAsync_(), cmsRelvalreport::principal(), and edm::ProductResolverBase::resolveProduct_().

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

Member Function Documentation

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

Implements edm::ProductResolverBase.

Definition at line 686 of file ProductResolvers.cc.

References edm::WaitingTaskList::add(), edm::ProductResolverBase::branchDescription(), edm::Worker::callWhenDoneAsync(), edm::WaitingTaskList::doneWaiting(), edm::ParentContext::isAtEndTransition(), edm::make_waiting_task(), edm::ModuleCallingContext::parent(), edm::SwitchBaseProductResolver::prefetchRequested(), edm::SwitchBaseProductResolver::waitingTasks(), and edm::SwitchBaseProductResolver::worker().

691  {
692  if (skipCurrentProcess) {
693  return;
694  }
695  if (branchDescription().availableOnlyAtEndTransition() and mcc and not mcc->parent().isAtEndTransition()) {
696  return;
697  }
698  waitingTasks().add(waitTask);
699 
700  bool expected = false;
701  if (prefetchRequested().compare_exchange_strong(expected, true)) {
702  //using a waiting task to do a callback guarantees that
703  // the waitingTasks() list will be released from waiting even
704  // if the module does not put this data product or the
705  // module has an exception while running
706  auto waiting = make_waiting_task(tbb::task::allocate_root(), [this](std::exception_ptr const* iException) {
707  if (nullptr != iException) {
708  waitingTasks().doneWaiting(*iException);
709  } else {
710  waitingTasks().doneWaiting(std::exception_ptr());
711  }
712  });
713  worker()->callWhenDoneAsync(waiting);
714  }
715  }
void callWhenDoneAsync(WaitingTask *task)
Definition: Worker.h:167
WaitingTaskList & waitingTasks() const
void add(WaitingTask *)
Adds task to the waiting list.
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
FunctorWaitingTask< F > * make_waiting_task(ALLOC &&iAlloc, F f)
Definition: WaitingTask.h:87
BranchDescription const & branchDescription() const
std::atomic< bool > & prefetchRequested() const
bool edm::SwitchProducerProductResolver::productUnavailable_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 717 of file ProductResolvers.cc.

References edm::ProductResolverBase::productUnavailable(), edm::SwitchBaseProductResolver::realProduct(), edm::DataManagingProductResolver::ResolveFailed, and edm::SwitchBaseProductResolver::status().

717  {
718  // if produce() was run (ResolveFailed), ask from the real resolver
720  return realProduct().productUnavailable();
721  }
722  return true;
723  }
DataManagingOrAliasProductResolver const & realProduct() const
ProductStatus status() const
ProductResolverBase::Resolution edm::SwitchProducerProductResolver::resolveProduct_ ( Principal const &  principal,
bool  skipCurrentProcess,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 676 of file ProductResolvers.cc.

References edm::SwitchBaseProductResolver::realProduct(), Resolution, edm::DataManagingProductResolver::ResolveFailed, edm::ProductResolverBase::resolveProduct(), edm::SwitchBaseProductResolver::resolveProductImpl(), and edm::SwitchBaseProductResolver::status().

679  {
681  return resolveProductImpl(realProduct().resolveProduct(principal, skipCurrentProcess, sra, mcc));
682  }
683  return Resolution(nullptr);
684  }
DataManagingOrAliasProductResolver const & realProduct() const
Resolution resolveProductImpl(Resolution) const
Resolution resolveProduct(Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
def principal(options)
ProductStatus status() const
bool edm::SwitchProducerProductResolver::unscheduledWasNotRun_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 341 of file ProductResolvers.h.

References edm::ProductResolverBase::productUnavailable_().

341 { return false; }