From 716f06af1059838142bf1952d11d1b5a0f3f5141 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Thu, 16 Mar 2017 16:45:08 +0100 Subject: [PATCH] Roll back for the keepgoing feature. --- src/engine/Bloc.cxx | 2 +- src/engine/Bloc.hxx | 2 +- src/engine/ComposedNode.cxx | 14 ++++++++------ src/engine/ComposedNode.hxx | 6 +++--- src/engine/DynParaLoop.cxx | 2 +- src/engine/DynParaLoop.hxx | 2 +- src/engine/Executor.cxx | 14 +++++++------- src/engine/ForEachLoop.cxx | 9 ++++----- src/engine/ForEachLoop.hxx | 2 +- src/engine/OptimizerLoop.cxx | 4 ++-- src/engine/OptimizerLoop.hxx | 2 +- src/engine/Scheduler.hxx | 3 ++- src/yacsloader/LoadState.hxx | 3 ++- src/yacsloader_swig/loader.i | 2 +- 14 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/engine/Bloc.cxx b/src/engine/Bloc.cxx index 514d88ff0..7d5e7b045 100644 --- a/src/engine/Bloc.cxx +++ b/src/engine/Bloc.cxx @@ -403,7 +403,7 @@ YACS::Event Bloc::updateStateOnFinishedEventFrom(Node *node) * \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()) diff --git a/src/engine/Bloc.hxx b/src/engine/Bloc.hxx index 23ceabdad..3cfec9172 100644 --- a/src/engine/Bloc.hxx +++ b/src/engine/Bloc.hxx @@ -69,7 +69,7 @@ namespace YACS void checkNoCyclePassingThrough(Node *node) throw(Exception); std::vector< std::pair > 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; diff --git a/src/engine/ComposedNode.cxx b/src/engine/ComposedNode.cxx index bbc28e56d..e27e72da6 100644 --- a/src/engine/ComposedNode.cxx +++ b/src/engine/ComposedNode.cxx @@ -241,7 +241,8 @@ std::vector ComposedNode::getNextTasks(bool& isMore) * 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); @@ -251,12 +252,12 @@ void ComposedNode::notifyFrom(const Task *sender, //* I : task emitting 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); } } @@ -1375,7 +1376,8 @@ OutputDataStreamPort *ComposedNode::getOutputDataStreamPort(const std::string& n * 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); @@ -1390,7 +1392,7 @@ YACS::Event ComposedNode::updateStateFrom(Node *node, //* I : node emitti return updateStateOnFinishedEventFrom(node); break; case YACS::ABORT: - return updateStateOnFailedEventFrom(node); + return updateStateOnFailedEventFrom(node,execInst); break; default: return YACS::NOEVENT;//TODO unexpected type of event @@ -1432,7 +1434,7 @@ YACS::Event ComposedNode::updateStateOnStartEventFrom(Node *node) } //! 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; diff --git a/src/engine/ComposedNode.hxx b/src/engine/ComposedNode.hxx index 82685ef6f..013950a7f 100644 --- a/src/engine/ComposedNode.hxx +++ b/src/engine/ComposedNode.hxx @@ -64,7 +64,7 @@ namespace YACS DeploymentTree checkDeploymentTree(bool deep) const throw(Exception); std::vector 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++ @@ -136,10 +136,10 @@ namespace YACS 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& pointsOfViewStart, InPort *end, const std::list& pointsOfViewEnd) throw(Exception); virtual void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list& pointsOfView); diff --git a/src/engine/DynParaLoop.cxx b/src/engine/DynParaLoop.cxx index 996e6625c..cca32828b 100644 --- a/src/engine/DynParaLoop.cxx +++ b/src/engine/DynParaLoop.cxx @@ -696,7 +696,7 @@ void DynParaLoop::forwardExecStateToOriginalBody(Node *execNode) * \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); diff --git a/src/engine/DynParaLoop.hxx b/src/engine/DynParaLoop.hxx index 7160e761b..c00a5e8c5 100644 --- a/src/engine/DynParaLoop.hxx +++ b/src/engine/DynParaLoop.hxx @@ -124,7 +124,7 @@ namespace YACS 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 cloneAndPlaceNodesCoherently(const std::vector & origNodes); Node * checkConsistencyAndSetNode(Node* &nodeToReplace, Node* DISOWNnode); Node * removeNode(Node* &nodeToRemove); diff --git a/src/engine/Executor.cxx b/src/engine/Executor.cxx index 3fe233683..c5e7c7b45 100644 --- a/src/engine/Executor.cxx +++ b/src/engine/Executor.cxx @@ -829,7 +829,7 @@ void Executor::loadTask(Task *task, const Executor *execInst) traceExec(task, "state:TOLOAD", ComputePlacement(task)); {//Critical section YACS::BASES::AutoLocker alck(&_mutexForSchedulerUpdate); - _mainSched->notifyFrom(task,YACS::START); + _mainSched->notifyFrom(task,YACS::START,execInst); }//End of critical section try { @@ -844,7 +844,7 @@ void Executor::loadTask(Task *task, const Executor *execInst) {//Critical section YACS::BASES::AutoLocker 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 } @@ -854,7 +854,7 @@ void Executor::loadTask(Task *task, const Executor *execInst) {//Critical section YACS::BASES::AutoLocker 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 } @@ -927,7 +927,7 @@ void Executor::launchTasks(const std::vector& tasks) {//Critical section YACS::BASES::AutoLocker alck(&_mutexForSchedulerUpdate); (*iter)->aborted(); - _mainSched->notifyFrom(*iter,YACS::ABORT); + _mainSched->notifyFrom(*iter,YACS::ABORT,this); }//End of critical section } catch(...) @@ -946,7 +946,7 @@ void Executor::launchTasks(const std::vector& tasks) {//Critical section YACS::BASES::AutoLocker alck(&_mutexForSchedulerUpdate); (*iter)->aborted(); - _mainSched->notifyFrom(*iter,YACS::ABORT); + _mainSched->notifyFrom(*iter,YACS::ABORT,this); }//End of critical section } if((*iter)->getState() == YACS::ERROR) @@ -972,7 +972,7 @@ void Executor::launchTasks(const std::vector& tasks) {//Critical section YACS::BASES::AutoLocker 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)); } @@ -1225,7 +1225,7 @@ void *Executor::functionForTaskExecution(void *arg) task->aborted(); } execInst->traceExec(task, "state:"+Node::getStateName(task->getState()),placement); - sched->notifyFrom(task,ev); + sched->notifyFrom(task,ev,execInst); } catch(Exception& ex) { diff --git a/src/engine/ForEachLoop.cxx b/src/engine/ForEachLoop.cxx index d722b0369..838bfb338 100644 --- a/src/engine/ForEachLoop.cxx +++ b/src/engine/ForEachLoop.cxx @@ -882,14 +882,13 @@ YACS::Event ForEachLoop::updateStateForFinalizeNodeOnFinishedEventFrom(Node *nod 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++; diff --git a/src/engine/ForEachLoop.hxx b/src/engine/ForEachLoop.hxx index 0f3690fb0..54aa83aae 100644 --- a/src/engine/ForEachLoop.hxx +++ b/src/engine/ForEachLoop.hxx @@ -216,7 +216,7 @@ namespace YACS 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& port, InPort *finalTarget, const std::list& pointsOfView); void getDelegateOf(std::pair& port, InPort *finalTarget, const std::list& pointsOfView) throw(Exception); void releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list& pointsOfView) throw(Exception); diff --git a/src/engine/OptimizerLoop.cxx b/src/engine/OptimizerLoop.cxx index eeca9c74f..91b35f29c 100644 --- a/src/engine/OptimizerLoop.cxx +++ b/src/engine/OptimizerLoop.cxx @@ -456,7 +456,7 @@ YACS::Event OptimizerLoop::finalize() * \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() + @@ -464,7 +464,7 @@ YACS::Event OptimizerLoop::updateStateOnFailedEventFrom(Node *node) _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) diff --git a/src/engine/OptimizerLoop.hxx b/src/engine/OptimizerLoop.hxx index 75c2cf37d..a5a23cc68 100644 --- a/src/engine/OptimizerLoop.hxx +++ b/src/engine/OptimizerLoop.hxx @@ -107,7 +107,7 @@ namespace YACS 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& pointsOfView); void buildDelegateOf(std::pair& port, InPort *finalTarget, const std::list& pointsOfView); void checkControlDependancy(OutPort *start, InPort *end, bool cross, diff --git a/src/engine/Scheduler.hxx b/src/engine/Scheduler.hxx index 68d975587..d6ee7a1da 100644 --- a/src/engine/Scheduler.hxx +++ b/src/engine/Scheduler.hxx @@ -31,6 +31,7 @@ namespace YACS namespace ENGINE { class Task; + class Executor; class Scheduler { @@ -42,7 +43,7 @@ namespace YACS virtual std::string getTaskName(Task *task) const = 0; virtual std::vector getNextTasks(bool& isMore) = 0; virtual void selectRunnableTasks(std::vector& 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; diff --git a/src/yacsloader/LoadState.hxx b/src/yacsloader/LoadState.hxx index 6102e0b3f..1e74f2889 100644 --- a/src/yacsloader/LoadState.hxx +++ b/src/yacsloader/LoadState.hxx @@ -102,6 +102,7 @@ namespace YACS static std::map _nodeStates; }; +#ifndef SWIG class YACSLOADER_EXPORT graphParser: public stateParser { public: @@ -212,7 +213,7 @@ namespace YACS private: loopPortParser* _sampleFather; }; - +#endif } } #endif diff --git a/src/yacsloader_swig/loader.i b/src/yacsloader_swig/loader.i index 13dd1bcd9..4f41b4ad1 100644 --- a/src/yacsloader_swig/loader.i +++ b/src/yacsloader_swig/loader.i @@ -67,5 +67,5 @@ %include "YACSloaderExport.hxx" %include "parsers.hxx" %import "xmlParserBase.hxx" -//%include "LoadState.hxx" +%include "LoadState.hxx" -- 2.30.2