_Executable = false ;
if ( !Graph()->CreateService() ) {
- cdebug << "This DataFlow has invalid type(s)." << endl ;
+ cdebug_out << "This DataFlow has invalid type(s)." << endl ;
return false ;
}
int SubStreamGraphsNumber = 0 ;
if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
- cdebug << "This DataFlow is not valid." << endl ;
+ cdebug_out << "This DataFlow is not valid." << endl ;
return false ;
}
if ( Graph()->IsDataStreamNode() ) {
StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
}
+ if ( !Graph()->ValidLoops() ) {
+ cdebug_out << "This DataFlow have not valid Loops." << endl ;
+ return false ;
+ }
// CreateService() ;
for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ;
anInNode->OutNode( this ) ;
+// Initialize in python interpretor the python functions
if ( !PyInitialized() && anInNode->IsOneOfInLineNodes() ) {
if ( !Py_IsInitialized() ) {
// PyEval_InitThreads() ;
}
// PushEvent( anInNode , GraphExecutor::ReadyEvent ,
// GraphExecutor::DataReadyState ) ;
+// We say that we have to create a thread for that HeadNode 'anInNode'
anInNode->CreateNewThread( true ) ;
anInNode->DataFromNode( Graph()->Name() ) ;
+// AndSuspend == true <==> Start()
if ( AndSuspend ) {
anInNode->State( GraphExecutor::DataWaitingState ) ;
anInNode->ControlState( SUPERV::ToSuspendStartState ) ;
+// We send SomeDataReadyEvent
+// It is a HeadNode ==> AllDataReadyEvent ==> InNode::executeAction() ==> pthread_create
if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) {
cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node "
<< anInNode->Name() << endl ;
cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ;
return false ;
}
+// ==> We wait for SuspendedState
anInNode->SuspendedWait() ;
}
+// AndSuspend == false <==> Run()
else if ( anInNode->IsMacroNode() ) {
if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) {
cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node "
}
cdebug << pthread_self() << " GraphExecutor::OutNode::Run " << anInNode->Name() << "->RunningWait"
<< endl ;
+// ==> We wait for RunningState
anInNode->RunningWait() ;
cdebug << pthread_self() << " GraphExecutor::OutNode::Run " << anInNode->Name() << "->RunningWaited"
<< endl ;
}
else if ( !anInNode->IsMacroNode() ) {
+// It is a HeadNode ==> AllDataReadyEvent ==> InNode::executeAction() ==> pthread_create
if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) {
cdebug << "InNode::SendEvent( ExecuteEvent ) ERROR Node "
<< anInNode->Name() << endl ;
cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ;
return false ;
}
+// ==> We wait for RunningState
anInNode->RunningWait() ;
}
}
return RetVal ;
}
-bool GraphExecutor::OutNode::Run( const char * aNodeName ,
- const char * AtNodeName ,
- const bool AndSuspend ) {
- bool RetVal = false ;
- cdebug_in << "GraphExecutor::OutNode::Run( " << aNodeName << " , "
- << AtNodeName << " , " << AndSuspend << ")" << endl;
- GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode() ;
- if ( anInNode ) {
- RetVal = anInNode->ReStart( AtNodeName , AndSuspend ) ;
- }
- cdebug_out << "GraphExecutor::OutNode::Run" << endl ;
- return RetVal ;
-}
-
void GraphExecutor::OutNode::CheckAllDone() {
int j ;
cdebug_in << "GraphExecutor::OutNode::CheckAllDone " << endl;
aState == SUPERV::RunningState ||
aState == SUPERV::SuspendDoneState ||
aState == SUPERV::SuspendErroredState ||
- aState == SUPERV::ReRunState ||
- aState == SUPERV::ReStartState ||
aState == SUPERV::SuspendState ) {
alivenodes += 1 ;
}
aGraphEvent = SUPERV::ErroredEvent ;
break ;
}
- case GraphExecutor::ReStartEvent : {
- aGraphEvent = SUPERV::ReRunEvent ;
- break ;
- }
- case GraphExecutor::ReStartAndSuspendEvent : {
- aGraphEvent = SUPERV::ReStartEvent ;
- break ;
- }
case GraphExecutor::NoDataReadyEvent : {
aGraphEvent = SUPERV::WaitingEvent ;
break ;
aGraphEvent = SUPERV::StopEvent ;
break ;
}
- case GraphExecutor::ReStartedEvent : {
- aGraphEvent = SUPERV::ReRunEvent ;
- break ;
- }
- case GraphExecutor::ReStartedAndSuspendEvent : {
- aGraphEvent = SUPERV::ReStartEvent ;
- break ;
- }
case GraphExecutor::EndExecuteEvent : {
aGraphEvent = SUPERV::DoneEvent ;
break ;
aGraphState = SUPERV::StopState ;
break ;
}
- case GraphExecutor::ReRunnedState : {
- aGraphState = SUPERV::ReRunState ;
- break ;
- }
- case GraphExecutor::ReStartedState : {
- aGraphState = SUPERV::ReStartState ;
- break ;
+ case GraphExecutor::LoadingState : {
+ aGraphState = SUPERV::LoadingState ;
+ break;
}
default : {
cdebug << " GraphExecutor::OutNode::AutomatonGraphState Error Undefined State : "
if ( aCNode ) {
GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *)aCNode->GetInNode() ;
if ( anInNode ) {
- aret = anInNode->State() ;
+ if ( anInNode->IsLoading() )
+ aret = GraphExecutor::LoadingState;
+ else
+ aret = anInNode->State() ;
// cdebug << "GraphExecutor::OutNode::State( " << NodeName << " ) "
// << theAutomaton->StateName( AutomatonGraphState( aret ) ) << endl ;
}
for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ;
bool sts = aNode->Kill() ;
- if ( sts ) {
+ if ( sts && Threads() != 0 ) {
if ( !aNode->IsKilled() ) {
cdebug << aNode->Name() << " not killed : "
<< theAutomaton->StateName( aNode->State() ) << " " << aNode->Name() << "->"
}
return RetVal ;
}
-bool GraphExecutor::OutNode::ReRun() {
- bool RetVal = false ;
- cdebug_in << "GraphExecutor::OutNode::ReRun" << endl;
- if ( IsSuspended() ) {
- }
- cdebug_out << "GraphExecutor::OutNode::ReRun" << endl ;
- return RetVal ;
-}
-bool GraphExecutor::OutNode::ReStart() {
- bool RetVal = false ;
- cdebug_in << "GraphExecutor::OutNode::ReStart" << endl;
- if ( IsSuspended() ) {
- }
- cdebug_out << "GraphExecutor::OutNode::ReStart" << endl ;
- return RetVal ;
-}
bool GraphExecutor::OutNode::ReadyWait() {
cdebug_in << "GraphExecutor::OutNode::ReadyWait" << endl;