return xmldump;
}
+std::string InputPort::getHumanRepr()
+{
+ return dump();
+}
+
void InputPort::setStringRef(std::string strRef)
{
_stringRef = strRef;
virtual void *get() const = 0;
virtual void put(const void *data) throw(ConversionException) = 0;
virtual std::string dump();
+ virtual std::string getHumanRepr();
virtual void setStringRef(std::string strRef);
virtual std::string typeName() {return "YACS__ENGINE__InputPort";}
bool canBeNull() const;
return _pattern->getObserver();
}
+std::string YACSEvalYFX::getErrorDetailsInCaseOfFailure() const
+{
+ return _pattern->getErrorDetailsInCaseOfFailure();
+}
+
std::string YACSEvalYFX::getStatusOfRunStr() const
{
return _pattern->getStatusOfRunStr();
YACSEVALYFX_EXPORT bool run(YACSEvalSession *session, int& nbOfBranches);
YACSEVALYFX_EXPORT void registerObserver(YACSEvalObserver *observer);
YACSEVALYFX_EXPORT YACSEvalObserver *getObserver();
+ YACSEVALYFX_EXPORT std::string getErrorDetailsInCaseOfFailure() const;
YACSEVALYFX_EXPORT std::string getStatusOfRunStr() const;
YACSEVALYFX_EXPORT std::vector<YACSEvalSeqAny *> getResults() const;
YACSEVALYFX_EXPORT std::vector<YACSEvalSeqAny *> getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const;
const char YACSEvalYFXPattern::ST_ERROR[]="SOME_SAMPLES_FAILED_BUT_IMPOSSIBLE_TO_CONCLUDE_ON_THEM";
+const std::size_t YACSEvalYFXPattern::MAX_LGTH_OF_INP_DUMP=10000;
+
const char YACSEvalYFXRunOnlyPattern::FIRST_FE_SUBNODE_NAME[]="Bloc";
const char YACSEvalYFXRunOnlyPattern::GATHER_NODE_NAME[]="__gather__";
return _generatedGraph;
}
+std::string YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure() const
+{
+ std::string st(getStatusOfRunStr());//test if a run has occurred.
+ if(st==ST_OK)
+ throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure : The execution of scheme has been carried out to the end without any problem !");
+ // All the problem can only comes from foreach -> scan it
+ YACS::ENGINE::ForEachLoop *fe(findTopForEach());
+ YACS::ENGINE::NodeStateNameMap nsm;
+ unsigned nbB(fe->getNumberOfBranchesCreatedDyn());
+ std::ostringstream oss;
+ for(unsigned j=0;j<nbB;j++)
+ {
+ YACS::ENGINE::Node *nn(fe->getChildByNameExec(FIRST_FE_SUBNODE_NAME,j));
+ YACS::ENGINE::Bloc *nnc(dynamic_cast<YACS::ENGINE::Bloc *>(nn));
+ if(!nnc)
+ throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure : internal error 1 ! The direct son of main foreach is expected to be a Bloc !");
+ if(nnc->getState()==YACS::DONE)
+ continue;
+ std::list< YACS::ENGINE::ElementaryNode *> fec(nnc->getRecursiveConstituents());
+ for(std::list< YACS::ENGINE::ElementaryNode *>::reverse_iterator it=fec.rbegin();it!=fec.rend();it++)
+ {
+ YACS::StatesForNode st0((*it)->getState());
+ if(st0!=YACS::DONE)
+ {
+ oss << "NODE = " << nnc->getChildName(*it) << std::endl;
+ oss << "STATUS = " << nsm[st0] << std::endl;
+ oss << "BRANCH ID = " << j << std::endl;
+ std::list<YACS::ENGINE::InputPort *> inps((*it)->getSetOfInputPort());
+ for(std::list<YACS::ENGINE::InputPort *>::const_iterator it=inps.begin();it!=inps.end();it++)
+ {
+ std::string d((*it)->getHumanRepr());
+ if(d.size()>10000)
+ d=d.substr(0,MAX_LGTH_OF_INP_DUMP);
+ oss << "INPUT \"" << (*it)->getName() << "\" = " << d << std::endl;
+ }
+ oss << "DETAILS = " << std::endl;
+ oss << (*it)->getErrorDetails();
+ }
+ }
+ }
+ return oss.str();
+}
+
std::string YACSEvalYFXRunOnlyPattern::getStatusOfRunStr() const
{
YACS::StatesForNode st(_generatedGraph->getState());
}
getStatusOfRunStr();// To check that the status is recognized.
std::list<YACS::ENGINE::Node *> lns(_generatedGraph->edGetDirectDescendants());
- YACS::ENGINE::ForEachLoop *fe(0);
- for(std::list<YACS::ENGINE::Node *>::const_iterator it=lns.begin();it!=lns.end();it++)
- {
- fe=dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it);
- if(fe)
- break;
- }
- if(!fe)
- throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure : internal error 2 ! ForEach is not accessible !");
+ YACS::ENGINE::ForEachLoop *fe(findTopForEach());
//
YACS::ENGINE::Executor exe;
std::vector<YACS::ENGINE::SequenceAny *> outputs;
}
}
+YACS::ENGINE::ForEachLoop *YACSEvalYFXRunOnlyPattern::findTopForEach() const
+{
+ std::list<YACS::ENGINE::Node *> lns(_generatedGraph->edGetDirectDescendants());
+ YACS::ENGINE::ForEachLoop *fe(0);
+ for(std::list<YACS::ENGINE::Node *>::const_iterator it=lns.begin();it!=lns.end();it++)
+ {
+ fe=dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it);
+ if(fe)
+ break;
+ }
+ if(!fe)
+ throw YACS::Exception("YACSEvalYFXRunOnlyPattern::findTopForEach : internal error 2 ! ForEach is not accessible !");
+ return fe;
+}
virtual bool isLocked() const = 0;
virtual YACSEvalListOfResources *giveResources() = 0;
virtual YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const = 0;
+ virtual std::string getErrorDetailsInCaseOfFailure() const = 0;
virtual std::string getStatusOfRunStr() const = 0;
virtual std::vector<YACSEvalSeqAny *> getResults() const = 0;
virtual std::vector<YACSEvalSeqAny *> getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const = 0;
static const char ST_OK[]; // execution goes to the end without any trouble -> results can be exploited without any problem with getResults and getResultsInCaseOfFailure.
static const char ST_FAILED[]; // execution has reached some failed evaluation (normal errors due to incapacity of one node to evaluate) -> results can be exploited without any problem with getResultsInCaseOfFailure
static const char ST_ERROR[]; // execution has encountered hard errors (SIGSEGV in a server, internal error in YACS) -> results can be exploited with getResultsInCaseOfFailure but you can't make hypothesis for other ids not in passedIds.
+ static const std::size_t MAX_LGTH_OF_INP_DUMP;
};
class YACSEvalYFXRunOnlyPattern : public YACSEvalYFXPattern
bool isLocked() const;
YACSEvalListOfResources *giveResources();
YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const;
+ std::string getErrorDetailsInCaseOfFailure() const;
std::string getStatusOfRunStr() const;
std::vector<YACSEvalSeqAny *> getResults() const;
std::vector<YACSEvalSeqAny *> getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const;
private:
void buildInputPorts();
void buildOutputPorts();
+ YACS::ENGINE::ForEachLoop *findTopForEach() const;
private:
YACS::ENGINE::ComposedNode *_runNode;
std::vector<YACSEvalOutputPort *> _outputsOfInterest;
bool isLocked() const;
YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const;
YACSEvalListOfResources *giveResources();
+ std::string getErrorDetailsInCaseOfFailure() const;
std::string getStatusOfRunStr() const;
void setParallelizeStatus(bool newVal);
bool getParallelizeStatus() const;
for f,g in zip(c,[0.3333333333333333,0.5,1.0,-1.0,-0.5]):
assert(abs(f-g)<1e-12)
pass
-
+st=efx.getErrorDetailsInCaseOfFailure()
+assert("NODE = toto.PyScript0" in st)
+assert("float division by zero" in st)
return ret;
}
+std::string InputPyPort::getHumanRepr()
+{
+ if(!_data)
+ return dump();
+ PyObject *ret(PyObject_Str(_data));
+ if(!ret)
+ return dump();
+ std::string retCpp;
+ char *val(PyString_AsString(ret));
+ if(val)
+ retCpp=val;
+ Py_XDECREF(ret);
+ return retCpp;
+}
+
bool InputPyPort::isEmpty()
{
return _data == Py_None;
virtual PyObj * getPyObj() const;
virtual std::string getAsString();
void *get() const throw(Exception);
+ virtual std::string getHumanRepr();
virtual bool isEmpty();
virtual void exSaveInit();
virtual void exRestoreInit();