}
bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) {
+ //JR Look at DataFlowExecutor for the meaning of WithErr
cdebug_in << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " WithErr " << WithErr
<< " PyFuncRunned() " << PyFuncRunned() << endl;
bool Err = false ;
PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
InLineNode()->PythonFunction() ,
OneErr ) ;
- InLineNode()->PyRunMethod( PyRunMethod ) ;
+ // JR Debug : if we must have a python function and if we have not : error
+ if ( PyRunMethod ) {
+ InLineNode()->PyRunMethod( PyRunMethod ) ;
+ }
+ else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) {
+ OneErr = true ;
+ }
}
Err = Err || OneErr ;
if ( OneErr && WithErr ) {
PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() ,
LoopNode()->MorePythonFunction() ,
OneErr ) ;
- LoopNode()->PyMoreMethod( PyMoreMethod ) ;
+ // JR Debug : if we must have a python function and if we have not : error
+ if ( PyMoreMethod ) {
+ LoopNode()->PyMoreMethod( PyMoreMethod ) ;
+ }
+ else if ( WithErr && strlen( LoopNode()->PyMoreName() ) ) {
+ OneErr = true ;
+ }
}
Err = Err || OneErr ;
if ( OneErr && WithErr ) {
PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() ,
LoopNode()->NextPythonFunction() ,
OneErr ) ;
- LoopNode()->PyNextMethod( PyNextMethod ) ;
+ // JR Debug : if we must have a python function and if we have not : error
+ if ( PyNextMethod ) {
+ LoopNode()->PyNextMethod( PyNextMethod ) ;
+ }
+ else if ( WithErr && strlen( LoopNode()->PyNextName() ) ) {
+ OneErr = true ;
+ }
}
Err = Err || OneErr ;
if ( OneErr && WithErr ) {
string( Name() ) ;
_OutNode->Graph()->SetMessages( anErrorMessage ) ;
}
- // PAL12854 -->
+ //JR Debug 12854
if ( Err ) {
PyFuncRunned( false ) ;
}
- // PAL12854 <--
cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) "
<< PyRunMethod << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod
<< endl;
PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
InLineNode()->PythonFunction() ,
OneErr ) ;
- InLineNode()->PyRunMethod( PyRunMethod ) ;
+ // JR Debug : if we must have a python function and if we have not : error
+ if ( PyRunMethod != NULL ) {
+ InLineNode()->PyRunMethod( PyRunMethod ) ;
+ }
+ else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) {
+ OneErr = true ;
+ }
}
Err = Err || OneErr ;
if ( OneErr && WithErr ) {
PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
InLineNode()->PythonFunction() ,
OneErr ) ;
- InLineNode()->PyRunMethod( PyRunMethod ) ;
+ // JR Debug : if we must have a python function and if we have not : error
+ if ( PyRunMethod != NULL ) {
+ InLineNode()->PyRunMethod( PyRunMethod ) ;
+ }
+ else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) {
+ OneErr = true ;
+ }
}
Err = Err || OneErr ;
if ( OneErr && WithErr ) {
cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl;
}
}
- Err = WithErr && Err ;
+ //JR Look at DataFlowExecutor :
+ // Err = WithErr && Err ;
cdebug_out << "GraphExecutor::InNode::InitPythonFunctions " << Name() ;
- if ( Err ) {
- cdebug << " Error " << Err ;
+ if ( WithErr && Err ) {
+ cdebug << " Error " << WithErr && Err ;
}
cdebug << endl;
return !Err ;
_JustStarted = true ;
RetVal = true ;
int i ;
+ bool again = true ;
for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ;
anInNode->OutNode( this ) ;
}
anInNode->InitialState() ;
if ( anInNode->IsOneOfInLineNodes() ) {
- anInNode->InitPythonFunctions( false ) ;
+ //JR with Python2.3.4, we may get an error because of a normal previous error
+ bool sts = anInNode->InitPythonFunctions( false ) ;
+ if ( again && !sts ) {
+ sts = anInNode->InitPythonFunctions( false ) ;
+ again = false ;
+ }
}
}
// One more time because inline nodes may share one definition of the same function
}
}
*/
+ //JR Debug : if there was an error in initialisation of python functions,
+ // we must not try to execute the graph.
+ if ( RetVal ) {
if ( Graph()->GraphMacroLevel() != 0 ) {
cdebug << "GraphExecutor::OutNode::Run Execution starting GraphExecutor::Action_DataOk_RunService Node "
<< Name() << " GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ;
// Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ;
RetVal = true ;
}
+ //JR Debug
+ }
+ else {
+ State( GraphExecutor::ErroredState ) ;
+ Done( true ) ;
+ if ( IsDone() ) {
+ cdebug << " ==> theAutomaton->Executed() " << endl ;
+ theAutomaton->Executed() ;
+ }
+ else {
+ cdebug << " NO theAutomaton->Executed() " << endl ;
+ }
+ }
}
else {
// PAL 8515