The Gaudi Framework  master (37c0b60a)
concurrency::DataReadyPromoter Class Reference

#include </builds/gaudi/Gaudi/GaudiHive/src/PRGraph/Visitors/Promoters.h>

Inheritance diagram for concurrency::DataReadyPromoter:
Collaboration diagram for concurrency::DataReadyPromoter:

Public Member Functions

 DataReadyPromoter (EventSlot &slot, const Cause &cause, bool ifTrace=false)
 Constructor. More...
 
bool visitEnter (AlgorithmNode &) const override
 
bool visit (AlgorithmNode &) override
 
bool visitEnter (DataNode &) const override
 
bool visit (DataNode &) override
 
bool visitEnter (ConditionNode &) const override
 
bool visit (ConditionNode &) override
 
virtual bool visit (DecisionNode &)
 
virtual bool visit (AlgorithmNode &)
 
virtual bool visit (DataNode &)
 
virtual bool visit (ConditionNode &)
 
virtual bool visitEnter (DecisionNode &) const
 
virtual bool visitEnter (AlgorithmNode &) const
 
virtual bool visitEnter (DataNode &) const
 
virtual bool visitEnter (ConditionNode &) const
 
- Public Member Functions inherited from concurrency::IGraphVisitor
virtual ~IGraphVisitor ()=default
 
virtual bool visitEnter (DecisionNode &) const
 
virtual bool visit (DecisionNode &)
 
virtual void reset ()
 

Public Attributes

EventSlotm_slot
 
Cause m_cause
 
bool m_trace
 

Detailed Description

Definition at line 21 of file Promoters.h.

Constructor & Destructor Documentation

◆ DataReadyPromoter()

concurrency::DataReadyPromoter::DataReadyPromoter ( EventSlot slot,
const Cause cause,
bool  ifTrace = false 
)
inline

Constructor.

Definition at line 24 of file Promoters.h.

25  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ) {}

Member Function Documentation

◆ visit() [1/7]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 29 of file IGraphVisitor.h.

29 { return true; }

◆ visit() [2/7]

bool concurrency::DataReadyPromoter::visit ( AlgorithmNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 32 of file Promoters.cpp.

32  {
33 
34  bool result = true; // return true if this algorithm has no data inputs
35 
36  for ( auto dataNode : node.getInputDataNodes() ) {
37 
38  result = dataNode->accept( *this );
39 
40  // With ConditionNodes, one may decide NOT to break here so that associated
41  // ConditionAlgorithms are scheduled ASAP. This behavior can be made configurable
42  if ( !result ) break; // skip checking other inputs if this input was not produced yet
43  }
44 
45  if ( result ) {
46  m_slot->algsStates.set( node.getAlgoIndex(), AState::DATAREADY ).ignore();
47 
48  if ( m_trace ) {
49  auto sourceNode = ( m_cause.m_source == Cause::source::Task )
50  ? node.m_graph->getAlgorithmNode( m_cause.m_sourceName )
51  : nullptr;
52  node.m_graph->addEdgeToPrecTrace( sourceNode, &node );
53  }
54  }
55 
56  // return true only if an algorithm is promoted to DR
57  return result;
58  }

◆ visit() [3/7]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 35 of file IGraphVisitor.h.

35 { return true; }

◆ visit() [4/7]

bool concurrency::DataReadyPromoter::visit ( ConditionNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 90 of file Promoters.cpp.

90  {
91  /* Implements 'requester' strategy, i.e., requests this ConditionNode to be loaded
92  * by its associated ConditionAlgorithm */
93 
94  auto promoter = Supervisor( *m_slot, m_cause, m_trace );
95 
96  for ( auto condAlg : node.getProducers() ) condAlg->accept( promoter );
97 
98  // this method is called if, and only if, this ConditionNode is not yet produced.
99  // thus, by definition, this ConditionNode is not yet available at this moment
100  return false;
101  }

◆ visit() [5/7]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 32 of file IGraphVisitor.h.

32 { return true; }

◆ visit() [6/7]

bool concurrency::DataReadyPromoter::visit ( DataNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 64 of file Promoters.cpp.

64  {
65  /* Implements 'observer' strategy, i.e., only check if producer of this DataNode
66  * has been already executed or not */
67 
68  auto const& producers = node.getProducers();
69  for ( auto algoNode : producers ) {
70  const auto& state = m_slot->algsStates[algoNode->getAlgoIndex()];
71  if ( AState::EVTACCEPTED == state || AState::EVTREJECTED == state ) {
72  return true; // skip checking other producers if one was found to be executed
73  }
74  }
75 
76  // return true only if this DataNode is produced
77  return false;
78  }

◆ visit() [7/7]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 26 of file IGraphVisitor.h.

26 { return true; }

◆ visitEnter() [1/7]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 28 of file IGraphVisitor.h.

28 { return true; }

◆ visitEnter() [2/7]

bool concurrency::DataReadyPromoter::visitEnter ( AlgorithmNode node) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 24 of file Promoters.cpp.

24  {
25 
26  if ( AState::CONTROLREADY != m_slot->algsStates[node.getAlgoIndex()] ) return false;
27 
28  return true;
29  }

◆ visitEnter() [3/7]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 34 of file IGraphVisitor.h.

34 { return true; }

◆ visitEnter() [4/7]

bool concurrency::DataReadyPromoter::visitEnter ( ConditionNode node) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 81 of file Promoters.cpp.

81  {
82 
83  if ( node.m_condSvc->isValidID( *( m_slot->eventContext ), node.name() ) )
84  return false; // do not enter this ConditionNode if the condition has bee already loaded
85 
86  return true;
87  }

◆ visitEnter() [5/7]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 31 of file IGraphVisitor.h.

31 { return true; }

◆ visitEnter() [6/7]

bool concurrency::DataReadyPromoter::visitEnter ( DataNode ) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 61 of file Promoters.cpp.

61 { return true; }

◆ visitEnter() [7/7]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 25 of file IGraphVisitor.h.

25 { return true; }

Member Data Documentation

◆ m_cause

Cause concurrency::DataReadyPromoter::m_cause

Definition at line 43 of file Promoters.h.

◆ m_slot

EventSlot* concurrency::DataReadyPromoter::m_slot

Definition at line 42 of file Promoters.h.

◆ m_trace

bool concurrency::DataReadyPromoter::m_trace

Definition at line 44 of file Promoters.h.


The documentation for this class was generated from the following files:
EventSlot::eventContext
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
Definition: EventSlot.h:83
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: Promoters.h:42
concurrency::DataReadyPromoter::m_trace
bool m_trace
Definition: Promoters.h:44
Cause::m_source
source m_source
Definition: PrecedenceRulesGraph.h:399
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
AlgsExecutionStates::set
StatusCode set(unsigned int iAlgo, State newState)
Definition: AlgsExecutionStates.cpp:23
Cause::source::Task
@ Task
concurrency::DataReadyPromoter::m_cause
Cause m_cause
Definition: Promoters.h:43
compareRootHistos.state
state
Definition: compareRootHistos.py:496
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:85
Cause::m_sourceName
std::string m_sourceName
Definition: PrecedenceRulesGraph.h:400