29 result = dataNode->accept( *
this );
66 for (
auto algoNode : producers ) {
68 if ( State::EVTACCEPTED ==
state || State::EVTREJECTED ==
state ) {
75 for (
auto algoNode : producers ) {
77 if ( State::EVTACCEPTED ==
state || State::EVTREJECTED ==
state ) {
105 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
122 else if ( State::EVTACCEPTED == state )
123 decision = !node.
isLiar();
124 else if ( State::EVTREJECTED == state )
127 if ( -1 != decision ) {
133 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
156 bool foundNonResolvedChild =
false;
157 bool foundNegativeChild =
false;
158 bool foundPositiveChild =
false;
167 bool breakout =
false;
168 for (
unsigned int slotIndex : searchResult->second ) {
177 if ( childDecision == -1 )
178 foundNonResolvedChild =
true;
179 else if ( childDecision == 1 )
180 foundPositiveChild =
true;
182 foundNegativeChild =
true;
185 if ( node.
m_modeOR && foundPositiveChild ) {
189 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
195 if ( foundNonResolvedChild ) {
204 if ( breakout )
break;
210 if ( childDecision == -1 )
211 foundNonResolvedChild =
true;
212 else if ( childDecision == 1 )
213 foundPositiveChild =
true;
215 foundNegativeChild =
true;
218 if ( node.
m_modeOR && foundPositiveChild ) {
221 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
226 if ( foundNonResolvedChild )
break;
231 if ( !foundNonResolvedChild && decision == -1 ) {
233 if ( foundPositiveChild )
238 if ( foundNegativeChild )
250 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
252 if ( decision != -1 ) {
260 for (
unsigned int slotIndex : searchResult->second ) {
266 bool result = child->accept( *
this );
276 bool result = child->accept( *
this );
303 if ( State::INITIAL ==
state ) states.updateState( node.
getAlgoIndex(), State::CONTROLREADY ).ignore();
306 if ( State::CONTROLREADY ==
state ) {
308 result = promoter.visit( node );
325 for (
auto p : products ) rank += p->getConsumers().size();
343 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
350 boost::dynamic_properties dp;
351 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
352 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
353 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
354 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
356 boost::read_graphml( myfile, execPlan, dp );
358 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
361 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
363 auto index =
get( &AlgoTraceProps::m_name, execPlan );
365 runThroughAdjacents( v, execPlan );
366 float rank = m_nodesSucceeded;
380 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVB;
381 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVE;
383 for ( boost::tie( itVB, itVE ) = adjacent_vertices( vertex, graph ); itVB != itVE; ++itVB ) {
384 m_nodesSucceeded += 1;
385 runThroughAdjacents( *itVB, graph );
394 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
400 boost::dynamic_properties dp;
401 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
402 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
403 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
404 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
406 boost::read_graphml( myfile, execPlan, dp );
408 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
411 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
413 auto index =
get( &AlgoTraceProps::m_name, execPlan );
415 auto index_runtime =
get( &AlgoTraceProps::m_runtime, execPlan );
416 float rank = index_runtime[v];
429 myfile.
open(
"Eccentricity.graphml", std::ios::in );
433 boost::dynamic_properties dp;
439 boost::read_graphml( myfile, execPlan, dp );
441 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
444 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
449 float rank = index_eccentricity[v];
462 recursiveVisit( node );
464 float rank = m_maxKnownDepth;
481 if ( products.empty() )
482 if ( ( m_currentDepth - 1 ) > m_maxKnownDepth ) m_maxKnownDepth = m_currentDepth - 1;
484 for (
auto p : products )
485 for (
auto algoNode : p->getConsumers() ) recursiveVisit( *algoNode );
503 bool allChildDecisionsResolved =
true;
512 if ( childDecision == -1 ) {
513 allChildDecisionsResolved =
false;
519 return allChildDecisionsResolved;
540 states.updateState( node.
getAlgoIndex(), State::CONTROLREADY );
541 if ( dataPromoter.visit( node ) ) {
542 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
543 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
549 }
else if ( State::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
550 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
551 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
const unsigned int & getAlgoIndex() const
Get algorithm index.
boost::graph_traits< PrecTrace >::vertex_descriptor AlgoTraceVertex
const std::vector< DataNode * > & getInputDataNodes() const
Get all consumer nodes.
bool isOptimist() const
Check if positive control flow decision is enforced.
AlgsExecutionStates algsStates
Vector of algorithms states.
EventContext * eventContext
Cache for the eventContext.
void setRank(float &rank)
Set Algorithm rank.
bool visit(AlgorithmNode &) override
void recursiveVisit(AlgorithmNode &)
Depth-first node parser to calculate node eccentricity (only within the data realm of the precedence ...
const std::vector< DataNode * > & getOutputDataNodes() const
Get all supplier nodes.
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
bool m_allPass
Whether always passing regardless of daughter results.
std::string entryPoint
Name of the node this slot is attached to ("" for top level)
const std::vector< DecisionNode * > & getParentDecisionHubs() const
Get all parent decision hubs.
bool visit(DecisionNode &) override
bool visit(AlgorithmNode &) override
bool visitEnter(DecisionNode &) const override
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
bool visit(AlgorithmNode &) override
PrecedenceRulesGraph * m_graph
bool visitEnter(DecisionNode &) const override
std::vector< int > controlFlowState
State of the control flow.
const DataObjID & getPath()
std::vector< std::pair< EventContext *, int > > subSlotAlgsReady
Quick lookup for data-ready algorithms in sub-slots (top level only)
const std::vector< ControlFlowNode * > & getDaughters() const
Get children nodes.
bool visit(AlgorithmNode &) override
void runThroughAdjacents(boost::graph_traits< precedence::PrecTrace >::vertex_descriptor, precedence::PrecTrace)
EventSlot * parentSlot
Pointer to parent slot (null for top level)
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoTraceProps > PrecTrace
virtual bool isValidID(const EventContext &ctx, const DataObjID &id) const =0
check to see if a specific condition object ID is valid for this event
State
Execution states of the algorithms.
std::map< std::string, std::vector< unsigned int > > subSlotsByNode
Listing of sub-slots by the node (name) they are attached to.
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
void addEdgeToPrecTrace(const AlgorithmNode *u, const AlgorithmNode *v)
set cause-effect connection between two algorithms in the precedence trace
bool visit(DecisionNode &) override
std::vector< EventSlot > allSubSlots
Actual sub-slot instances.
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
bool visit(AlgorithmNode &) override
bool m_inverted
Whether the selection result is negated or not.
bool isLiar() const
Check if control flow logic is always inverted.
bool visit(AlgorithmNode &) override
const std::string & getNodeName() const
Get node name.
const unsigned int & getNodeIndex() const
Get node index.
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
SmartIF< ICondSvc > m_condSvc
AlgsExecutionStates::State State
StatusCode updateState(unsigned int iAlgo, State newState)