31 result = dataNode->accept( *
this );
68 for (
auto algoNode : producers ) {
70 if ( State::EVTACCEPTED ==
state || State::EVTREJECTED ==
state ) {
77 for (
auto algoNode : producers ) {
79 if ( State::EVTACCEPTED ==
state || State::EVTREJECTED ==
state ) {
107 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
124 else if ( State::EVTACCEPTED == state )
125 decision = !node.
isLiar();
126 else if ( State::EVTREJECTED == state )
129 if ( -1 != decision ) {
135 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
152 bool canFindExit =
false;
154 allAncestors.
push( &node );
155 while ( allAncestors.
size() ) {
169 for (
auto& evenOlder : thisAncestor->
m_parents ) {
171 allAncestors.
push( evenOlder );
177 if ( !canFindExit )
return false;
188 bool foundNonResolvedChild =
false;
189 bool foundNegativeChild =
false;
190 bool foundPositiveChild =
false;
203 bool breakout =
false;
204 for (
unsigned int slotIndex : searchResult->second ) {
213 if ( childDecision == -1 )
214 foundNonResolvedChild =
true;
215 else if ( childDecision == 1 )
216 foundPositiveChild =
true;
218 foundNegativeChild =
true;
221 if ( node.
m_modeOR && foundPositiveChild ) {
225 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
231 if ( foundNonResolvedChild ) {
240 if ( breakout )
break;
246 if ( childDecision == -1 )
247 foundNonResolvedChild =
true;
248 else if ( childDecision == 1 )
249 foundPositiveChild =
true;
251 foundNegativeChild =
true;
254 if ( node.
m_modeOR && foundPositiveChild ) {
257 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
262 if ( foundNonResolvedChild )
break;
267 if ( !foundNonResolvedChild && decision == -1 ) {
269 if ( foundPositiveChild )
274 if ( foundNegativeChild )
286 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
288 if ( decision != -1 ) {
293 parent->accept( *
this );
296 if ( oldSlot )
m_slot = oldSlot;
303 for (
unsigned int slotIndex : searchResult->second ) {
309 bool result = child->accept( *
this );
319 bool result = child->accept( *
this );
325 if ( oldSlot )
m_slot = oldSlot;
347 if ( State::INITIAL ==
state ) states.updateState( node.
getAlgoIndex(), State::CONTROLREADY ).ignore();
350 if ( State::CONTROLREADY ==
state ) {
352 result = promoter.visit( node );
369 for (
auto p : products ) rank += p->getConsumers().size();
387 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
394 boost::dynamic_properties dp;
395 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
396 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
397 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
398 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
400 boost::read_graphml( myfile, execPlan, dp );
402 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
405 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
407 auto index =
get( &AlgoTraceProps::m_name, execPlan );
409 runThroughAdjacents( v, execPlan );
410 float rank = m_nodesSucceeded;
424 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVB;
425 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVE;
427 for ( boost::tie( itVB, itVE ) = adjacent_vertices( vertex, graph ); itVB != itVE; ++itVB ) {
428 m_nodesSucceeded += 1;
429 runThroughAdjacents( *itVB, graph );
438 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
444 boost::dynamic_properties dp;
445 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
446 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
447 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
448 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
450 boost::read_graphml( myfile, execPlan, dp );
452 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
455 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
457 auto index =
get( &AlgoTraceProps::m_name, execPlan );
459 auto index_runtime =
get( &AlgoTraceProps::m_runtime, execPlan );
460 float rank = index_runtime[v];
473 myfile.
open(
"Eccentricity.graphml", std::ios::in );
477 boost::dynamic_properties dp;
483 boost::read_graphml( myfile, execPlan, dp );
485 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
488 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
493 float rank = index_eccentricity[v];
506 recursiveVisit( node );
508 float rank = m_maxKnownDepth;
525 if ( products.empty() )
526 if ( ( m_currentDepth - 1 ) > m_maxKnownDepth ) m_maxKnownDepth = m_currentDepth - 1;
528 for (
auto p : products )
529 for (
auto algoNode : p->getConsumers() ) recursiveVisit( *algoNode );
546 bool allChildDecisionsResolved =
true;
550 child->accept( *
this );
553 if ( childDecision == -1 ) allChildDecisionsResolved =
false;
563 parent->accept( *
this );
569 if ( allChildDecisionsResolved ) {
574 parent->accept( *
this );
578 return allChildDecisionsResolved;
599 states.updateState( node.
getAlgoIndex(), State::CONTROLREADY );
600 if ( dataPromoter.visit( node ) ) {
601 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
602 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
608 }
else if ( State::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
609 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
610 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
const unsigned int & getAlgoIndex() const
Get algorithm index.
std::vector< DecisionNode * > m_parents
Direct parent nodes.
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.
Class representing the event slot.
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)