* \param node : node that has emitted the event
* \return the event to notify to bloc's father
*/
-YACS::Event Bloc::updateStateOnFailedEventFrom(Node *node)
+YACS::Event Bloc::updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
{
node->exForwardFailed();
if(areAllSubNodesFinished())
void checkNoCyclePassingThrough(Node *node) throw(Exception);
std::vector< std::pair<OutGate *, InGate *> > getSetOfInternalCFLinks() const;
YACS::Event updateStateOnFinishedEventFrom(Node *node);
- YACS::Event updateStateOnFailedEventFrom(Node *node);
+ YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst);
void initComputation() const;
void performCFComputationsOnlyOneLevel(LinkInfo& info) const;
void performCFComputations(LinkInfo& info) const;
* Calls ComposedNode::updateStateFrom to update state from task to root node
*/
void ComposedNode::notifyFrom(const Task *sender, //* I : task emitting event
- YACS::Event event //* I : event emitted
+ YACS::Event event, //* I : event emitted
+ const Executor *execInst
)
{
DEBTRACE("ComposedNode::notifyFrom " << event);
ComposedNode *curLevelNode=taskTyped->_father;
if(!curLevelNode)//Specific case of loop when 0 turn is specified without any enclosing bloc.
return ;
- curEvent=curLevelNode->updateStateFrom(lminus1LevelNode,curEvent);
+ curEvent=curLevelNode->updateStateFrom(lminus1LevelNode,curEvent,execInst);
while(curEvent!=YACS::NOEVENT && curLevelNode!=this)
{
lminus1LevelNode=curLevelNode;
curLevelNode=curLevelNode->_father;
- curEvent=curLevelNode->updateStateFrom(lminus1LevelNode,curEvent);
+ curEvent=curLevelNode->updateStateFrom(lminus1LevelNode,curEvent,execInst);
}
}
* Called by ComposedNode::notifyFrom
*/
YACS::Event ComposedNode::updateStateFrom(Node *node, //* I : node emitting event
- YACS::Event event //* I : event emitted
+ YACS::Event event, //* I : event emitted
+ const Executor *execInst
)
{
DEBTRACE("updateStateFrom: " << node->getName() << " " << event);
return updateStateOnFinishedEventFrom(node);
break;
case YACS::ABORT:
- return updateStateOnFailedEventFrom(node);
+ return updateStateOnFailedEventFrom(node,execInst);
break;
default:
return YACS::NOEVENT;//TODO unexpected type of event
}
//! Method used to notify the node that a child node has failed
-YACS::Event ComposedNode::updateStateOnFailedEventFrom(Node *node)
+YACS::Event ComposedNode::updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
{
setState(YACS::FAILED);
return YACS::ABORT;
DeploymentTree checkDeploymentTree(bool deep) const throw(Exception);
std::vector<Task *> getNextTasks(bool& isMore);
virtual bool isPlacementPredictableB4Run() const = 0;
- void notifyFrom(const Task *sender, YACS::Event event);
+ void notifyFrom(const Task *sender, YACS::Event event, const Executor *execInst);
bool edAddLink(OutPort *start, InPort *end) throw(Exception);
virtual bool edAddDFLink(OutPort *start, InPort *end) throw(Exception);
//Node* DISOWNnode is a SWIG notation to indicate that the ownership of the node is transfered to C++
static bool splitNamesBySep(const std::string& globalName, const char separator[],
std::string& firstPart, std::string& lastPart, bool priority) throw(Exception);
virtual Node *getChildByShortName(const std::string& name) const throw(Exception) = 0;
- YACS::Event updateStateFrom(Node *node, YACS::Event event);//update the state of this. Precondition : node->_father == this
+ YACS::Event updateStateFrom(Node *node, YACS::Event event, const Executor *execInst);//update the state of this. Precondition : node->_father == this
virtual YACS::Event updateStateOnStartEventFrom(Node *node);//transition 3 doc P.R
virtual YACS::Event updateStateOnFinishedEventFrom(Node *node) = 0;//transition 9 doc P.R.
- virtual YACS::Event updateStateOnFailedEventFrom(Node *node);//transition 9 doc P.R.
+ virtual YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst);//transition 9 doc P.R.
virtual void checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(Exception);
virtual void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView);
* \param node : the child node that has failed
* \return the state change
*/
-YACS::Event DynParaLoop::updateStateOnFailedEventFrom(Node *node)
+YACS::Event DynParaLoop::updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
{
DEBTRACE("DynParaLoop::updateStateOnFailedEventFrom " << node->getName());
setState(YACS::FAILED);
TypeOfNode getIdentityOfNotifyerNode(const Node *node, unsigned& id);
InputPort *getDynInputPortByAbsName(int branchNb, const std::string& name, bool initNodeAdmitted);
virtual void forwardExecStateToOriginalBody(Node *execNode);
- virtual YACS::Event updateStateOnFailedEventFrom(Node *node);
+ virtual YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst);
std::vector<Node *> cloneAndPlaceNodesCoherently(const std::vector<Node *> & origNodes);
Node * checkConsistencyAndSetNode(Node* &nodeToReplace, Node* DISOWNnode);
Node * removeNode(Node* &nodeToRemove);
traceExec(task, "state:TOLOAD", ComputePlacement(task));
{//Critical section
YACS::BASES::AutoLocker<YACS::BASES::Mutex> alck(&_mutexForSchedulerUpdate);
- _mainSched->notifyFrom(task,YACS::START);
+ _mainSched->notifyFrom(task,YACS::START,execInst);
}//End of critical section
try
{
{//Critical section
YACS::BASES::AutoLocker<YACS::BASES::Mutex> alck(&_mutexForSchedulerUpdate);
task->aborted();
- _mainSched->notifyFrom(task,YACS::ABORT);
+ _mainSched->notifyFrom(task,YACS::ABORT,execInst);
traceExec(task, "state:"+Node::getStateName(task->getState()), ComputePlacement(task));
}//End of critical section
}
{//Critical section
YACS::BASES::AutoLocker<YACS::BASES::Mutex> alck(&_mutexForSchedulerUpdate);
task->aborted();
- _mainSched->notifyFrom(task,YACS::ABORT);
+ _mainSched->notifyFrom(task,YACS::ABORT,execInst);
traceExec(task, "state:"+Node::getStateName(task->getState()), ComputePlacement(task));
}//End of critical section
}
{//Critical section
YACS::BASES::AutoLocker<YACS::BASES::Mutex> alck(&_mutexForSchedulerUpdate);
(*iter)->aborted();
- _mainSched->notifyFrom(*iter,YACS::ABORT);
+ _mainSched->notifyFrom(*iter,YACS::ABORT,this);
}//End of critical section
}
catch(...)
{//Critical section
YACS::BASES::AutoLocker<YACS::BASES::Mutex> alck(&_mutexForSchedulerUpdate);
(*iter)->aborted();
- _mainSched->notifyFrom(*iter,YACS::ABORT);
+ _mainSched->notifyFrom(*iter,YACS::ABORT,this);
}//End of critical section
}
if((*iter)->getState() == YACS::ERROR)
{//Critical section
YACS::BASES::AutoLocker<YACS::BASES::Mutex> alck(&_mutexForSchedulerUpdate);
t->aborted();
- _mainSched->notifyFrom(t,YACS::ABORT);
+ _mainSched->notifyFrom(t,YACS::ABORT,this);
}//End of critical section
traceExec(t, "state:"+Node::getStateName(t->getState()),ComputePlacement(*iter));
}
task->aborted();
}
execInst->traceExec(task, "state:"+Node::getStateName(task->getState()),placement);
- sched->notifyFrom(task,ev);
+ sched->notifyFrom(task,ev,execInst);
}
catch(Exception& ex)
{
return YACS::NOEVENT;
}
-YACS::Event ForEachLoop::updateStateOnFailedEventFrom(Node *node)
+YACS::Event ForEachLoop::updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
{
unsigned int id;
DynParaLoop::TypeOfNode ton(getIdentityOfNotifyerNode(node,id));
- // TODO: deal with keepgoing
- // if(ton!=WORK_NODE || !execInst->getKeepGoingProperty())
- if(ton!=WORK_NODE )
- return DynParaLoop::updateStateOnFailedEventFrom(node);
+ // TODO: deal with keepgoing without the dependency to Executor
+ if(ton!=WORK_NODE || !execInst->getKeepGoingProperty())
+ return DynParaLoop::updateStateOnFailedEventFrom(node,execInst);
else
{
_failedCounter++;
YACS::Event updateStateForInitNodeOnFinishedEventFrom(Node *node, unsigned int id);
YACS::Event updateStateForWorkNodeOnFinishedEventFrom(Node *node, unsigned int id, bool isNormalFinish);
YACS::Event updateStateForFinalizeNodeOnFinishedEventFrom(Node *node, unsigned int id);
- YACS::Event updateStateOnFailedEventFrom(Node *node);
+ YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst);
void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
void getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
void releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
* \param node : the child node that has failed
* \return the state change
*/
-YACS::Event OptimizerLoop::updateStateOnFailedEventFrom(Node *node)
+YACS::Event OptimizerLoop::updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
{
DEBTRACE("OptimizerLoop::updateStateOnFailedEventFrom " << node->getName());
_alg->setError(string("Error during the execution of YACS node ") + node->getName() +
_alg->finishProxy();
_myPool.destroyAll();
DEBTRACE("OptimizerLoop::updateStateOnFailedEventFrom: returned from error notification.");
- return DynParaLoop::updateStateOnFailedEventFrom(node);
+ return DynParaLoop::updateStateOnFailedEventFrom(node,execInst);
}
void OptimizerLoop::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
YACS::Event finalize();
protected:
- virtual YACS::Event updateStateOnFailedEventFrom(Node *node);
+ virtual YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst);
void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView);
void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
void checkControlDependancy(OutPort *start, InPort *end, bool cross,
namespace ENGINE
{
class Task;
+ class Executor;
class Scheduler
{
virtual std::string getTaskName(Task *task) const = 0;
virtual std::vector<Task *> getNextTasks(bool& isMore) = 0;
virtual void selectRunnableTasks(std::vector<Task *>& tasks) = 0;
- virtual void notifyFrom(const Task *sender, YACS::Event event) = 0;
+ virtual void notifyFrom(const Task *sender, YACS::Event event, const Executor *execInst) = 0;
//Placement methods
virtual DeploymentTree getDeploymentTree() const = 0;
virtual bool isPlacementPredictableB4Run() const = 0;
static std::map<std::string, YACS::StatesForNode> _nodeStates;
};
+#ifndef SWIG
class YACSLOADER_EXPORT graphParser: public stateParser
{
public:
private:
loopPortParser* _sampleFather;
};
-
+#endif
}
}
#endif
%include "YACSloaderExport.hxx"
%include "parsers.hxx"
%import "xmlParserBase.hxx"
-//%include "LoadState.hxx"
+%include "LoadState.hxx"