1 // Copyright (C) 2012-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #include "YACSEvalYFXPattern.hxx"
22 #include "YACSEvalResource.hxx"
23 #include "YACSEvalSeqAny.hxx"
24 #include "YACSEvalSession.hxx"
25 #include "YACSEvalObserver.hxx"
26 #include "YACSEvalSessionInternal.hxx"
27 #include "YACSEvalAutoPtr.hxx"
28 #include "YACSEvalExecParams.hxx"
30 #include "ElementaryNode.hxx"
31 #include "RuntimeSALOME.hxx"
32 #include "Dispatcher.hxx"
33 #include "Executor.hxx"
34 #include "InputPort.hxx"
35 #include "LinkInfo.hxx"
36 #include "TypeCode.hxx"
38 #include "Dispatcher.hxx"
40 #include "PythonPorts.hxx"
41 #include "ForEachLoop.hxx"
42 #include "PythonNode.hxx"
43 #include "InlineNode.hxx"
44 #include "ServiceNode.hxx"
45 #include "PyStdout.hxx"
46 #include "AutoGIL.hxx"
48 #include "ResourcesManager.hxx"
59 const char YACSEvalYFXPattern::ST_OK[]="ALL_OK";
61 const char YACSEvalYFXPattern::ST_FAILED[]="SOME_SAMPLES_FAILED_AND_ALL_OF_THEM_FAILED_DETERMINISTICALLY";
63 const char YACSEvalYFXPattern::ST_ERROR[]="SOME_SAMPLES_FAILED_BUT_IMPOSSIBLE_TO_CONCLUDE_ON_THEM";
65 const std::size_t YACSEvalYFXPattern::MAX_LGTH_OF_INP_DUMP=10000;
67 const char YACSEvalYFXGraphGen::DFT_PROC_NAME[]="YFX";
69 const char YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME[]="Bloc";
71 const char YACSEvalYFXGraphGen::GATHER_NODE_NAME[]="__gather__";
73 class MyAutoThreadSaver
76 MyAutoThreadSaver(bool isToSave):_isToSave(isToSave),_save(0)
80 PyThreadState *save(PyThreadState_Swap(NULL));// safe call of PyEval_SaveThread()
88 ~MyAutoThreadSaver() { if(_isToSave) if(_save) { PyEval_AcquireLock(); PyThreadState_Swap(_save); /*safe call of PyEval_RestoreThread*/ } }
94 std::vector< YACSEvalInputPort *> YACSEvalYFXPattern::getFreeInputPorts() const
96 std::size_t sz(_inputs.size());
97 std::vector< YACSEvalInputPort *> ret;
98 std::vector< YACSEvalInputPort >::const_iterator it(_inputs.begin());
99 for(std::size_t i=0;i<sz;i++,it++)
100 ret.push_back(const_cast<YACSEvalInputPort *>(&(*it)));
104 std::vector< YACSEvalOutputPort *> YACSEvalYFXPattern::getFreeOutputPorts() const
106 std::size_t sz(_outputs.size());
107 std::vector< YACSEvalOutputPort *> ret;
108 std::vector< YACSEvalOutputPort >::const_iterator it(_outputs.begin());
109 for(std::size_t i=0;i<sz;i++,it++)
110 ret.push_back(const_cast<YACSEvalOutputPort *>(&(*it)));
114 YACSEvalYFXPattern *YACSEvalYFXPattern::FindPatternFrom(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme)
117 throw YACS::Exception("YACSEvalYFXPattern::FindPatternFrom : input scheme must be not null !");
119 YACS::ENGINE::ComposedNode *zeRunNode(0);
120 bool isMatchingRunOnlyPattern(YACSEvalYFXRunOnlyPattern::IsMatching(scheme,zeRunNode));
121 if(isMatchingRunOnlyPattern)
122 return new YACSEvalYFXRunOnlyPattern(boss,scheme,ownScheme,zeRunNode);
124 throw YACS::Exception("YACSEvalYFXPattern::FindPatternFrom : no pattern found for the input scheme !");
127 bool YACSEvalYFXPattern::isAlreadyComputedResources() const
132 void YACSEvalYFXPattern::checkNonAlreadyComputedResources() const
134 if(isAlreadyComputedResources())
135 throw YACS::Exception("checkNonAlreadyComputedResources : instance of computed resources already computed !");
138 void YACSEvalYFXPattern::checkAlreadyComputedResources() const
140 if(!isAlreadyComputedResources())
141 throw YACS::Exception("checkAlreadyComputedResources : instance of computed resources not already computed !");
144 void YACSEvalYFXPattern::checkLocked() const
147 throw YACS::Exception("YACSEvalYFXPattern::checkLocked : Pattern is not locked !");
150 void YACSEvalYFXPattern::checkNonLocked() const
153 throw YACS::Exception("YACSEvalYFXPattern::checkNonLocked : Pattern is locked !");
156 void YACSEvalYFXPattern::CheckNodeIsOK(YACS::ENGINE::ComposedNode *node)
158 /*YACS::ENGINE::LinkInfo info(YACS::ENGINE::LinkInfo::WARN_ONLY_DONT_STOP);
161 node->checkConsistency(info);
163 catch(YACS::Exception& e)
166 if(info.getNumberOfErrLinks(YACS::ENGINE::E_ALL)!=0)
167 throw YACS::Exception("YACSEvalYFXPattern::CheckNodeIsOK : found node is not OK !");
168 std::list<YACS::ENGINE::ElementaryNode *> allNodes(node->getRecursiveConstituents());
169 for(std::list<YACS::ENGINE::ElementaryNode *>::const_iterator it=allNodes.begin();it!=allNodes.end();it++)
171 YACS::ENGINE::ServiceNode *node0(dynamic_cast<YACS::ENGINE::ServiceNode *>(*it));
172 YACS::ENGINE::InlineNode *node1(dynamic_cast<YACS::ENGINE::InlineNode *>(*it));
175 YACS::ENGINE::Container *cont(node0->getContainer());
176 YACS::ENGINE::ComponentInstance *comp(node0->getComponent());
179 std::ostringstream oss; oss << "YACSEvalYFXPattern::CheckNodeIsOK : ServiceNode called \"" << node0->getName() << "\" is not correctly defined !";
180 throw YACS::Exception(oss.str());
185 YACS::ENGINE::Container *cont(node1->getContainer());
186 if(!cont && node1->getExecutionMode()==YACS::ENGINE::InlineNode::REMOTE_STR)
188 std::ostringstream oss; oss << "YACSEvalYFXPattern::CheckNodeIsOK : InlineNode called \"" << node1->getName() << "\" is not correctly defined !";
189 throw YACS::Exception(oss.str());
195 void YACSEvalYFXPattern::registerObserver(YACSEvalObserver *observer)
197 if(_observer==observer)
200 _observer->decrRef();
203 _observer->incrRef();
206 YACSEvalYFXPattern::YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme):_boss(boss),_scheme(scheme),_ownScheme(ownScheme),_parallelizeStatus(true),_rm(new ResourcesManager_cpp),_res(0),_observer(0)
210 YACS::ENGINE::TypeCode *YACSEvalYFXPattern::CreateSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType)
212 std::ostringstream oss; oss << "list[" << zeType << "]";
213 YACS::ENGINE::TypeCode *tc(scheme->getTypeCode(zeType));
214 return scheme->createSequenceTc(oss.str(),oss.str(),tc);
217 void YACSEvalYFXPattern::setResources(YACSEvalListOfResources *res)
219 checkNonAlreadyComputedResources();
225 void YACSEvalYFXPattern::resetResources()
231 YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueInPort(YACS::ENGINE::InputPyPort *port)
234 throw YACS::Exception("YACSEvalYFXPattern::GetValueInPort : null input port !");
235 PyObject *obj(port->getPyObj());
236 YACS::ENGINE::TypeCode *tc(port->edGetType());
237 YACS::ENGINE::TypeCodeSeq *tcc(dynamic_cast<YACS::ENGINE::TypeCodeSeq *>(tc));
240 std::ostringstream oss; oss << "YACSEvalYFXPattern::GetValueInPort : internal error for tc of input \"" << port->getName() << "\"";
241 throw YACS::Exception(oss.str());
243 const YACS::ENGINE::TypeCode *tcct(tcc->contentType());
244 if(!PyList_Check(obj))
245 throw YACS::Exception("YACSEvalYFXPattern::GetValueInPort : internal error 2 !");
246 std::size_t sz(PyList_Size(obj));
247 if(tcct->kind()==YACS::ENGINE::Double)
249 std::vector<double> eltCpp(sz);
250 for(std::size_t i=0;i<sz;i++)
252 PyObject *elt(PyList_GetItem(obj,i));
253 eltCpp[i]=PyFloat_AsDouble(elt);
255 YACS::AutoCppPtr<YACSEvalSeqAnyDouble> elt(new YACSEvalSeqAnyDouble(eltCpp));
256 return elt.dettach();
258 else if(tcct->kind()==YACS::ENGINE::Int)
260 std::vector<int> eltCpp(sz);
261 for(std::size_t i=0;i<sz;i++)
263 PyObject *elt(PyList_GetItem(obj,i));
264 eltCpp[i]=PyLong_AsLong(elt);
266 YACS::AutoCppPtr<YACSEvalSeqAnyInt> elt(new YACSEvalSeqAnyInt(eltCpp));
267 return elt.dettach();
270 throw YACS::Exception("YACSEvalYFXPattern::GetValueInPort : not implemented yet for other than Double and Int !");
273 YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueFromEngineFrmt(YACS::ENGINE::SequenceAny *data)
275 unsigned int sz(data->size());
276 std::vector<double> eltCpp(sz);
277 for(unsigned int ii=0;ii<sz;ii++)
279 YACS::ENGINE::AnyPtr elt((*data)[ii]);
280 YACS::ENGINE::Any *eltPtr((YACS::ENGINE::Any *)elt);
281 YACS::ENGINE::AtomAny *eltPtr2(dynamic_cast<YACS::ENGINE::AtomAny *>(eltPtr));
284 std::ostringstream oss; oss << "YACSEvalYFXPattern::BuildValueFromEngineFrmt : error at pos #" << ii << " ! It is not an AtomAny !";
285 throw YACS::Exception(oss.str());
287 eltCpp[ii]=eltPtr2->getDoubleValue();
289 return new YACSEvalSeqAnyDouble(eltCpp);
292 void YACSEvalYFXPattern::cleanScheme()
299 YACSEvalYFXPattern::~YACSEvalYFXPattern()
302 _observer->decrRef();
307 /////////////////////
309 class YACSEvalYFXRunOnlyPatternInternalObserver : public YACS::ENGINE::Observer
312 YACSEvalYFXRunOnlyPatternInternalObserver(YACSEvalYFXRunOnlyPattern *boss):_boss(boss) { if(!_boss) throw YACS::Exception("YACSEvalYFXRunOnlyPatternInternalObserver constructor : null boss not supported :)"); }
313 void notifyObserver2(YACS::ENGINE::Node *object, const std::string& event, void *something);
315 YACSEvalYFXRunOnlyPattern *_boss;
318 void YACSEvalYFXRunOnlyPatternInternalObserver::notifyObserver2(YACS::ENGINE::Node *object, const std::string& event, void *something)
320 YACS::ENGINE::ForEachLoop *object2(_boss->getUndergroundForEach());
321 YACSEvalObserver *obs(_boss->getObserver());
324 if(event=="progress_ok" && object2==object)
326 int *casted(reinterpret_cast<int *>(something));
327 obs->notifySampleOK(_boss->getBoss(),*casted);
330 if(event=="progress_ko" && object2==object)
332 int *casted(reinterpret_cast<int *>(something));
333 obs->notifySampleKO(_boss->getBoss(),*casted);
338 /////////////////////
340 YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode):YACSEvalYFXPattern(boss,scheme,ownScheme),_lockedStatus(false),_runNode(runNode),_gen(0),_obs(new YACSEvalYFXRunOnlyPatternInternalObserver(this))
343 throw YACS::Exception("YACSEvalYFXRunOnlyPattern : internal run node must be not null !");
348 YACSEvalYFXRunOnlyPattern::~YACSEvalYFXRunOnlyPattern()
354 void YACSEvalYFXRunOnlyPattern::setOutPortsOfInterestForEvaluation(const std::vector<YACSEvalOutputPort *>& outputsOfInterest)
357 _outputsOfInterest=outputsOfInterest;
361 void YACSEvalYFXRunOnlyPattern::resetOutputsOfInterest()
364 _outputsOfInterest.clear();
368 void YACSEvalYFXRunOnlyPattern::generateGraph()
371 if(getResourcesInternal()->isInteractive())
372 _gen=new YACSEvalYFXGraphGenInteractive(this);
374 _gen=new YACSEvalYFXGraphGenCluster(this);
375 _gen->generateGraph();
378 void YACSEvalYFXRunOnlyPattern::resetGeneratedGraph()
381 _gen->resetGeneratedGraph();
384 int YACSEvalYFXRunOnlyPattern::assignNbOfBranches()
386 checkAlreadyComputedResources();
388 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : generator is NULL ! Please invoke generateGraph before !");
389 return _gen->assignNbOfBranches();
392 void YACSEvalYFXRunOnlyPattern::assignRandomVarsInputs()
394 std::size_t sz(std::numeric_limits<std::size_t>::max());
395 for(std::vector< YACSEvalInputPort >::const_iterator it=_inputs.begin();it!=_inputs.end();it++)
396 if((*it).isRandomVar())
398 std::size_t locSize((*it).initializeUndergroundWithSeq());
399 if(sz==std::numeric_limits<std::size_t>::max())
403 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignRandomVarsInputs : length of sequences in random vars must be the same !");
407 bool YACSEvalYFXRunOnlyPattern::isLocked() const
409 return _lockedStatus;
412 YACSEvalListOfResources *YACSEvalYFXRunOnlyPattern::giveResources()
415 if(!isAlreadyComputedResources())
417 YACS::ENGINE::DeploymentTree dt(_runNode->getDeploymentTree());
418 _runNode->removeRecursivelyRedundantCL();
419 YACSEvalListOfResources *res(new YACSEvalListOfResources(_runNode->getMaxLevelOfParallelism(),getCatalogInAppli(),dt));
422 return getResourcesInternal();
425 YACS::ENGINE::Proc *YACSEvalYFXRunOnlyPattern::getUndergroundGeneratedGraph() const
427 return getGenerator()->getUndergroundGeneratedGraph();
430 std::string YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure() const
432 std::string generatorErrors = getGenerator()->getErrors();
433 if(generatorErrors.size() > 0)
435 return generatorErrors;
437 std::string st(getStatusOfRunStr());//test if a run has occurred.
439 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure : The execution of scheme has been carried out to the end without any problem !");
440 // All the problem can only comes from foreach -> scan it
441 YACS::ENGINE::ForEachLoop *fe(getUndergroundForEach());
442 YACS::ENGINE::NodeStateNameMap nsm;
443 unsigned nbB(fe->getNumberOfBranchesCreatedDyn());
444 std::ostringstream oss;
445 for(unsigned j=0;j<nbB;j++)
447 YACS::ENGINE::Node *nn(fe->getChildByNameExec(YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME,j));
448 YACS::ENGINE::Bloc *nnc(dynamic_cast<YACS::ENGINE::Bloc *>(nn));
450 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure : internal error 1 ! The direct son of main foreach is expected to be a Bloc !");
451 if(nnc->getState()==YACS::DONE)
453 std::list< YACS::ENGINE::ElementaryNode *> fec(nnc->getRecursiveConstituents());
454 for(std::list< YACS::ENGINE::ElementaryNode *>::reverse_iterator it1=fec.rbegin();it1!=fec.rend();it1++)
456 YACS::StatesForNode st0((*it1)->getState());
459 oss << "NODE = " << nnc->getChildName(*it1) << std::endl;
460 oss << "STATUS = " << nsm[st0] << std::endl;
461 oss << "BRANCH ID = " << j << std::endl;
462 std::list<YACS::ENGINE::InputPort *> inps((*it1)->getSetOfInputPort());
463 for(std::list<YACS::ENGINE::InputPort *>::const_iterator it2=inps.begin();it2!=inps.end();it2++)
465 std::string d((*it2)->getHumanRepr());
467 d=d.substr(0,MAX_LGTH_OF_INP_DUMP);
468 oss << "INPUT \"" << (*it2)->getName() << "\" = " << d << std::endl;
470 oss << "DETAILS = " << std::endl;
471 oss << (*it1)->getErrorDetails();
478 std::string YACSEvalYFXRunOnlyPattern::getStatusOfRunStr() const
480 YACS::StatesForNode st(getUndergroundGeneratedGraph()->getState());
486 case YACS::TOACTIVATE:
487 case YACS::ACTIVATED:
488 case YACS::SUSPENDED:
491 case YACS::DESACTIVATED:
493 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getStatusOfRunStr : Unexpected state \"" << YACS::ENGINE::Node::getStateName(st) << "\" ! Did you invoke run ?";
494 throw YACS::Exception(oss.str());
496 case YACS::LOADFAILED:
497 case YACS::EXECFAILED:
499 case YACS::INTERNALERR:
500 return std::string(ST_ERROR);
502 return std::string(ST_FAILED);
504 return std::string(ST_OK);
507 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getStatusOfRunStr : unrecognized and managed state \"" << YACS::ENGINE::Node::getStateName(st) << "\" !";
508 throw YACS::Exception(oss.str());
513 std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResults() const
515 return _gen->getResults();
519 * This method works if run succeeded (true return) and also if graph has failed. Graph failed means soft error of evaluation due to error in evaluation (example 1/0 or a normal throw from one node)
520 * If a more serious error occured (SIGSEGV of a server or internal error in YACS engine, cluster error, loose of connection...) this method will throw an exception to warn the caller that the results may be
522 std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const
524 YACS::StatesForNode st(getUndergroundGeneratedGraph()->getState());
528 std::vector<YACSEvalSeqAny *> ret(getResults());
532 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure : internal error ! The returned vector has a null pointer at pos #0 !");
533 std::size_t sz(ret[0]->size());
534 passedIds.resize(sz);
535 for(std::size_t i=0;i<sz;i++)
540 getStatusOfRunStr();// To check that the status is recognized.
541 std::list<YACS::ENGINE::Node *> lns(getUndergroundGeneratedGraph()->edGetDirectDescendants());
542 YACS::ENGINE::ForEachLoop *fe(getUndergroundForEach());
544 YACS::ENGINE::Executor exe;
545 std::vector<YACS::ENGINE::SequenceAny *> outputs;
546 std::vector<std::string> nameOfOutputs;
547 passedIds=fe->getPassedResults(&exe,outputs,nameOfOutputs);//<- the key invokation is here.
548 std::size_t sz(passedIds.size()),ii(0);
549 std::vector<YACSEvalSeqAny *> ret(_outputsOfInterest.size());
550 for(std::vector<YACSEvalOutputPort *>::const_iterator it1=_outputsOfInterest.begin();it1!=_outputsOfInterest.end();it1++,ii++)
552 YACS::ENGINE::OutputPort *p((*it1)->getUndergroundPtr());
553 std::string st(_runNode->getOutPortName(p));
554 std::ostringstream oss; oss << YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME << '.' << _runNode->getName() << '.' << st;
556 YACS::ENGINE::ForEachLoop::InterceptorizeNameOfPort(st);
557 std::vector<std::string>::iterator it2(std::find(nameOfOutputs.begin(),nameOfOutputs.end(),st));
558 if(it2==nameOfOutputs.end())
560 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure : internal error 3 ! Unable to locate interceptor with name " << st << " ! Possibilities are : ";
561 std::copy(nameOfOutputs.begin(),nameOfOutputs.end(),std::ostream_iterator<std::string>(oss," "));
563 throw YACS::Exception(oss.str());
565 std::size_t pos(std::distance(nameOfOutputs.begin(),it2));
566 ret[ii]=BuildValueFromEngineFrmt(outputs[pos]);
571 void YACSEvalYFXRunOnlyPattern::emitStart() const
573 YACSEvalObserver *obs(getObserver());
576 obs->startComputation(getBoss());
579 bool YACSEvalYFXRunOnlyPattern::go(const YACSEvalExecParams& params, YACSEvalSession *session) const
582 YACS::ENGINE::Dispatcher *disp(YACS::ENGINE::Dispatcher::getDispatcher());
583 disp->addObserver(_obs,getUndergroundForEach(),"progress_ok");
584 disp->addObserver(_obs,getUndergroundForEach(),"progress_ko");
585 bool ret(getGenerator()->go(params,session));
586 disp->removeObserver(_obs,getUndergroundForEach(),"progress_ok");
587 disp->removeObserver(_obs,getUndergroundForEach(),"progress_ko");
591 YACS::ENGINE::ForEachLoop *YACSEvalYFXRunOnlyPattern::getUndergroundForEach() const
593 return getGenerator()->getUndergroundForEach();
596 bool YACSEvalYFXRunOnlyPattern::IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode)
598 std::list<YACS::ENGINE::Node *> nodes(scheme->getChildren());
601 bool areAllElementary(true);
602 for(std::list<YACS::ENGINE::Node *>::const_iterator it=nodes.begin();it!=nodes.end() && areAllElementary;it++)
603 if(!dynamic_cast<YACS::ENGINE::ElementaryNode *>(*it))
604 areAllElementary=false;
608 CheckNodeIsOK(scheme);
614 YACS::ENGINE::ComposedNode *candidate(dynamic_cast<YACS::ENGINE::ComposedNode *>(nodes.front()));
617 CheckNodeIsOK(candidate);
621 void YACSEvalYFXRunOnlyPattern::buildInputPorts()
624 std::list< YACS::ENGINE::InputPort *> allInputPorts(_runNode->getSetOfInputPort());
625 std::vector<std::string> allNames;
626 for(std::list< YACS::ENGINE::InputPort *>::const_iterator it=allInputPorts.begin();it!=allInputPorts.end();it++)
628 YACS::ENGINE::InputPort *elt(*it);
630 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildInputPorts : presence of null input !");
631 std::set<YACS::ENGINE::OutPort *> bls(elt->edSetOutPort());
634 if(YACSEvalPort::IsInputPortPublishable(elt))
636 std::string inpName(elt->getName());
638 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildInputPorts : an input has empty name ! Should not !");
639 _inputs.push_back(YACSEvalInputPort(elt));
640 if(std::find(allNames.begin(),allNames.end(),inpName)!=allNames.end())
642 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::buildInputPorts : input name \"" << inpName << "\" appears more than once !";
643 throw YACS::Exception(oss.str());
645 allNames.push_back(inpName);
651 void YACSEvalYFXRunOnlyPattern::buildOutputPorts()
654 std::list< YACS::ENGINE::OutputPort *> allOutputPorts(_runNode->getSetOfOutputPort());
655 std::vector<std::string> allNames;
656 for(std::list< YACS::ENGINE::OutputPort *>::const_iterator it=allOutputPorts.begin();it!=allOutputPorts.end();it++)
658 YACS::ENGINE::OutputPort *elt(*it);
659 if(YACSEvalPort::IsOutputPortPublishable(elt))
662 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : presence of null output !");
663 std::string outpName(elt->getName());
665 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : an output has empty name ! Should not !");
666 if(std::find(allNames.begin(),allNames.end(),outpName)!=allNames.end())
668 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::buildOutputPorts : output name \"" << outpName << "\" appears more than once !";
669 throw YACS::Exception(oss.str());
671 _outputs.push_back(YACSEvalOutputPort(*it));
676 YACSEvalYFXGraphGen *YACSEvalYFXRunOnlyPattern::getGenerator() const
679 throw YACS::Exception("getGenerator : generator is NULL !");
683 /////////////////////
685 YACSEvalYFXGraphGen::YACSEvalYFXGraphGen(YACSEvalYFXRunOnlyPattern *boss):_boss(boss),_generatedGraph(0),_FEInGeneratedGraph(0)
688 throw YACS::Exception("YACSEvalYFXGraphGen constructor : boss is NULL !");
691 YACSEvalYFXGraphGen::~YACSEvalYFXGraphGen()
693 //delete _generatedGraph;// -> TODO : AGY why ?
696 void YACSEvalYFXGraphGen::resetGeneratedGraph()
698 delete _generatedGraph;
699 _generatedGraph=0; _FEInGeneratedGraph=0;
702 bool YACSEvalYFXGraphGen::isLocked() const
704 return _generatedGraph!=0;
707 int YACSEvalYFXGraphGen::assignNbOfBranches()
710 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : the generated graph has not been created !");
711 std::list<YACS::ENGINE::Node *> nodes(_generatedGraph->getChildren());
712 YACS::ENGINE::ForEachLoop *zeMainNode(0);
713 for(std::list<YACS::ENGINE::Node *>::const_iterator it=nodes.begin();it!=nodes.end();it++)
715 YACS::ENGINE::ForEachLoop *isZeMainNode(dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it));
719 zeMainNode=isZeMainNode;
721 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 1 !");
725 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 2 !");
726 unsigned int nbProcsDeclared(getBoss()->getResourcesInternal()->getNumberOfProcsDeclared());
727 nbProcsDeclared=std::max(nbProcsDeclared,4u);
729 if(getBoss()->getParallelizeStatus())
731 nbOfBranch=(nbProcsDeclared/getBoss()->getResourcesInternal()->getMaxLevelOfParallelism());
732 nbOfBranch=std::max(nbOfBranch,1);
734 YACS::ENGINE::InputPort *zeInputToSet(zeMainNode->edGetNbOfBranchesPort());
735 YACS::ENGINE::AnyInputPort *zeInputToSetC(dynamic_cast<YACS::ENGINE::AnyInputPort *>(zeInputToSet));
737 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 3 !");
738 YACS::ENGINE::Any *a(YACS::ENGINE::AtomAny::New(nbOfBranch));
739 zeInputToSetC->put(a);
740 zeInputToSetC->exSaveInit();
745 void YACSEvalYFXGraphGenInteractive::generateGraph()
748 { delete _generatedGraph; _generatedGraph=0; _FEInGeneratedGraph=0; }
749 static const char LISTPYOBJ_STR[]="list[pyobj]";
750 if(getBoss()->getOutputsOfInterest().empty())
752 YACS::ENGINE::RuntimeSALOME::setRuntime();
753 YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
754 _generatedGraph=r->createProc(DFT_PROC_NAME);
755 YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
756 std::ostringstream oss; oss << "Loop_" << getBoss()->getRunNode()->getName();
757 _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
758 _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
760 YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
761 _generatedGraph->edAddChild(n0);
762 YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
763 YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
764 std::ostringstream var0;
765 const std::vector< YACSEvalInputPort >& inputs(getBoss()->getInputs());
766 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
768 if((*it).isRandomVar())
770 var0 << (*it).getName() << ",";
771 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
772 YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
773 YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
775 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
776 (*it).setUndergroundPortToBeSet(inpc);
779 std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
780 n0->setScript(n0Script.str());
782 YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
783 _FEInGeneratedGraph=n1;
784 _generatedGraph->edAddChild(n1);
785 _generatedGraph->edAddCFLink(n0,n1);
786 _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
787 YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
788 _generatedGraph->edAddChild(n2);
789 _generatedGraph->edAddCFLink(n1,n2);
791 YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
793 YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
794 YACS::ENGINE::ComposedNode *runNode(getBoss()->getRunNode());
795 YACS::ENGINE::Node *n101(runNode->cloneWithoutCompAndContDeepCpy(0,true));
796 n10->edAddChild(n100);
797 n10->edAddChild(n101);
798 YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
799 n10->edAddCFLink(n100,n101);
800 n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
801 std::ostringstream var1;
802 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
804 if((*it).isRandomVar())
806 var1 << (*it).getName() << ",";
807 YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
808 std::string tmpPortName(runNode->getInPortName((*it).getUndergroundPtr()));
809 YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
810 n10->edAddDFLink(myOut,myIn);
813 std::ostringstream n100Script; n100Script << var1.str() << "=i0\n";
814 n100->setScript(n100Script.str());
815 const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
816 for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++)
818 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
819 YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
820 std::string tmpPortName(runNode->getOutPortName((*it)->getUndergroundPtr()));
821 YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
822 _generatedGraph->edAddDFLink(myOut,myIn);
824 _generatedGraph->updateContainersAndComponents();
827 bool YACSEvalYFXGraphGenInteractive::go(const YACSEvalExecParams& params, YACSEvalSession *session) const
829 YACS::ENGINE::Executor exe;
830 exe.setKeepGoingProperty(!params.getStopASAPAfterErrorStatus());
832 MyAutoThreadSaver locker(!session->isAlreadyPyThreadSaved());
833 exe.RunW(getUndergroundGeneratedGraph());
835 return getUndergroundGeneratedGraph()->getState()==YACS::DONE;
838 std::string YACSEvalYFXGraphGenInteractive::getErrors()const
843 std::vector<YACSEvalSeqAny *> YACSEvalYFXGraphGenInteractive::getResults() const
845 if(getUndergroundGeneratedGraph()->getState()!=YACS::DONE)
846 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : the execution did not finished correctly ! getResults should not be called !");
847 const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
848 std::vector<YACSEvalSeqAny *> ret(outputsOfInt.size());
849 YACS::ENGINE::Node *node(getUndergroundGeneratedGraph()->getChildByName(YACSEvalYFXGraphGen::GATHER_NODE_NAME));
850 YACS::ENGINE::PythonNode *nodeC(dynamic_cast<YACS::ENGINE::PythonNode *>(node));
852 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : internal error !");
854 for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++,ii++)
856 YACS::ENGINE::InPort *input(nodeC->getInPort((*it)->getName()));
857 YACS::ENGINE::InputPyPort *inputC(dynamic_cast<YACS::ENGINE::InputPyPort *>(input));
860 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getResults : internal error for input \"" << (*it)->getName() << "\"";
861 throw YACS::Exception(oss.str());
863 ret[ii]=YACSEvalYFXPattern::BuildValueInPort(inputC);
870 void YACSEvalYFXGraphGenCluster::generateGraph()
872 YACS::ENGINE::AutoGIL agil;
874 { delete _generatedGraph; _generatedGraph=0; _FEInGeneratedGraph=0; }
876 const char EFXGenFileName[]="EFXGenFileName";
877 const char EFXGenContent[]="import getpass,datetime,os\nn=datetime.datetime.now()\nreturn os.path.join(os.path.sep,\"tmp\",\"EvalYFX_%s_%s_%s.xml\"%(getpass.getuser(),n.strftime(\"%d%m%y\"),n.strftime(\"%H%M%S\")))";
878 const char EFXGenContent2[]="import getpass,datetime\nn=datetime.datetime.now()\nreturn \"EvalYFX_%s_%s_%s\"%(getpass.getuser(),n.strftime(\"%d%m%y\"),n.strftime(\"%H%M%S\"))";
880 YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent));
881 YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
882 _locSchemaFile=PyBytes_AsString(val);
883 func=YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent2);
884 val=YACS::ENGINE::evalFuncPyWithNoParams(func);
885 _jobName=PyBytes_AsString(val);
887 static const char LISTPYOBJ_STR[]="list[pyobj]";
888 if(getBoss()->getOutputsOfInterest().empty())
890 YACS::ENGINE::RuntimeSALOME::setRuntime();
891 YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
892 _generatedGraph=r->createProc(DFT_PROC_NAME);
893 YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
894 std::ostringstream oss; oss << "Loop_" << getBoss()->getRunNode()->getName();
895 _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
896 _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
898 YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
899 _generatedGraph->edAddChild(n0);
900 YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
901 YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
902 std::ostringstream var0;
903 const std::vector< YACSEvalInputPort >& inputs(getBoss()->getInputs());
904 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
906 if((*it).isRandomVar())
908 var0 << (*it).getName() << ",";
909 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
910 YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
911 YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
913 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
914 (*it).setUndergroundPortToBeSet(inpc);
917 std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
918 n0->setScript(n0Script.str());
920 YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
921 _FEInGeneratedGraph=n1;
922 _generatedGraph->edAddChild(n1);
923 _generatedGraph->edAddCFLink(n0,n1);
924 _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
925 YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
926 _generatedGraph->edAddChild(n2);
927 _generatedGraph->edAddCFLink(n1,n2);
929 YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
931 YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
932 YACS::ENGINE::ComposedNode *runNode(getBoss()->getRunNode());
933 YACS::ENGINE::Node *n101(runNode->cloneWithoutCompAndContDeepCpy(0,true));
934 n10->edAddChild(n100);
935 n10->edAddChild(n101);
936 YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
937 n10->edAddCFLink(n100,n101);
938 n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
939 std::ostringstream var1;
940 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
942 if((*it).isRandomVar())
944 var1 << (*it).getName() << ",";
945 YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
946 std::string tmpPortName(runNode->getInPortName((*it).getUndergroundPtr()));
947 YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
948 n10->edAddDFLink(myOut,myIn);
951 std::ostringstream n100Script; n100Script << var1.str() << "=i0\n";
952 n100->setScript(n100Script.str());
953 const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
954 std::ostringstream n2Script; n2Script << "zeRes=[";
955 for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++)
957 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
958 YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
959 n2Script << (*it)->getName() << ", ";
960 std::string tmpPortName(runNode->getOutPortName((*it)->getUndergroundPtr()));
961 YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
962 _generatedGraph->edAddDFLink(myOut,myIn);
964 n2Script << "]\nf=file(\"" << _jobName << "\",\"w\") ; f.write(str(zeRes)) ; del f";
965 n2->setScript(n2Script.str());
966 _generatedGraph->updateContainersAndComponents();
969 bool YACSEvalYFXGraphGenCluster::go(const YACSEvalExecParams& params, YACSEvalSession *session) const
971 YACS::ENGINE::AutoGIL agil;
973 getUndergroundGeneratedGraph()->saveSchema(_locSchemaFile);
974 YACSEvalListOfResources *rss(getBoss()->getResourcesInternal());
975 const YACSEvalParamsForCluster& cli(rss->getAddParamsForCluster());
976 std::vector<std::string> machines(rss->getAllChosenMachines());
977 if(machines.size()!=1)
978 throw YACS::Exception("YACSEvalYFXGraphGenCluster::go : internal error ! In batch mode and not exactly one machine !");
979 Engines::SalomeLauncher_var sl(session->getInternal()->goFetchingSalomeLauncherInNS());
980 Engines::ResourceParameters rr;
981 rr.name=CORBA::string_dup(machines[0].c_str());
982 rr.hostname=CORBA::string_dup("");
983 rr.can_launch_batch_jobs=true;
984 rr.can_run_containers=true;
985 rr.OS=CORBA::string_dup("Linux");
986 rr.componentList.length(0);
987 rr.nb_proc=rss->getNumberOfProcsDeclared();// <- important
990 rr.nb_node=1;// useless only nb_proc used.
991 rr.nb_proc_per_node=1;// useless only nb_proc used.
992 rr.policy=CORBA::string_dup("cycl");
993 rr.resList.length(0);
994 Engines::JobParameters jp;
995 jp.job_name=CORBA::string_dup(_jobName.c_str());
996 jp.job_type=CORBA::string_dup("yacs_file");
997 jp.job_file=CORBA::string_dup(_locSchemaFile.c_str());
998 jp.env_file=CORBA::string_dup("");
999 jp.in_files.length(cli.getInFiles().size());
1000 std::list<std::string>::const_iterator it;
1002 for (it = cli.getInFiles().begin(), i=0 ;
1003 it != cli.getInFiles().end();
1006 jp.in_files[i] = CORBA::string_dup((*it).c_str());
1008 jp.out_files.length(1);
1009 jp.out_files[0]=CORBA::string_dup(_jobName.c_str());
1010 jp.work_directory=CORBA::string_dup(cli.getRemoteWorkingDir().c_str());
1011 jp.local_directory=CORBA::string_dup(cli.getLocalWorkingDir().c_str());
1012 jp.result_directory=CORBA::string_dup(cli.getLocalWorkingDir().c_str());
1013 jp.maximum_duration=CORBA::string_dup(cli.getMaxDuration().c_str());
1014 jp.resource_required=rr;
1015 jp.queue=CORBA::string_dup("");
1017 jp.mem_per_cpu=rr.mem_mb;
1018 jp.wckey=CORBA::string_dup(cli.getWCKey().c_str());
1019 jp.extra_params=CORBA::string_dup("");
1020 jp.specific_parameters.length(0);
1021 jp.launcher_file=CORBA::string_dup("");
1022 jp.launcher_args=CORBA::string_dup("");
1023 _jobid=sl->createJob(jp);
1026 sl->launchJob(_jobid);
1028 catch (const SALOME::SALOME_Exception & ex)
1030 _errors = ex.details.text.in();
1033 catch (const CORBA::SystemException& ex)
1035 _errors = "Receive CORBA SystemException.";
1042 PyRun_SimpleString("import time ; time.sleep(10)");
1043 char *state(sl->getJobState(_jobid));//"CREATED", "IN_PROCESS", "QUEUED", "RUNNING", "PAUSED", "FINISHED" or "FAILED"
1044 std::string sstate(state);
1045 CORBA::string_free(state);
1046 if(sstate=="FINISHED" || sstate=="FAILED")
1048 ret=sstate=="FINISHED";
1052 sl->getJobResults(_jobid,cli.getLocalWorkingDir().c_str());
1056 std::ostringstream oss; oss << "import os" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"" << _jobName << "\")" << std::endl;
1057 oss << "if not os.path.exists(p):\n return None\n";
1058 oss << "f=file(p,\"r\")" << std::endl;
1059 oss << "return eval(f.read())";
1060 std::string zeInput(oss.str());
1061 YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy("fetch",zeInput));
1062 YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
1063 if(!PyList_Check(val))
1064 throw YACS::Exception("Fetched file does not contain a list !");
1065 Py_ssize_t sz(PyList_Size(val));
1067 for(Py_ssize_t i=0;i<sz;i++)
1069 std::vector<double>& res0(_res[i]);
1070 PyObject *elt0(PyList_GetItem(val,i));
1071 if(!PyList_Check(elt0))
1072 throw YACS::Exception("Fetched file does contain a list of list !");
1073 Py_ssize_t sz0(PyList_Size(elt0)); res0.resize(sz0);
1074 for(Py_ssize_t j=0;j<sz0;j++)
1076 PyObject *elt1(PyList_GetItem(elt0,j));
1077 res0[j]=PyFloat_AsDouble(elt1);
1081 std::ostringstream oss1; oss1 << "import os" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"" << _jobName << "\") ; os.remove(p)" << std::endl;
1082 std::string s1(oss1.str());
1083 PyRun_SimpleString(s1.c_str());
1084 if(!params.getFetchRemoteDirForClusterStatus())
1086 std::ostringstream oss2; oss2 << "import os,shutil" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"logs\") ; shutil.rmtree(p)" << std::endl;
1087 std::string s2(oss2.str());
1088 PyRun_SimpleString(s2.c_str());
1091 catch(YACS::Exception& e)
1100 std::string YACSEvalYFXGraphGenCluster::getErrors()const
1105 std::vector<YACSEvalSeqAny *> YACSEvalYFXGraphGenCluster::getResults() const
1107 std::size_t sz(_res.size());
1108 std::vector<YACSEvalSeqAny *> ret(sz);
1109 for(std::size_t i=0;i<sz;i++)
1111 YACS::AutoCppPtr<YACSEvalSeqAnyDouble> elt(new YACSEvalSeqAnyDouble(_res[i]));
1112 ret[i]=elt.dettach();