Salome HOME
Merge branch 'V7_dev'
authorvsr <vsr@opencascade.com>
Thu, 24 Mar 2016 13:36:33 +0000 (16:36 +0300)
committervsr <vsr@opencascade.com>
Fri, 25 Mar 2016 06:10:48 +0000 (09:10 +0300)
39 files changed:
CMakeLists.txt
adm/cmake/SalomeSetupPlatform.cmake [changed mode: 0755->0644]
doc/execxml.rst
src/CTestTestfileInstall.cmake
src/engine/ElementaryNode.cxx
src/engine/Executor.cxx
src/engine/Proc.cxx
src/evalyfx/CMakeLists.txt
src/evalyfx/YACSEvalResource.cxx
src/evalyfx/YACSEvalResource.hxx
src/evalyfx/YACSEvalSession.cxx
src/evalyfx/YACSEvalSession.hxx
src/evalyfx/YACSEvalSessionInternal.cxx [new file with mode: 0644]
src/evalyfx/YACSEvalSessionInternal.hxx [new file with mode: 0644]
src/evalyfx/YACSEvalYFX.cxx
src/evalyfx/YACSEvalYFXPattern.cxx
src/evalyfx/YACSEvalYFXPattern.hxx
src/evalyfx_swig/evalyfx.i
src/evalyfx_swig/test1.py
src/evalyfx_swig/test2.py
src/evalyfx_swig/test3.py [new file with mode: 0644]
src/genericgui/CMakeLists.txt
src/pmml/Test/CMakeLists.txt
src/pmml/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/pmml/pmml_swig/CMakeLists.txt
src/pmml/pmml_swig/PMMLBasicsTestLauncher.py [new file with mode: 0755]
src/runtime/AutoGIL.hxx
src/runtime/PyStdout.cxx
src/runtime/PyStdout.hxx
src/runtime/PythonNode.cxx
src/salomegui/CMakeLists.txt
src/salomewrap/CMakeLists.txt
src/yacsloader/Test/CTestTestfileInstall.cmake
src/yacsloader/Test/YacsLoaderTest.sh.in
src/yacsloader/driver.cxx
src/yacsloader/pmml/CMakeLists.txt
src/yacsloader/pmml/PmmlExeTest.sh.in
src/yacsloader_swig/Test/StdAloneYacsLoaderTest1.py
src/yacsloader_swig/Test/YacsLoaderTest.sh.in

index b1b30978b08abbe2a4640c14fdfefa2196cc5d36..68603fd0a8a46f2eb42da62633b28bf514181c95 100644 (file)
@@ -29,8 +29,8 @@ CMAKE_POLICY(SET CMP0003 NEW)
 # Project name, upper case
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
-SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 7)
+SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
@@ -160,8 +160,12 @@ ENDIF()
 IF(SALOME_BUILD_GUI)
   # Graphviz
   FIND_PACKAGE(SalomeGraphviz  REQUIRED)
-  # Qt4
-  FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
+  # Qt
+  IF(NOT SALOME_GUI_BUILD_WITH_QT5)
+    FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
+  ELSE()
+    FIND_PACKAGE(SalomeQt5 REQUIRED)
+  ENDIF()
 ENDIF(SALOME_BUILD_GUI)
 
 ##
@@ -310,18 +314,26 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
 #      Ensure the variables are always defined for the configure:
 SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
-SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}")
+IF(NOT SALOME_GUI_BUILD_WITH_QT5)
+  SET(QT_ROOT_DIR "${QT4_ROOT_DIR}")
+ELSE()
+  SET(QT_ROOT_DIR "${QT5_ROOT_DIR}")
+ENDIF()
  
 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
 
 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(Qt4)
+IF(NOT SALOME_GUI_BUILD_WITH_QT5)
+  SALOME_CONFIGURE_PREPARE(Qt4)
+ELSE()
+  SALOME_CONFIGURE_PREPARE(Qt5)
+ENDIF()
 
 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in 
     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
-    KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR)
+    KERNEL_ROOT_DIR GUI_ROOT_DIR QT_ROOT_DIR)
 
 #   - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
 #       Get the relative path of the include directory so 
@@ -331,7 +343,7 @@ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
 #    ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
 #    INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
 #    PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX 
-#    KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR)
+#    KERNEL_ROOT_DIR GUI_ROOT_DIR QT_ROOT_DIR)
 
 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
     VERSION ${${PROJECT_NAME_UC}_VERSION}
old mode 100755 (executable)
new mode 100644 (file)
index 0dd0d2b..ebff56e
@@ -166,9 +166,6 @@ IF(NOT WIN32)
   ENDIF()
 ENDIF()
 
-IF(NOT DEFINED NO_CXX11_SUPPORT)
-  SET(NO_CXX11_SUPPORT ON)
-ENDIF()
 IF(NOT NO_CXX11_SUPPORT)
   # C++11 support
   INCLUDE(CheckCXXCompilerFlag)
index cddd6e2ba32355b3091320154328365bf6a8438b..fc0a0855c4d3b70e974d0b38e13e58fcf0467636 100644 (file)
@@ -30,6 +30,8 @@ The YACS supervisor in console (driver) mode accepts a few options to set parame
     -e, --dump-on-error[=file] Stop on first error and dump state
     -f, --dump-final[=file]    dump final state
     -g, --dump[=nbsec]         dump state
+    -i, --init_port[=value]    Initialisation value of a port, specified as
+                               bloc.node.port=value.
     -k, --kill-port=port       Kill Salome application running on the specified
                                port if the driver process is killed (with SIGINT
                                or SIGTERM)
@@ -97,6 +99,20 @@ Execute a scheme and save the state of execution every 30 seconds
 
   driver -g30 -fmystate.xml schema.xml
 
+Change the values of some input ports before execution
+----------------------------------------------------------------------
+::
+
+  driver -imynode.i=5 -imynode.d=.7 -imynode.b=False -imynode.s=lili schema.xml
+
+In this example, the ports "i", "d", "b" and "s" of the node "mynode" are initialized and the schema is launched.
+
+Only the ports of the following types can be initialized this way:
+
+ - int
+ - double
+ - bool
+ - string
 
 How to manage several SALOME sessions
 ----------------------------------------------------------------------
index 40e032f2b43a3d58444db12c6200fc6302e24d5f..71e7e4c8b7f725bde7362914c06d57ef24fc277d 100644 (file)
@@ -30,6 +30,7 @@ SUBDIRS(
     bases
     engine
     runtime
+    pmml
     yacsloader
     yacsloader_swig
     )
index fb82250481f5dc94367b5da3feedefac2f88205a..129deaa1d701bbbc0466d8e007ea257854cb7697 100644 (file)
@@ -92,17 +92,17 @@ void ElementaryNode::initCommonPartWithoutStateManagement(bool start)
   for(list<InputPort *>::iterator iter2=_setOfInputPort.begin();iter2!=_setOfInputPort.end();iter2++)
     (*iter2)->exInit(start);
   _inGate.exReset();
-  if(_state == YACS::DISABLED)
-    {
-      exDisabledState(); // to refresh propagation of DISABLED state
-      return;
-    }
 }
 
 void ElementaryNode::init(bool start)
 {
   DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state);
   initCommonPartWithoutStateManagement(start);
+  if(_state == YACS::DISABLED)
+    {
+      exDisabledState(); // to refresh propagation of DISABLED state
+      return ;
+    }
   setState(YACS::READY);
 }
 
index 8095fe24b870cbd3779e8cc663e1c5fe619dde30..d559230355590a8c16f1147376c84106424800ab 100644 (file)
@@ -72,8 +72,8 @@ using YACS::BASES::Semaphore;
 //#define _DEVDEBUG_
 #include "YacsTrace.hxx"
 
-int Executor::_maxThreads(50);
-size_t Executor::_threadStackSize(1048576); // Default thread stack size is 1MB
+int Executor::_maxThreads(1000);
+size_t Executor::_threadStackSize(262144); // Default thread stack size is 256 kB == 2**18 because threads launched by YACS are lightweight
 
 Executor::Executor():_nbOfConcurrentThreads(0), _semForMaxThreads(_maxThreads),_keepGoingOnFail(false),_DPLScopeSensitive(false)
 {
index c0055d13875f5c39fbea4670e0e12278c3adb9b3..111e25f2efe7d3415d5b5e72af925935ec4cf74f 100644 (file)
@@ -300,18 +300,29 @@ std::string Proc::setInPortValue(std::string nodeName, std::string portName, std
               double val = atof(value.c_str());
               inputPort->edInit(val);
             }
+            break;
           case Int:
             {
               int val = atoi(value.c_str());
               inputPort->edInit(val);
             }
+            break;
           case String:
             inputPort->edInit(value.c_str());
+            break;
           case Bool:
             {
-              bool val = (! value.compare("False") ) && (! value.compare("0") );
-              inputPort->edInit(val);
+              if((!value.compare("False")) || (!value.compare("false")))
+                inputPort->edInit(false);
+              else if ((!value.compare("True")) || (!value.compare("true")))
+                inputPort->edInit(true);
+              else
+              {
+                int val = atoi(value.c_str());
+                inputPort->edInit(val);
+              }
             }
+            break;
           default:
             DEBTRACE("Proc::setInPortValue: filtered type: " << inputPort->edGetType()->kind());
         }
index 928aaaa8f3a932c3425927318a3c9af403dff501..98494643803a5439851265512f9953ac1e3e97e2 100644 (file)
@@ -68,6 +68,7 @@ SET(YACSEvalYFX_HEADERS
   YACSEvalSeqAny.hxx
   YACSEvalResource.hxx
   YACSEvalSession.hxx
+  YACSEvalSessionInternal.hxx
   YACSEvalObserver.hxx
   YACSEvalExecParams.hxx
   )
@@ -79,6 +80,7 @@ SET(YACSevalYFX_SOURCES
   YACSEvalSeqAny.cxx
   YACSEvalResource.cxx
   YACSEvalSession.cxx
+  YACSEvalSessionInternal.cxx
   YACSEvalObserver.cxx
   )
 
index 393df6a3d9b7fae93ffeaa11db37672a148575c8..a3132d0d26eed9d15415d99d556996c0fd9c615f 100644 (file)
@@ -73,6 +73,12 @@ void YACSEvalNonConstLocker::checkNonLocked() const
     throw YACS::Exception("YACSEvalNonConstLocker::checkNonLocked : this is locked and trying to invoke non-const method !");
 }
 
+void YACSEvalNonConstLocker::checkLocked() const
+{
+  if(!_isLocked)
+    throw YACS::Exception("YACSEvalNonConstLocker::checkLocked : this is NOT locked whereas it should be !");
+}
+
 YACSEvalVirtualYACSContainer::YACSEvalVirtualYACSContainer():_gf(0),_cont(0)
 {
 }
@@ -86,7 +92,8 @@ void YACSEvalVirtualYACSContainer::set(YACSEvalResource *gf, YACS::ENGINE::Conta
   if(_cont)
     _cont->decrRef();
   _cont=cont;
-  _cont->incrRef();
+  if(_cont)
+    _cont->incrRef();
   _propertyMap=listOfPropertiesInYACSContainer();
 }
 
@@ -172,11 +179,14 @@ std::vector<std::string> YACSEvalVirtualYACSContainer::listOfPropertyKeys() cons
 
 std::string YACSEvalVirtualYACSContainer::getValueOfKey(const char *key) const
 {
+  std::string skey(key);
+  if(skey==HOSTNAME_KEY)
+    return _chosenHost;
   std::map<std::string,std::string>::const_iterator it;
-  it=_overloadedPropertyMap.find(key);
+  it=_overloadedPropertyMap.find(skey);
   if(it!=_overloadedPropertyMap.end())
     return (*it).second;
-  it=_propertyMap.find(key);
+  it=_propertyMap.find(skey);
   if(it!=_propertyMap.end())
     return (*it).second;
   return std::string();
@@ -185,25 +195,31 @@ std::string YACSEvalVirtualYACSContainer::getValueOfKey(const char *key) const
 void YACSEvalVirtualYACSContainer::setProperty(const std::string& key, const std::string &value)
 {
   checkNonLocked();
-  _overloadedPropertyMap[key]=value;
+  if(key==HOSTNAME_KEY)
+    setWantedMachine(value);
+  else
+    _overloadedPropertyMap[key]=value;
 }
 
-void YACSEvalVirtualYACSContainer::apply()
+void YACSEvalVirtualYACSContainer::apply(bool interactiveStatus)
 {
   YACS::ENGINE::SalomeContainer *cont0(dynamic_cast<YACS::ENGINE::SalomeContainer *>(_cont));
   YACS::ENGINE::SalomeHPContainer *cont1(dynamic_cast<YACS::ENGINE::SalomeHPContainer *>(_cont));
-  if(cont0)
-    {
-      cont0->setProperty(HOSTNAME_KEY,getValueOfKey(HOSTNAME_KEY));
-      return ;
-    }
-  else if(cont1)
-    {
-      cont1->setProperty(HOSTNAME_KEY,getValueOfKey(HOSTNAME_KEY));
-      return ;
-    }
-  else
+  if(!cont0 && !cont1)
     throw YACS::Exception("YACSEvalVirtualYACSContainer::apply : unrecognized container !");
+  if(interactiveStatus)
+    _cont->setProperty(HOSTNAME_KEY,getValueOfKey(HOSTNAME_KEY));
+  else
+    {// in cluster mode no hostname and policy set to cycl by default
+      _cont->setProperty(HOSTNAME_KEY,std::string());
+      _cont->setProperty("policy","cycl");
+    }
+}
+
+std::string YACSEvalVirtualYACSContainer::getName() const
+{
+  checkNotNullYACSContainer();
+  return _cont->getName();
 }
 
 unsigned int YACSEvalVirtualYACSContainer::getValueOfKeyUInt(const char *key) const
@@ -229,6 +245,12 @@ std::map<std::string,std::string> YACSEvalVirtualYACSContainer::listOfProperties
   return props;
 }
 
+void YACSEvalVirtualYACSContainer::checkNotNullYACSContainer() const
+{
+  if(!_cont)
+    throw YACS::Exception("YACSEvalVirtualYACSContainer::checkNotNullYACSContainer : internal YACS container is NULL !");
+}
+
 YACSEvalResource::~YACSEvalResource()
 {
 }
@@ -266,10 +288,10 @@ YACSEvalVirtualYACSContainer *YACSEvalResource::at(std::size_t i) const
   return const_cast<YACSEvalVirtualYACSContainer *>(&_containers[i]);
 }
 
-void YACSEvalResource::apply()
+void YACSEvalResource::apply(bool interactiveStatus)
 {
   for(std::vector< YACSEvalVirtualYACSContainer >::iterator it=_containers.begin();it!=_containers.end();it++)
-    (*it).apply();
+    (*it).apply(interactiveStatus);
 }
 
 void YACSEvalResource::fitWithCurrentCatalogAbs()
@@ -305,6 +327,24 @@ YACSEvalResource::YACSEvalResource(YACSEvalListOfResources *gf, const std::vecto
     _containers[i].set(this,conts[i]);
 }
 
+void YACSEvalParamsForCluster::setExclusiveness(bool newStatus)
+{
+  if(newStatus)
+    throw YACS::Exception("YACSEvalParamsForCluster::setExclusiveness : exclusive mode set to true is not implemented yet !");
+}
+
+void YACSEvalParamsForCluster::checkConsistency() const
+{
+  if(_remoteWorkingDir.empty())
+    throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : remote work dir is not set !");
+  if(_localWorkingDir.empty())
+    throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : local work dir is not set !");
+  if(_wcKey.empty())
+    throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : WC key is not set !");
+  if(_nbOfProcs==0)
+    throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : nb procs must be != 0 !");
+}
+
 YACSEvalListOfResources::YACSEvalListOfResources(int maxLevOfPara, ResourcesManager_cpp *rm, const YACS::ENGINE::DeploymentTree& dt):_maxLevOfPara(maxLevOfPara),_rm(rm),_dt(new YACS::ENGINE::DeploymentTree(dt))
 {
   std::vector<YACS::ENGINE::Container *> conts(_dt->getAllContainers());
@@ -380,7 +420,7 @@ bool YACSEvalListOfResources::isInteractive() const
           throw YACS::Exception(oss.str());
         }
       const ParserResourcesType& elt((*it2).second);
-      status[ii]=(elt.ClusterInternalProtocol==sh || elt.ClusterInternalProtocol==rsh || elt.ClusterInternalProtocol==ssh);
+      status[ii]=(elt.Batch==none);
     }
   std::size_t trueRet(std::count(status.begin(),status.end(),true)),falseRet(std::count(status.begin(),status.end(),false));
   if(trueRet==sz && falseRet==0)
@@ -392,17 +432,29 @@ bool YACSEvalListOfResources::isInteractive() const
 
 unsigned int YACSEvalListOfResources::getNumberOfProcsDeclared() const
 {
-  std::vector<std::string> chosen(getAllChosenMachines());
-  unsigned int ret(0);
-  for(std::vector<std::string>::const_iterator it=chosen.begin();it!=chosen.end();it++)
-    ret+=getNumberOfProcOfResource(*it);
-  return ret;
+  if(isInteractive())
+    {
+      std::vector<std::string> chosen(getAllChosenMachines());
+      unsigned int ret(0);
+      for(std::vector<std::string>::const_iterator it=chosen.begin();it!=chosen.end();it++)
+        ret+=getNumberOfProcOfResource(*it);
+      return ret;
+    }
+  else
+    return _paramsInCaseOfCluster.getNbProcs();
+}
+
+void YACSEvalListOfResources::checkOKForRun() const
+{
+  if(!isInteractive())
+    _paramsInCaseOfCluster.checkConsistency();
 }
 
 void YACSEvalListOfResources::apply()
 {
+  bool interactiveSt(isInteractive());
   for(std::vector<YACSEvalResource *>::iterator it=_resources.begin();it!=_resources.end();it++)
-    (*it)->apply();
+    (*it)->apply(interactiveSt);
 }
 
 YACSEvalListOfResources::~YACSEvalListOfResources()
@@ -554,23 +606,59 @@ void YACSEvalListOfResources::notifyWantedMachine(YACSEvalVirtualYACSContainer *
     throw YACS::Exception("YACSEvalListOfResources::notifyWantedMachine : internal error !");
   const ParserResourcesType& oldPRT((*itOld).second);
   const ParserResourcesType& newPRT((*itNew).second);
-  if(oldPRT.ClusterInternalProtocol==newPRT.ClusterInternalProtocol)
+  bool oldISt(oldPRT.Batch==none),newISt(newPRT.Batch==none);//interactive status
+  if(oldISt==newISt)
     return ;
   // the batch/interactive mode has changed -> try to change for all.
   std::queue<std::string> sts;
   try
   {
-      for(std::vector<YACSEvalResource *>::const_iterator it=_resources.begin();it!=_resources.end();it++)
-        {
-          std::size_t sz((*it)->size());
-          for(std::size_t i=0;i<sz;i++)
-            {
-              YACSEvalVirtualYACSContainer *cont((*it)->at(i));
-              if(cont==sender)
-                continue;
-              sts.push(cont->findDefault(newPRT.ClusterInternalProtocol==sh));
-            }
-        }
+    if(newISt)
+      {// switching from interactive to batch -> In batch every YACSEvalVirtualYACSContainer instances in this must lie on newMachine.
+        for(std::vector<YACSEvalResource *>::const_iterator it=_resources.begin();it!=_resources.end();it++)
+          {
+            std::vector<std::string> fms((*it)->getAllFittingMachines());
+            std::vector<std::string>::iterator it0(std::find(fms.begin(),fms.end(),newMachine));
+            if(it0==fms.end())
+              {
+                std::ostringstream oss; oss << "In the context of switch to batch the requested cluster machine \"" << newMachine << "\" is not compatible for following list of containers : " << std::endl;
+                std::size_t sz((*it)->size());
+                for(std::size_t i=0;i<sz;i++)
+                  {
+                    YACSEvalVirtualYACSContainer *cont((*it)->at(i));
+                    if(cont)
+                      oss << " \"" << cont->getName() << "\", ";
+                  }
+                throw YACS::Exception(oss.str());
+              }
+            std::size_t sz((*it)->size());
+            for(std::size_t i=0;i<sz;i++)
+              {
+                std::size_t sz((*it)->size());
+                for(std::size_t i=0;i<sz;i++)
+                  {
+                    YACSEvalVirtualYACSContainer *cont((*it)->at(i));
+                    if(cont==sender)
+                      continue;
+                    sts.push(newMachine);
+                  }
+              }
+          }
+      }
+    else
+      {
+        for(std::vector<YACSEvalResource *>::const_iterator it=_resources.begin();it!=_resources.end();it++)
+          {
+            std::size_t sz((*it)->size());
+            for(std::size_t i=0;i<sz;i++)
+              {
+                YACSEvalVirtualYACSContainer *cont((*it)->at(i));
+                if(cont==sender)
+                  continue;
+                sts.push(cont->findDefault(false));
+              }
+          }
+      }
   }
   catch(YACS::Exception& e)
   {
@@ -598,7 +686,7 @@ bool YACSEvalListOfResources::hasRightInteractiveStatus(const std::string& machi
   if(it==zeList.end())
     throw YACS::Exception("YACSEvalListOfResources::hasRightInteractiveStatus : internal error !");
   const ParserResourcesType& elt((*it).second);
-  bool myStatus(elt.ClusterInternalProtocol==sh);
+  bool myStatus(elt.Batch==none);
   return myStatus==isInteractive;
 }
 
index dbdd0d0693c0ba5ed490ce93ef33c90de58513ac..0958e1972fac6c3f35f1f0bea0699e44fd47886f 100644 (file)
@@ -48,6 +48,7 @@ public:
   YACSEVALYFX_EXPORT void lock() { _isLocked=true; }
   YACSEVALYFX_EXPORT bool isLocked() const { return _isLocked; }
   YACSEVALYFX_EXPORT void checkNonLocked() const;
+  YACSEVALYFX_EXPORT void checkLocked() const;
 private:
   bool _isLocked;
 };
@@ -66,7 +67,8 @@ public:
   YACSEVALYFX_EXPORT std::string getValueOfKey(const char *key) const;
   YACSEVALYFX_EXPORT void setProperty(const std::string& key, const std::string &value);
   YACSEVALYFX_EXPORT void resetOverloadedProps() { checkNonLocked(); _overloadedPropertyMap.clear(); }
-  void apply();
+  YACSEVALYFX_EXPORT std::string getName() const;
+  void apply(bool interactiveStatus);
 public:
   YACSEvalVirtualYACSContainer();
   void set(YACSEvalResource *gf, YACS::ENGINE::Container *cont);
@@ -81,6 +83,7 @@ private:
   unsigned int getNbProcPerNode() const { return getValueOfKeyUInt(NB_PROC_PER_NODE_KEY); }
   unsigned int getValueOfKeyUInt(const char *key) const;
   std::map<std::string,std::string> listOfPropertiesInYACSContainer() const;
+  void checkNotNullYACSContainer() const;
 public:
   static const char CONTAINER_NAME_KEY[];
   static const char CPU_CLOCK_KEY[];
@@ -112,7 +115,7 @@ public:
   YACSEVALYFX_EXPORT void setWantedMachine(const std::string& machine);
   YACSEVALYFX_EXPORT std::size_t size() const { return _containers.size(); }
   YACSEVALYFX_EXPORT YACSEvalVirtualYACSContainer *at(std::size_t i) const;
-  YACSEVALYFX_EXPORT void apply();
+  YACSEVALYFX_EXPORT void apply(bool interactiveStatus);
 public:
   void fitWithCurrentCatalogAbs();
   void aggregate(ParserResourcesType& entry) const;
@@ -128,6 +131,32 @@ protected:
 
 class ResourcesManager_cpp;
 
+class YACSEvalParamsForCluster
+{
+public:
+  YACSEvalParamsForCluster():_exclusiveness(false),_nbOfProcs(1) { }
+  bool getExclusiveness() const { return _exclusiveness; }
+  void setExclusiveness(bool newStatus);
+  std::string getRemoteWorkingDir() const { return _remoteWorkingDir; }
+  void setRemoteWorkingDir(const std::string& remoteWorkingDir) { _remoteWorkingDir=remoteWorkingDir; }
+  std::string getLocalWorkingDir() const { return _localWorkingDir; }
+  void setLocalWorkingDir(const std::string& localWorkingDir) { _localWorkingDir=localWorkingDir; }
+  std::string getWCKey() const { return _wcKey; }
+  void setWCKey(const std::string& wcKey) { _wcKey=wcKey; }
+  unsigned int getNbProcs() const { return _nbOfProcs; }
+  void setNbProcs(unsigned int nbProcs) { _nbOfProcs=nbProcs; }
+  void setMaxDuration(const std::string& maxDuration) { _maxDuration=maxDuration; }
+  std::string getMaxDuration() const { return _maxDuration; }
+  void checkConsistency() const;
+private:
+  bool _exclusiveness;
+  std::string _remoteWorkingDir;
+  std::string _localWorkingDir;
+  std::string _wcKey;
+  std::string _maxDuration;
+  unsigned int _nbOfProcs;
+};
+
 class YACSEvalListOfResources : public YACSEvalNonConstLocker
 {
 public:
@@ -139,6 +168,9 @@ public:
   YACSEVALYFX_EXPORT YACSEvalResource *at(std::size_t i) const;
   YACSEVALYFX_EXPORT bool isInteractive() const;
   YACSEVALYFX_EXPORT unsigned int getNumberOfProcsDeclared() const;
+  YACSEVALYFX_EXPORT void checkOKForRun() const;
+  YACSEVALYFX_EXPORT YACSEvalParamsForCluster& getAddParamsForCluster() { return _paramsInCaseOfCluster; }
+  YACSEVALYFX_EXPORT const YACSEvalParamsForCluster& getAddParamsForCluster() const { return _paramsInCaseOfCluster; }
   void apply();
   YACSEVALYFX_EXPORT ~YACSEvalListOfResources();
 public:
@@ -156,6 +188,7 @@ private:
   int _maxLevOfPara;
   std::vector<YACSEvalResource *> _resources;
   YACS::ENGINE::DeploymentTree *_dt;
+  YACSEvalParamsForCluster _paramsInCaseOfCluster;
 };
 
 #endif
index 6f4ca712886b8cf193754c05073f5e9b93c20a93..b4f1e2a5bf0fbc3cdb41084962f8ba2ecbc5d7e8 100644 (file)
@@ -19,6 +19,8 @@
 // Author : Anthony Geay (EDF R&D)
 
 #include "YACSEvalSession.hxx"
+#include "YACSEvalSessionInternal.hxx"
+
 #include "Exception.hxx"
 
 #include <Python.h>
@@ -27,7 +29,7 @@ const char YACSEvalSession::KERNEL_ROOT_DIR[]="KERNEL_ROOT_DIR";
 
 const char YACSEvalSession::CORBA_CONFIG_ENV_VAR_NAME[]="OMNIORB_CONFIG";
 
-YACSEvalSession::YACSEvalSession():_isLaunched(false),_port(-1),_salomeInstanceModule(0),_salomeInstance(0)
+YACSEvalSession::YACSEvalSession():_isLaunched(false),_port(-1),_salomeInstanceModule(0),_salomeInstance(0),_internal(new YACSEvalSessionInternal)
 {
   if(!Py_IsInitialized())
     Py_Initialize();
@@ -37,6 +39,7 @@ YACSEvalSession::YACSEvalSession():_isLaunched(false),_port(-1),_salomeInstanceM
 
 YACSEvalSession::~YACSEvalSession()
 {
+  delete _internal;
   if(isLaunched())
     {
       PyObject *terminateSession(PyObject_GetAttrString(_salomeInstance,const_cast<char *>("stop")));//new
index 8f421fceb1da8407bf048033b44dc645e1173c74..a58c340114943962d6eb66e35bfc8fdd273caa22 100644 (file)
@@ -30,6 +30,8 @@ typedef _object PyObject;
 
 class YACSEvalSession
 {
+public:
+  class YACSEvalSessionInternal;
 public:
   YACSEVALYFX_EXPORT YACSEvalSession();
   YACSEVALYFX_EXPORT ~YACSEvalSession();
@@ -38,6 +40,8 @@ public:
   YACSEVALYFX_EXPORT void checkLaunched() const;
   YACSEVALYFX_EXPORT int getPort() const;
   YACSEVALYFX_EXPORT std::string getCorbaConfigFileName() const;
+public:
+  YACSEvalSessionInternal *getInternal() { checkLaunched(); return _internal; }
 private:
   static std::string GetPathToAdd();
 public:
@@ -49,6 +53,7 @@ private:
   std::string _corbaConfigFileName;
   PyObject *_salomeInstanceModule;
   PyObject *_salomeInstance;
+  YACSEvalSessionInternal *_internal;
 };
 
 #endif
diff --git a/src/evalyfx/YACSEvalSessionInternal.cxx b/src/evalyfx/YACSEvalSessionInternal.cxx
new file mode 100644 (file)
index 0000000..d5bf80b
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2012-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#include "YACSEvalSessionInternal.hxx"
+#include "YACSEvalSession.hxx"
+
+#include "PyStdout.hxx"
+#include "AutoGIL.hxx"
+#include "Exception.hxx"
+
+YACSEvalSession::YACSEvalSessionInternal::YACSEvalSessionInternal():_orb(CORBA::ORB::_nil()),_sl(Engines::SalomeLauncher::_nil())
+{
+}
+
+void YACSEvalSession::YACSEvalSessionInternal::checkSalomeLauncher()
+{
+  if(CORBA::is_nil(_sl))
+    throw YACS::Exception("YACSEvalSessionInternal::checkSalomeLauncher : salome launcher is null !");
+}
+
+Engines::SalomeLauncher_var YACSEvalSession::YACSEvalSessionInternal::goFetchingSalomeLauncherInNS()
+{
+  if(!CORBA::is_nil(_sl))
+    return _sl;
+  int argc(0);
+  _orb=CORBA::ORB_init(argc,0);
+  if(CORBA::is_nil(_orb))
+    throw YACS::Exception("YACSEvalSessionInternal contrctor : ORB is null !");
+  //
+  const char methName[]="goFetchingSalomeLauncherInNS";
+  const char fetchPyCmd[]="import salome,CORBA\nsalome.salome_init()\nsl=salome.naming_service.Resolve(\"/SalomeLauncher\")\nif not CORBA.is_nil(sl):\n  return salome.orb.object_to_string(sl)\nelse:\n  raise Exception(\"Impossible to locate salome launcher !\")";
+  YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(methName,fetchPyCmd));
+  YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
+  std::string ior(PyString_AsString(val));
+  CORBA::Object_var obj(string_to_object(ior));
+  if(CORBA::is_nil(obj))
+    throw YACS::Exception("goFetchingSalomeLauncherInNS : fetched ior is NIL !");
+  _sl=Engines::SalomeLauncher::_narrow(obj);
+  checkSalomeLauncher();
+  return _sl;
+}
+
+Engines::SalomeLauncher_var YACSEvalSession::YACSEvalSessionInternal::getNotNullSL()
+{
+  checkSalomeLauncher();
+  return _sl;
+}
diff --git a/src/evalyfx/YACSEvalSessionInternal.hxx b/src/evalyfx/YACSEvalSessionInternal.hxx
new file mode 100644 (file)
index 0000000..141c682
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2012-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __YACSEVALSESSIONINTERNAL_HXX__
+#define __YACSEVALSESSIONINTERNAL_HXX__
+
+#include "YACSEvalSession.hxx"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOME_Launcher)
+#include "omniORB4/CORBA.h"
+
+#include <string>
+
+class YACSEvalSession::YACSEvalSessionInternal
+{
+public:
+  YACSEvalSessionInternal();
+  CORBA::Object_var string_to_object(const std::string& ior) { return _orb->string_to_object(ior.c_str()); }
+  Engines::SalomeLauncher_var goFetchingSalomeLauncherInNS();
+  Engines::SalomeLauncher_var getNotNullSL();
+private:
+  void checkSalomeLauncher();
+private:
+  CORBA::ORB_var _orb;
+  Engines::SalomeLauncher_var _sl;
+};
+
+#endif
index 537c7303ce7ebd267765890aac8b1d288b5165d7..201bdb65c9491a328b75dc1721eb63393994f124 100644 (file)
 
 #include <Python.h>
 
-class MyAutoThreadSaver
-{
-public:
-  MyAutoThreadSaver():_save(PyEval_SaveThread()) { }
-  ~MyAutoThreadSaver() { PyEval_RestoreThread(_save); }
-private:
-  PyThreadState *_save;
-};
-
 YACSEvalYFX *YACSEvalYFX::BuildFromFile(const std::string& xmlOfScheme)
 {
   YACS::ENGINE::RuntimeSALOME::setRuntime();
@@ -73,7 +64,6 @@ void YACSEvalYFX::lockPortsForEvaluation(const std::vector< YACSEvalInputPort *
 {
   checkPortsForEvaluation(inputsOfInterest,outputsOfInterest);
   _pattern->setOutPortsOfInterestForEvaluation(outputsOfInterest);
-  _pattern->generateGraph();
 }
 
 void YACSEvalYFX::unlockAll()
@@ -97,30 +87,18 @@ YACSEvalListOfResources *YACSEvalYFX::giveResources()
 
 bool YACSEvalYFX::run(YACSEvalSession *session, int& nbOfBranches)
 {
-  _pattern->assignRandomVarsInputs();
-  YACSEvalListOfResources *rss(giveResources());
-  if(!rss->isInteractive())
-    throw YACS::Exception("YACSEvalYFX::run : not implemented yet for non interactive !");
-  YACSEvalSession *mySession(session);
-  YACS::AutoCppPtr<YACSEvalSession> loc;
+  _pattern->generateGraph();
   if(!session)
     {
       throw YACS::Exception("YACSEvalYFX::run : input session in null !");
-      /*loc=new YACSEvalSession;
-      mySession=loc;*/
     }
+  session->launch();
+  YACSEvalListOfResources *rss(giveResources());
+  rss->checkOKForRun();
+  _pattern->assignRandomVarsInputs();
   rss->apply();
   nbOfBranches=_pattern->assignNbOfBranches();
-  mySession->launch();
-  YACS::ENGINE::Executor exe;
-  exe.setKeepGoingProperty(!_params.getStopASAPAfterErrorStatus());
-  //
-  _pattern->emitStart();
-  {
-    MyAutoThreadSaver locker;
-    exe.RunW(getUndergroundGeneratedGraph());
-  }
-  return getUndergroundGeneratedGraph()->getState()==YACS::DONE;
+  return _pattern->go(_params.getStopASAPAfterErrorStatus(),session);
 }
 
 void YACSEvalYFX::registerObserver(YACSEvalObserver *observer)
index 5472bb42772898f3d3c9dcf643e2270ae32553dd..3c00612bf3222eacf19f6cd3090d916a2ba013f6 100644 (file)
@@ -21,7 +21,9 @@
 #include "YACSEvalYFXPattern.hxx"
 #include "YACSEvalResource.hxx"
 #include "YACSEvalSeqAny.hxx"
+#include "YACSEvalSession.hxx"
 #include "YACSEvalObserver.hxx"
+#include "YACSEvalSessionInternal.hxx"
 #include "YACSEvalAutoPtr.hxx"
 
 #include "ElementaryNode.hxx"
@@ -38,6 +40,8 @@
 #include "PythonNode.hxx"
 #include "InlineNode.hxx"
 #include "ServiceNode.hxx"
+#include "PyStdout.hxx"
+#include "AutoGIL.hxx"
 
 #include "ResourcesManager.hxx"
 
@@ -47,7 +51,8 @@
 #include <sstream>
 #include <iterator>
 
-const char YACSEvalYFXPattern::DFT_PROC_NAME[]="YFX";
+////
+#include <stdlib.h>
 
 const char YACSEvalYFXPattern::ST_OK[]="ALL_OK";
 
@@ -57,9 +62,20 @@ const char YACSEvalYFXPattern::ST_ERROR[]="SOME_SAMPLES_FAILED_BUT_IMPOSSIBLE_TO
 
 const std::size_t YACSEvalYFXPattern::MAX_LGTH_OF_INP_DUMP=10000;
 
-const char YACSEvalYFXRunOnlyPattern::FIRST_FE_SUBNODE_NAME[]="Bloc";
+const char YACSEvalYFXGraphGen::DFT_PROC_NAME[]="YFX";
 
-const char YACSEvalYFXRunOnlyPattern::GATHER_NODE_NAME[]="__gather__";
+const char YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME[]="Bloc";
+
+const char YACSEvalYFXGraphGen::GATHER_NODE_NAME[]="__gather__";
+
+class MyAutoThreadSaver
+{
+public:
+  MyAutoThreadSaver():_save(PyEval_SaveThread()) { }
+  ~MyAutoThreadSaver() { PyEval_RestoreThread(_save); }
+private:
+  PyThreadState *_save;
+};
 
 std::vector< YACSEvalInputPort *> YACSEvalYFXPattern::getFreeInputPorts() const
 {
@@ -177,7 +193,7 @@ YACSEvalYFXPattern::YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *sc
 {
 }
 
-YACS::ENGINE::TypeCode *YACSEvalYFXPattern::createSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType)
+YACS::ENGINE::TypeCode *YACSEvalYFXPattern::CreateSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType)
 {
   std::ostringstream oss; oss << "list[" << zeType << "]";
   YACS::ENGINE::TypeCode *tc(scheme->getTypeCode(zeType));
@@ -299,7 +315,7 @@ void YACSEvalYFXRunOnlyPatternInternalObserver::notifyObserver(YACS::ENGINE::Nod
 
 /////////////////////
 
-YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode):YACSEvalYFXPattern(boss,scheme,ownScheme),_runNode(runNode),_generatedGraph(0),_FEInGeneratedGraph(0),_obs(new YACSEvalYFXRunOnlyPatternInternalObserver(this))
+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))
 {
   if(!_runNode)
     throw YACS::Exception("YACSEvalYFXRunOnlyPattern : internal run node must be not null !");
@@ -310,141 +326,45 @@ YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACSEvalYFX *boss, YACS::EN
 YACSEvalYFXRunOnlyPattern::~YACSEvalYFXRunOnlyPattern()
 {
   delete _obs;
+  delete _gen;
 }
 
 void YACSEvalYFXRunOnlyPattern::setOutPortsOfInterestForEvaluation(const std::vector<YACSEvalOutputPort *>& outputsOfInterest)
 {
   checkNonLocked();
   _outputsOfInterest=outputsOfInterest;
+  _lockedStatus=true;
 }
 
 void YACSEvalYFXRunOnlyPattern::resetOutputsOfInterest()
 {
   checkLocked();
   _outputsOfInterest.clear();
+  _lockedStatus=false;
 }
 
 void YACSEvalYFXRunOnlyPattern::generateGraph()
 {
-  static const char LISTPYOBJ_STR[]="list[pyobj]";
-  if(_outputsOfInterest.empty())
-    return ;
-  YACS::ENGINE::RuntimeSALOME::setRuntime();
-  YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
-  _generatedGraph=r->createProc(DFT_PROC_NAME);
-  YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
-  std::ostringstream oss; oss << "Loop_" << _runNode->getName();
-  _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
-  _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
-  //
-  YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
-  _generatedGraph->edAddChild(n0);
-  YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
-  YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
-  std::ostringstream var0;
-  for(std::vector< YACSEvalInputPort >::const_iterator it=_inputs.begin();it!=_inputs.end();it++)
-    {
-      if((*it).isRandomVar())
-        {
-          var0 << (*it).getName() << ",";
-          YACS::ENGINE::TypeCode *tc(createSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
-          YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
-          YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
-          if(!inpc)
-            throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
-          (*it).setUndergroundPortToBeSet(inpc);
-        }
-    }
-  std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
-  n0->setScript(n0Script.str());
-  //
-  YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
-  _FEInGeneratedGraph=n1;
-  _generatedGraph->edAddChild(n1);
-  _generatedGraph->edAddCFLink(n0,n1);
-  _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
-  YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
-  _generatedGraph->edAddChild(n2);
-  _generatedGraph->edAddCFLink(n1,n2);
-  //
-  YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
-  n1->edAddChild(n10);
-  YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
-  YACS::ENGINE::Node *n101(_runNode->cloneWithoutCompAndContDeepCpy(0,true));
-  n10->edAddChild(n100);
-  n10->edAddChild(n101);
-  YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
-  n10->edAddCFLink(n100,n101);
-  n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
-  std::ostringstream var1;
-  for(std::vector< YACSEvalInputPort >::const_iterator it=_inputs.begin();it!=_inputs.end();it++)
-    {
-      if((*it).isRandomVar())
-        {
-          var1 << (*it).getName() << ",";
-          YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
-          std::string tmpPortName(_runNode->getInPortName((*it).getUndergroundPtr()));
-          YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
-          n10->edAddDFLink(myOut,myIn);
-        }
-    }
-  std::ostringstream n100Script;  n100Script << var1.str() << "=i0\n";
-  n100->setScript(n100Script.str());
-  for(std::vector< YACSEvalOutputPort * >::const_iterator it=_outputsOfInterest.begin();it!=_outputsOfInterest.end();it++)
-    {
-      YACS::ENGINE::TypeCode *tc(createSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
-      YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
-      std::string tmpPortName(_runNode->getOutPortName((*it)->getUndergroundPtr()));
-      YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
-      _generatedGraph->edAddDFLink(myOut,myIn);
-    }
-  _generatedGraph->updateContainersAndComponents();
+  delete _gen;
+  if(getResourcesInternal()->isInteractive())
+    _gen=new YACSEvalYFXGraphGenInteractive(this);
+  else
+    _gen=new YACSEvalYFXGraphGenCluster(this);
+  _gen->generateGraph();
 }
 
 void YACSEvalYFXRunOnlyPattern::resetGeneratedGraph()
 {
-  delete _generatedGraph;
-  _generatedGraph=0;
-  resetResources();
+  if(_gen)
+    _gen->resetGeneratedGraph();
 }
 
 int YACSEvalYFXRunOnlyPattern::assignNbOfBranches()
 {
   checkAlreadyComputedResources();
-  if(!_generatedGraph)
-    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : the generated graph has not been created !");
-  std::list<YACS::ENGINE::Node *> nodes(_generatedGraph->getChildren());
-  YACS::ENGINE::ForEachLoop *zeMainNode(0);
-  for(std::list<YACS::ENGINE::Node *>::const_iterator it=nodes.begin();it!=nodes.end();it++)
-    {
-      YACS::ENGINE::ForEachLoop *isZeMainNode(dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it));
-      if(isZeMainNode)
-        {
-          if(!zeMainNode)
-            zeMainNode=isZeMainNode;
-          else
-            throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : internal error 1 !");
-        }
-    }
-  if(!zeMainNode)
-    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : internal error 2 !");
-  unsigned int nbProcsDeclared(getResourcesInternal()->getNumberOfProcsDeclared());
-  nbProcsDeclared=std::max(nbProcsDeclared,4u);
-  int nbOfBranch=1;
-  if(getParallelizeStatus())
-    {
-      nbOfBranch=(nbProcsDeclared/getResourcesInternal()->getMaxLevelOfParallelism());
-      nbOfBranch=std::max(nbOfBranch,1);
-    }
-  YACS::ENGINE::InputPort *zeInputToSet(zeMainNode->edGetNbOfBranchesPort());
-  YACS::ENGINE::AnyInputPort *zeInputToSetC(dynamic_cast<YACS::ENGINE::AnyInputPort *>(zeInputToSet));
-  if(!zeInputToSetC)
-    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : internal error 3 !");
-  YACS::ENGINE::Any *a(YACS::ENGINE::AtomAny::New(nbOfBranch));
-  zeInputToSetC->put(a);
-  zeInputToSetC->exSaveInit();
-  a->decrRef();
-  return nbOfBranch;
+  if(!_gen)
+    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : generator is NULL ! Please invoke generateGraph before !");
+  return _gen->assignNbOfBranches();
 }
 
 void YACSEvalYFXRunOnlyPattern::assignRandomVarsInputs()
@@ -464,7 +384,7 @@ void YACSEvalYFXRunOnlyPattern::assignRandomVarsInputs()
 
 bool YACSEvalYFXRunOnlyPattern::isLocked() const
 {
-  return _generatedGraph!=0;
+  return _lockedStatus;
 }
 
 YACSEvalListOfResources *YACSEvalYFXRunOnlyPattern::giveResources()
@@ -482,7 +402,7 @@ YACSEvalListOfResources *YACSEvalYFXRunOnlyPattern::giveResources()
 
 YACS::ENGINE::Proc *YACSEvalYFXRunOnlyPattern::getUndergroundGeneratedGraph() const
 {
-  return _generatedGraph;
+  return getGenerator()->getUndergroundGeneratedGraph();
 }
 
 std::string YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure() const
@@ -491,13 +411,13 @@ std::string YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure() const
   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::ForEachLoop *fe(getUndergroundForEach());
   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::Node *nn(fe->getChildByNameExec(YACSEvalYFXGraphGen::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 !");
@@ -530,7 +450,7 @@ std::string YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure() const
 
 std::string YACSEvalYFXRunOnlyPattern::getStatusOfRunStr() const
 {
-  YACS::StatesForNode st(_generatedGraph->getState());
+  YACS::StatesForNode st(getUndergroundGeneratedGraph()->getState());
   switch(st)
     {
     case YACS::READY:
@@ -565,26 +485,7 @@ std::string YACSEvalYFXRunOnlyPattern::getStatusOfRunStr() const
 
 std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResults() const
 {
-  if(_generatedGraph->getState()!=YACS::DONE)
-    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : the execution did not finished correctly ! getResults should not be called !");
-  std::vector<YACSEvalSeqAny *> ret(_outputsOfInterest.size());
-  YACS::ENGINE::Node *node(_generatedGraph->getChildByName(GATHER_NODE_NAME));
-  YACS::ENGINE::PythonNode *nodeC(dynamic_cast<YACS::ENGINE::PythonNode *>(node));
-  if(!nodeC)
-    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : internal error !");
-  std::size_t ii(0);
-  for(std::vector< YACSEvalOutputPort * >::const_iterator it=_outputsOfInterest.begin();it!=_outputsOfInterest.end();it++,ii++)
-    {
-      YACS::ENGINE::InPort *input(nodeC->getInPort((*it)->getName()));
-      YACS::ENGINE::InputPyPort *inputC(dynamic_cast<YACS::ENGINE::InputPyPort *>(input));
-      if(!inputC)
-        {
-          std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getResults : internal error for input \"" << (*it)->getName() << "\"";
-          throw YACS::Exception(oss.str());
-        }
-      ret[ii]=BuildValueInPort(inputC);
-    }
-  return ret;
+  return _gen->getResults();
 }
 
 /*!
@@ -593,7 +494,7 @@ std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResults() const
  */
 std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const
 {
-  YACS::StatesForNode st(_generatedGraph->getState());
+  YACS::StatesForNode st(getUndergroundGeneratedGraph()->getState());
   if(st==YACS::DONE)
     {
       passedIds.clear();
@@ -610,8 +511,8 @@ std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailu
       return ret;
     }
   getStatusOfRunStr();// To check that the status is recognized.
-  std::list<YACS::ENGINE::Node *> lns(_generatedGraph->edGetDirectDescendants());
-  YACS::ENGINE::ForEachLoop *fe(findTopForEach());
+  std::list<YACS::ENGINE::Node *> lns(getUndergroundGeneratedGraph()->edGetDirectDescendants());
+  YACS::ENGINE::ForEachLoop *fe(getUndergroundForEach());
   //
   YACS::ENGINE::Executor exe;
   std::vector<YACS::ENGINE::SequenceAny *> outputs;
@@ -623,7 +524,7 @@ std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailu
     {
       YACS::ENGINE::OutputPort *p((*it1)->getUndergroundPtr());
       std::string st(_runNode->getOutPortName(p));
-      std::ostringstream oss; oss << FIRST_FE_SUBNODE_NAME << '.' << _runNode->getName() << '.' << st;
+      std::ostringstream oss; oss << YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME << '.' << _runNode->getName() << '.' << st;
       st=oss.str();
       YACS::ENGINE::ForEachLoop::InterceptorizeNameOfPort(st);
       std::vector<std::string>::iterator it2(std::find(nameOfOutputs.begin(),nameOfOutputs.end(),st));
@@ -645,7 +546,18 @@ void YACSEvalYFXRunOnlyPattern::emitStart() const
   YACSEvalObserver *obs(getObserver());
   if(!obs)
     return ;
-  obs->notifyNumberOfSamplesToEval(getBoss(),_FEInGeneratedGraph->getNbOfElementsToBeProcessed());
+  obs->notifyNumberOfSamplesToEval(getBoss(),getUndergroundForEach()->getNbOfElementsToBeProcessed());
+}
+
+bool YACSEvalYFXRunOnlyPattern::go(bool stopASAP, YACSEvalSession *session) const
+{
+  emitStart();
+  return getGenerator()->go(stopASAP,session);
+}
+
+YACS::ENGINE::ForEachLoop *YACSEvalYFXRunOnlyPattern::getUndergroundForEach() const
+{
+  return getGenerator()->getUndergroundForEach();
 }
 
 bool YACSEvalYFXRunOnlyPattern::IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode)
@@ -728,17 +640,405 @@ void YACSEvalYFXRunOnlyPattern::buildOutputPorts()
     }
 }
 
-YACS::ENGINE::ForEachLoop *YACSEvalYFXRunOnlyPattern::findTopForEach() const
+YACSEvalYFXGraphGen *YACSEvalYFXRunOnlyPattern::getGenerator() const
+{
+  if(!_gen)
+    throw YACS::Exception("getGenerator : generator is NULL !");
+  return _gen;
+}
+
+/////////////////////
+
+YACSEvalYFXGraphGen::YACSEvalYFXGraphGen(YACSEvalYFXRunOnlyPattern *boss):_boss(boss),_generatedGraph(0),_FEInGeneratedGraph(0)
+{
+  if(!_boss)
+    throw YACS::Exception("YACSEvalYFXGraphGen constructor : boss is NULL !");
+}
+
+YACSEvalYFXGraphGen::~YACSEvalYFXGraphGen()
+{
+  //delete _generatedGraph;// -> TODO : AGY why ?
+}
+
+void YACSEvalYFXGraphGen::resetGeneratedGraph()
+{
+  delete _generatedGraph;
+  _generatedGraph=0; _FEInGeneratedGraph=0;
+}
+
+bool YACSEvalYFXGraphGen::isLocked() 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++)
+  return _generatedGraph!=0;
+}
+
+int YACSEvalYFXGraphGen::assignNbOfBranches()
+{
+  if(!_generatedGraph)
+    throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : the generated graph has not been created !");
+  std::list<YACS::ENGINE::Node *> nodes(_generatedGraph->getChildren());
+  YACS::ENGINE::ForEachLoop *zeMainNode(0);
+  for(std::list<YACS::ENGINE::Node *>::const_iterator it=nodes.begin();it!=nodes.end();it++)
+    {
+      YACS::ENGINE::ForEachLoop *isZeMainNode(dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it));
+      if(isZeMainNode)
+        {
+          if(!zeMainNode)
+            zeMainNode=isZeMainNode;
+          else
+            throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 1 !");
+        }
+    }
+  if(!zeMainNode)
+    throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 2 !");
+  unsigned int nbProcsDeclared(getBoss()->getResourcesInternal()->getNumberOfProcsDeclared());
+  nbProcsDeclared=std::max(nbProcsDeclared,4u);
+  int nbOfBranch=1;
+  if(getBoss()->getParallelizeStatus())
     {
-      fe=dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it);
-      if(fe)
-        break;
+      nbOfBranch=(nbProcsDeclared/getBoss()->getResourcesInternal()->getMaxLevelOfParallelism());
+      nbOfBranch=std::max(nbOfBranch,1);
     }
-  if(!fe)
-    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::findTopForEach : internal error 2 ! ForEach is not accessible !");
-  return fe;
+  YACS::ENGINE::InputPort *zeInputToSet(zeMainNode->edGetNbOfBranchesPort());
+  YACS::ENGINE::AnyInputPort *zeInputToSetC(dynamic_cast<YACS::ENGINE::AnyInputPort *>(zeInputToSet));
+  if(!zeInputToSetC)
+    throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 3 !");
+  YACS::ENGINE::Any *a(YACS::ENGINE::AtomAny::New(nbOfBranch));
+  zeInputToSetC->put(a);
+  zeInputToSetC->exSaveInit();
+  a->decrRef();
+  return nbOfBranch;
+}
+
+void YACSEvalYFXGraphGenInteractive::generateGraph()
+{
+  if(_generatedGraph)
+    { delete _generatedGraph; _generatedGraph=0; _FEInGeneratedGraph=0; }
+  static const char LISTPYOBJ_STR[]="list[pyobj]";
+  if(getBoss()->getOutputsOfInterest().empty())
+    return ;
+  YACS::ENGINE::RuntimeSALOME::setRuntime();
+  YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
+  _generatedGraph=r->createProc(DFT_PROC_NAME);
+  YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
+  std::ostringstream oss; oss << "Loop_" << getBoss()->getRunNode()->getName();
+  _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
+  _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
+  //
+  YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
+  _generatedGraph->edAddChild(n0);
+  YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
+  YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
+  std::ostringstream var0;
+  const std::vector< YACSEvalInputPort >& inputs(getBoss()->getInputs());
+  for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
+    {
+      if((*it).isRandomVar())
+        {
+          var0 << (*it).getName() << ",";
+          YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
+          YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
+          YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
+          if(!inpc)
+            throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
+          (*it).setUndergroundPortToBeSet(inpc);
+        }
+    }
+  std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
+  n0->setScript(n0Script.str());
+  //
+  YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
+  _FEInGeneratedGraph=n1;
+  _generatedGraph->edAddChild(n1);
+  _generatedGraph->edAddCFLink(n0,n1);
+  _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
+  YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
+  _generatedGraph->edAddChild(n2);
+  _generatedGraph->edAddCFLink(n1,n2);
+  //
+  YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
+  n1->edAddChild(n10);
+  YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
+  YACS::ENGINE::ComposedNode *runNode(getBoss()->getRunNode());
+  YACS::ENGINE::Node *n101(runNode->cloneWithoutCompAndContDeepCpy(0,true));
+  n10->edAddChild(n100);
+  n10->edAddChild(n101);
+  YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
+  n10->edAddCFLink(n100,n101);
+  n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
+  std::ostringstream var1;
+  for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
+    {
+      if((*it).isRandomVar())
+        {
+          var1 << (*it).getName() << ",";
+          YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
+          std::string tmpPortName(runNode->getInPortName((*it).getUndergroundPtr()));
+          YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
+          n10->edAddDFLink(myOut,myIn);
+        }
+    }
+  std::ostringstream n100Script;  n100Script << var1.str() << "=i0\n";
+  n100->setScript(n100Script.str());
+  const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
+  for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++)
+    {
+      YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
+      YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
+      std::string tmpPortName(runNode->getOutPortName((*it)->getUndergroundPtr()));
+      YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
+      _generatedGraph->edAddDFLink(myOut,myIn);
+    }
+  _generatedGraph->updateContainersAndComponents();
+}
+
+bool YACSEvalYFXGraphGenInteractive::go(bool stopASAP, YACSEvalSession *session) const
+{
+  YACS::ENGINE::Executor exe;
+  exe.setKeepGoingProperty(!stopASAP);
+  {
+    MyAutoThreadSaver locker;
+    exe.RunW(getUndergroundGeneratedGraph());
+  }
+  return getUndergroundGeneratedGraph()->getState()==YACS::DONE;
+}
+
+std::vector<YACSEvalSeqAny *> YACSEvalYFXGraphGenInteractive::getResults() const
+{
+  if(getUndergroundGeneratedGraph()->getState()!=YACS::DONE)
+    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : the execution did not finished correctly ! getResults should not be called !");
+  const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest()); 
+  std::vector<YACSEvalSeqAny *> ret(outputsOfInt.size());
+  YACS::ENGINE::Node *node(getUndergroundGeneratedGraph()->getChildByName(YACSEvalYFXGraphGen::GATHER_NODE_NAME));
+  YACS::ENGINE::PythonNode *nodeC(dynamic_cast<YACS::ENGINE::PythonNode *>(node));
+  if(!nodeC)
+    throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : internal error !");
+  std::size_t ii(0);
+  for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++,ii++)
+    {
+      YACS::ENGINE::InPort *input(nodeC->getInPort((*it)->getName()));
+      YACS::ENGINE::InputPyPort *inputC(dynamic_cast<YACS::ENGINE::InputPyPort *>(input));
+      if(!inputC)
+        {
+          std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getResults : internal error for input \"" << (*it)->getName() << "\"";
+          throw YACS::Exception(oss.str());
+        }
+      ret[ii]=YACSEvalYFXPattern::BuildValueInPort(inputC);
+    }
+  return ret;
+}
+
+////////////////////
+
+void YACSEvalYFXGraphGenCluster::generateGraph()
+{
+  if(_generatedGraph)
+    { delete _generatedGraph; _generatedGraph=0; _FEInGeneratedGraph=0; }
+  //
+  const char EFXGenFileName[]="EFXGenFileName";
+  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%b%y\"),n.strftime(\"%H%M%S\")))";
+  const char EFXGenContent2[]="import getpass,datetime\nn=datetime.datetime.now()\nreturn \"EvalYFX_%s_%s_%s\"%(getpass.getuser(),n.strftime(\"%d%b%y\"),n.strftime(\"%H%M%S\"))";
+  //
+  YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent));
+  YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
+  _locSchemaFile=PyString_AsString(val);
+  func=YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent2);
+  val=YACS::ENGINE::evalFuncPyWithNoParams(func);
+  _jobName=PyString_AsString(val);
+  //
+  static const char LISTPYOBJ_STR[]="list[pyobj]";
+  if(getBoss()->getOutputsOfInterest().empty())
+    return ;
+  YACS::ENGINE::RuntimeSALOME::setRuntime();
+  YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
+  _generatedGraph=r->createProc(DFT_PROC_NAME);
+  YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
+  std::ostringstream oss; oss << "Loop_" << getBoss()->getRunNode()->getName();
+  _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
+  _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
+  //
+  YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
+  _generatedGraph->edAddChild(n0);
+  YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
+  YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
+  std::ostringstream var0;
+  const std::vector< YACSEvalInputPort >& inputs(getBoss()->getInputs());
+  for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
+    {
+      if((*it).isRandomVar())
+        {
+          var0 << (*it).getName() << ",";
+          YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
+          YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
+          YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
+          if(!inpc)
+            throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
+          (*it).setUndergroundPortToBeSet(inpc);
+        }
+    }
+  std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
+  n0->setScript(n0Script.str());
+  //
+  YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
+  _FEInGeneratedGraph=n1;
+  _generatedGraph->edAddChild(n1);
+  _generatedGraph->edAddCFLink(n0,n1);
+  _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
+  YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
+  _generatedGraph->edAddChild(n2);
+  _generatedGraph->edAddCFLink(n1,n2);
+  //
+  YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
+  n1->edAddChild(n10);
+  YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
+  YACS::ENGINE::ComposedNode *runNode(getBoss()->getRunNode());
+  YACS::ENGINE::Node *n101(runNode->cloneWithoutCompAndContDeepCpy(0,true));
+  n10->edAddChild(n100);
+  n10->edAddChild(n101);
+  YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
+  n10->edAddCFLink(n100,n101);
+  n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
+  std::ostringstream var1;
+  for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
+    {
+      if((*it).isRandomVar())
+        {
+          var1 << (*it).getName() << ",";
+          YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
+          std::string tmpPortName(runNode->getInPortName((*it).getUndergroundPtr()));
+          YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
+          n10->edAddDFLink(myOut,myIn);
+        }
+    }
+  std::ostringstream n100Script;  n100Script << var1.str() << "=i0\n";
+  n100->setScript(n100Script.str());
+  const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
+  std::ostringstream n2Script; n2Script << "zeRes=[";
+  for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++)
+    {
+      YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
+      YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
+      n2Script << (*it)->getName() << ", ";
+      std::string tmpPortName(runNode->getOutPortName((*it)->getUndergroundPtr()));
+      YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
+      _generatedGraph->edAddDFLink(myOut,myIn);
+    }
+  n2Script << "]\nf=file(\"" << _jobName << "\",\"w\") ; f.write(str(zeRes)) ; del f";
+  n2->setScript(n2Script.str());
+  _generatedGraph->updateContainersAndComponents();
+}
+
+bool YACSEvalYFXGraphGenCluster::go(bool stopASAP, YACSEvalSession *session) const
+{
+  getUndergroundGeneratedGraph()->saveSchema(_locSchemaFile);
+  YACSEvalListOfResources *rss(getBoss()->getResourcesInternal());
+  const YACSEvalParamsForCluster& cli(rss->getAddParamsForCluster());
+  std::vector<std::string> machines(rss->getAllChosenMachines());
+  if(machines.size()!=1)
+    throw YACS::Exception("YACSEvalYFXGraphGenCluster::go : internal error ! In batch mode and not exactly one machine !");
+  Engines::SalomeLauncher_var sl(session->getInternal()->goFetchingSalomeLauncherInNS());
+  Engines::ResourceParameters rr;
+  rr.name=CORBA::string_dup(machines[0].c_str());
+  rr.hostname=CORBA::string_dup("");
+  rr.can_launch_batch_jobs=true;
+  rr.can_run_containers=true;
+  rr.OS=CORBA::string_dup("Linux");
+  rr.componentList.length(0);
+  rr.nb_proc=rss->getNumberOfProcsDeclared();// <- important
+  rr.mem_mb=1024;
+  rr.cpu_clock=1000;
+  rr.nb_node=1;// useless only nb_proc used.
+  rr.nb_proc_per_node=1;// useless only nb_proc used.
+  rr.policy=CORBA::string_dup("cycl");
+  rr.resList.length(0);
+  Engines::JobParameters jp;
+  jp.job_name=CORBA::string_dup(_jobName.c_str());
+  jp.job_type=CORBA::string_dup("yacs_file");
+  jp.job_file=CORBA::string_dup(_locSchemaFile.c_str());
+  jp.env_file=CORBA::string_dup("");
+  jp.in_files.length(0);
+  jp.out_files.length(1);
+  jp.out_files[0]=CORBA::string_dup(_jobName.c_str());
+  jp.work_directory=CORBA::string_dup(cli.getRemoteWorkingDir().c_str());
+  jp.local_directory=CORBA::string_dup(cli.getLocalWorkingDir().c_str());
+  jp.result_directory=CORBA::string_dup(cli.getLocalWorkingDir().c_str());
+  jp.maximum_duration=CORBA::string_dup(cli.getMaxDuration().c_str());
+  jp.resource_required=rr;
+  jp.queue=CORBA::string_dup("");
+  jp.exclusive=false;
+  jp.mem_per_cpu=rr.mem_mb;
+  jp.wckey=CORBA::string_dup(cli.getWCKey().c_str());
+  jp.extra_params=CORBA::string_dup("");
+  jp.specific_parameters.length(0);
+  jp.launcher_file=CORBA::string_dup("");
+  jp.launcher_args=CORBA::string_dup("");
+  _jobid=sl->createJob(jp);
+  sl->launchJob(_jobid);
+  bool ret(false);
+  while(true)
+    {
+      PyRun_SimpleString("import time ; time.sleep(10)");
+      char *state(sl->getJobState(_jobid));//"CREATED", "IN_PROCESS", "QUEUED", "RUNNING", "PAUSED", "FINISHED" or "FAILED"
+      std::string sstate(state);
+      CORBA::string_free(state);
+      if(sstate=="FINISHED" || sstate=="FAILED")
+        {
+          ret=sstate=="FINISHED";
+          break;
+        }
+    }
+  sl->getJobResults(_jobid,cli.getLocalWorkingDir().c_str());
+  //
+  try
+    {
+      std::ostringstream oss; oss << "import os" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"" << _jobName  << "\")" << std::endl;
+      oss << "if not os.path.exists(p):\n  return None\n";
+      oss << "f=file(p,\"r\")" << std::endl;
+      oss << "return eval(f.read())";
+      std::string zeInput(oss.str());
+      YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy("fetch",zeInput));
+      YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
+      if(!PyList_Check(val))
+        throw YACS::Exception("Fetched file does not contain a list !");
+      Py_ssize_t sz(PyList_Size(val));
+      _res.resize(sz);
+      for(Py_ssize_t i=0;i<sz;i++)
+        {
+          std::vector<double>& res0(_res[i]);
+          PyObject *elt0(PyList_GetItem(val,i));
+          if(!PyList_Check(elt0))
+            throw YACS::Exception("Fetched file does contain a list of list !");
+          Py_ssize_t sz0(PyList_Size(elt0)); res0.resize(sz0);
+          for(Py_ssize_t j=0;j<sz0;j++)
+            {
+              PyObject *elt1(PyList_GetItem(elt0,j));
+              res0[j]=PyFloat_AsDouble(elt1);
+            }
+        }
+      // cleanup
+      std::ostringstream oss1; oss1 << "import os" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"" << _jobName  << "\") ; os.remove(p)" << std::endl;
+      std::string s1(oss1.str());
+      PyRun_SimpleString(s1.c_str());
+      std::ostringstream oss2; oss2 << "import os,shutil" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"logs\") ; shutil.rmtree(p)" << std::endl;
+      std::string s2(oss2.str());
+      PyRun_SimpleString(s2.c_str());
+    }
+  catch(YACS::Exception& e)
+    {
+      _errors=e.what();
+      return false;
+    }
+  //
+  return ret;
+}
+
+std::vector<YACSEvalSeqAny *> YACSEvalYFXGraphGenCluster::getResults() const
+{
+  std::size_t sz(_res.size());
+  std::vector<YACSEvalSeqAny *> ret(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      YACS::AutoCppPtr<YACSEvalSeqAnyDouble> elt(new YACSEvalSeqAnyDouble(_res[i]));
+      ret[i]=elt.dettach();
+    }
+  return ret;
 }
index b5abcb7b5aea91b86b20769cbd170c0880973c7e..9a1113a9af74fd4ebebb5925aa9ea717623ac791 100644 (file)
@@ -43,6 +43,7 @@ namespace YACS
 }
 
 class YACSEvalYFX;
+class YACSEvalSession;
 class YACSEvalObserver;
 class YACSEvalListOfResources;
 class ResourcesManager_cpp;
@@ -66,6 +67,7 @@ public:
   void registerObserver(YACSEvalObserver *observer);
   YACSEvalObserver *getObserver() const { return _observer; }
   YACSEvalYFX *getBoss() const { return _boss; }
+  YACSEvalListOfResources *getResourcesInternal() const { return _res; }
   virtual void setOutPortsOfInterestForEvaluation(const std::vector<YACSEvalOutputPort *>& outputs) = 0;
   virtual void resetOutputsOfInterest() = 0;
   virtual void generateGraph() = 0;
@@ -79,17 +81,16 @@ public:
   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;
-  virtual void emitStart() const = 0;
-public:
-  static const char DFT_PROC_NAME[];
+  virtual bool go(bool stopASAP, YACSEvalSession *session) const = 0;
+public://for _gen
+  const std::vector< YACSEvalInputPort >& getInputs() const { return _inputs; }
+  static YACS::ENGINE::TypeCode *CreateSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType);
+  static YACSEvalSeqAny *BuildValueInPort(YACS::ENGINE::InputPyPort *port);
 protected:
   YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme);
-  YACS::ENGINE::TypeCode *createSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType);
   void setResources(YACSEvalListOfResources *res);
   void resetResources();
-  YACSEvalListOfResources *getResourcesInternal() const { return _res; }
   ResourcesManager_cpp *getCatalogInAppli() const { return _rm; }
-  static YACSEvalSeqAny *BuildValueInPort(YACS::ENGINE::InputPyPort *port);
   static YACSEvalSeqAny *BuildValueFromEngineFrmt(YACS::ENGINE::SequenceAny *data);
 private:
   void cleanScheme();
@@ -111,6 +112,8 @@ public:
   static const std::size_t MAX_LGTH_OF_INP_DUMP;
 };
 
+class YACSEvalYFXGraphGen;
+
 class YACSEvalYFXRunOnlyPattern : public YACSEvalYFXPattern
 {
 public:
@@ -129,23 +132,74 @@ public:
   std::string getStatusOfRunStr() const;
   std::vector<YACSEvalSeqAny *> getResults() const;
   std::vector<YACSEvalSeqAny *> getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const;
-  void emitStart() const;
+  bool go(bool stopASAP, YACSEvalSession *session) const;
   //
-  YACS::ENGINE::ForEachLoop *getUndergroundForEach() const { return _FEInGeneratedGraph; }
+  YACS::ENGINE::ForEachLoop *getUndergroundForEach() const;
   static bool IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode);
-public:
-  static const char FIRST_FE_SUBNODE_NAME[];
-  static const char GATHER_NODE_NAME[];
 private:
+  void emitStart() const;
   void buildInputPorts();
   void buildOutputPorts();
-  YACS::ENGINE::ForEachLoop *findTopForEach() const;
+  YACSEvalYFXGraphGen *getGenerator() const;
+public://for _gen
+  const std::vector<YACSEvalOutputPort *>& getOutputsOfInterest() const { return _outputsOfInterest; }
+  YACS::ENGINE::ComposedNode *getRunNode() const { return _runNode; }
 private:
+  bool _lockedStatus;
   YACS::ENGINE::ComposedNode *_runNode;
   std::vector<YACSEvalOutputPort *> _outputsOfInterest;
+  YACSEvalYFXGraphGen *_gen;
+  YACSEvalYFXRunOnlyPatternInternalObserver *_obs;
+};
+
+class YACSEvalYFXGraphGen
+{
+protected:
+  YACSEvalYFXGraphGen(YACSEvalYFXRunOnlyPattern *boss);
+  YACSEvalYFXRunOnlyPattern *getBoss() const { return _boss; }
+public:
+  virtual ~YACSEvalYFXGraphGen();
+  virtual void generateGraph() = 0;
+  virtual bool go(bool stopASAP, YACSEvalSession *session) const = 0;
+  virtual std::vector<YACSEvalSeqAny *> getResults() const = 0;
+  bool isLocked() const;
+  int assignNbOfBranches();
+  void resetGeneratedGraph();
+  YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const { return _generatedGraph; }
+  YACS::ENGINE::ForEachLoop *getUndergroundForEach() const { return _FEInGeneratedGraph; }
+private:
+  YACSEvalYFXRunOnlyPattern *_boss;
+protected:
   YACS::ENGINE::Proc *_generatedGraph;
   YACS::ENGINE::ForEachLoop *_FEInGeneratedGraph;
-  YACSEvalYFXRunOnlyPatternInternalObserver *_obs;
+public:
+  static const char DFT_PROC_NAME[];
+  static const char FIRST_FE_SUBNODE_NAME[];
+  static const char GATHER_NODE_NAME[];
+};
+
+class YACSEvalYFXGraphGenInteractive : public YACSEvalYFXGraphGen
+{
+public:
+  YACSEvalYFXGraphGenInteractive(YACSEvalYFXRunOnlyPattern *boss):YACSEvalYFXGraphGen(boss) { }
+  void generateGraph();
+  bool go(bool stopASAP, YACSEvalSession *session) const;
+  std::vector<YACSEvalSeqAny *> getResults() const;
+};
+
+class YACSEvalYFXGraphGenCluster : public YACSEvalYFXGraphGen
+{
+public:
+  YACSEvalYFXGraphGenCluster(YACSEvalYFXRunOnlyPattern *boss):YACSEvalYFXGraphGen(boss) { }
+  void generateGraph();
+  bool go(bool stopASAP, YACSEvalSession *session) const;
+  std::vector<YACSEvalSeqAny *> getResults() const;
+private:
+  std::string _locSchemaFile;
+  std::string _jobName;
+  mutable int _jobid;
+  mutable std::string _errors;
+  mutable std::vector< std::vector<double> > _res;
 };
 
 #endif
index c7915fc0c91d0bfb27924a8953b11f754562c390..3c2c12e4aa25ce5902e3384cc7f07fdf1d1665be 100644 (file)
@@ -309,6 +309,7 @@ public:
   std::vector<std::string> listOfPropertyKeys() const;
   std::string getValueOfKey(const char *key) const;
   void setProperty(const std::string& key, const std::string &value);
+  std::string getName() const;
 private:
   YACSEvalVirtualYACSContainer();
 };
@@ -336,6 +337,26 @@ private:
   YACSEvalResource();
 };
 
+class YACSEvalParamsForCluster
+{
+public:
+  bool getExclusiveness() const;
+  void setExclusiveness(bool newStatus);
+  std::string getRemoteWorkingDir();
+  void setRemoteWorkingDir(const std::string& remoteWorkingDir);
+  std::string getLocalWorkingDir();
+  void setLocalWorkingDir(const std::string& localWorkingDir);
+  std::string getWCKey() const;
+  void setWCKey(const std::string& wcKey);
+  unsigned int getNbProcs() const;
+  void setNbProcs(unsigned int nbProcs);
+  void setMaxDuration(const std::string& maxDuration);
+  std::string getMaxDuration() const;
+  void checkConsistency() const;
+private:
+  YACSEvalParamsForCluster();
+};
+
 class YACSEvalListOfResources
 {
 public:
@@ -346,6 +367,8 @@ public:
   bool isInteractive() const;
   YACSEvalResource *at(std::size_t i) const;
   unsigned int getNumberOfProcsDeclared() const;
+  void checkOKForRun() const;
+  YACSEvalParamsForCluster& getAddParamsForCluster();
   %extend
      {
        std::size_t __len__() const
index 05520f7195da25049969c0abf695674a9ec32888..6a28ed1f22d9538b39014037d8b343e73e796be1 100644 (file)
@@ -53,6 +53,7 @@ for inp in inps:
 efx.lockPortsForEvaluation(inps,outps)
 rss=efx.giveResources()
 rss[0][0].setWantedMachine("localhost")
+assert(rss.isInteractive())
 a,b=efx.run(session) ; assert(a)
 efx.unlockAll()
 for ii,inp in enumerate(inps):
index 14048755f6d247598625369aa202d6f7277bd20c..0855c799eb35e1496779fed90c5bf522b60df0a5 100644 (file)
@@ -56,6 +56,7 @@ inps[0].setSequenceOfValuesToEval([1.,2.,3.,4.,5.,6.])
 efx.lockPortsForEvaluation(inps,outps)
 rss=efx.giveResources()
 rss[0][0].setWantedMachine("localhost")
+assert(rss.isInteractive())
 a,b=efx.run(session)
 assert(efx.getStatusOfRunStr()=='SOME_SAMPLES_FAILED_AND_ALL_OF_THEM_FAILED_DETERMINISTICALLY')
 c,d=efx.getResultsInCaseOfFailure()
diff --git a/src/evalyfx_swig/test3.py b/src/evalyfx_swig/test3.py
new file mode 100644 (file)
index 0000000..9fd10cc
--- /dev/null
@@ -0,0 +1,72 @@
+# Copyright (C) 2015-2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# first test using cluster
+
+import os,getpass
+
+CatalogResources="""<?xml version="1.0"?>
+<resources>
+  <machine name="localhost" hostname="dsp0698184" type="single_machine" appliPath="" batchQueue="" userCommands="" protocol="ssh" iprotocol="ssh" workingDirectory="" canLaunchBatchJobs="false" canRunContainers="true" batch="none" mpi="no mpi" userName="" OS="" memInMB="0" CPUFreqMHz="0" nbOfNodes="1" nbOfProcPerNode="4"/>
+  <machine name="athos" hostname="athos" type="cluster" appliPath="/home/H87074/ATHOS_V771/appli_V7_7_1" batchQueue="" userCommands="" protocol="ssh" iprotocol="ssh" workingDirectory="" canLaunchBatchJobs="true" canRunContainers="false" batch="slurm" mpi="no mpi" userName="" OS="" memInMB="0" CPUFreqMHz="0" nbOfNodes="250" nbOfProcPerNode="28"/>
+</resources>"""
+
+def buildScheme(fname):
+    import SALOMERuntime
+    import loader
+    SALOMERuntime.RuntimeSALOME.setRuntime()
+    r=SALOMERuntime.getSALOMERuntime()
+    p0=r.createProc("run")
+    #
+    p=r.createBloc("toto")
+    p0.edAddChild(p)
+    #
+    cont=p0.createContainer("MyWonderfulContainer","Salome")
+    td=p0.createType("double","double")
+    n0=r.createScriptNode("Salome","PyScript0")
+    p.edAddChild(n0)
+    q=n0.edAddInputPort("q",td)
+    ep=n0.edAddOutputPort("ep",td)
+    n0.setScript("ep=1./(4.-q)") # <- force division by 0
+    n0.setExecutionMode("remote")
+    n0.setContainer(cont)
+    p0.saveSchema(fname)
+    pass
+
+fname="test3.xml"
+import evalyfx
+session=evalyfx.YACSEvalSession()
+session.launch()
+buildScheme(fname)
+efx=evalyfx.YACSEvalYFX.BuildFromFile(fname)
+efx.getParams().setStopASAPAfterErrorStatus(False)
+inps=efx.getFreeInputPorts()
+assert(len(inps)==1)
+outps=efx.getFreeOutputPorts()
+inps[0].setSequenceOfValuesToEval([-7.,2.,3.,5.,6.])
+efx.lockPortsForEvaluation(inps,outps)
+#
+rss=efx.giveResources()
+rss[0][0].setWantedMachine("athos")
+cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch",getpass.getuser(),"TMP3")) ; cp.setLocalWorkingDir(os.path.join(os.path.expanduser("~"),"TMP52"))
+cp.setWCKey("P11U50:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05")
+assert(not rss.isInteractive())
+a,b=efx.run(session)
+print("************",a,b)
+print efx.getResults()
index 6ca7a67f094a55ae52c31d44b8f209e33ce26ce0..3525093bc0a186649cbc5b84aee82a565c306d5e 100644 (file)
@@ -17,6 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+INCLUDE(UseQtExt)
+
 # --- options ---
 
 # additional include directories
@@ -160,12 +162,12 @@ SET(_moc_HEADERS
   )
 
 # header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
 
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 SET(GenericGui_SOURCES
   GenericGuiExport.hxx
index fc4c3fa2e6b0a31404b4cd5cb451a078085ba542..0e306c83ffccc039a4e886a03ef72e12fee42e2f 100755 (executable)
@@ -97,3 +97,10 @@ ADD_TEST(TestPMML TestPMML)
 
 FILE(COPY ${PROJECT_SOURCE_DIR}/src/pmml/Test/samples  DESTINATION . )
 INSTALL(TARGETS TestPMML DESTINATION ${SALOME_INSTALL_BINS})
+
+#
+
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/pmml)
+FILE(COPY ${PROJECT_SOURCE_DIR}/src/pmml/Test/samples DESTINATION "${CMAKE_INSTALL_PREFIX}/${LOCAL_TEST_DIR}")
+INSTALL(TARGETS TestPMML DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${LOCAL_TEST_DIR} RENAME CTestTestfile.cmake)
diff --git a/src/pmml/Test/CTestTestfileInstall.cmake b/src/pmml/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..0b19971
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (C) 2015-2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+IF(NOT WIN32)
+  ADD_TEST(YacsTestPMML TestPMML)
+  SET_TESTS_PROPERTIES(YacsTestPMML PROPERTIES LABELS "${COMPONENT_NAME}")
+  ADD_TEST(YacsPMMLBasicsTest python pmml_swig/PMMLBasicsTestLauncher.py)
+  SET_TESTS_PROPERTIES(YacsPMMLBasicsTest PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDIF(NOT WIN32)
index 3ab347925061adfb6ef9dcf1bd6aef8b6fc2937e..39b24d4bb2ede9df80d5cc3c8d891a03c820dbf0 100755 (executable)
@@ -69,3 +69,9 @@ INSTALL(FILES PMMLBasicsTest.py DESTINATION ${SALOME_INSTALL_SCRIPT_PYTHON})
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 ADD_TEST(PMMLBasicsTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PMMLBasicsTest.py)
 SET_TESTS_PROPERTIES(PMMLBasicsTest PROPERTIES ENVIRONMENT "${tests_env}")
+
+#
+
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/pmml/pmml_swig)
+FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/PMMLBasicsTest.py DESTINATION "${CMAKE_INSTALL_PREFIX}/${LOCAL_TEST_DIR}")
+FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/PMMLBasicsTestLauncher.py DESTINATION "${CMAKE_INSTALL_PREFIX}/${LOCAL_TEST_DIR}")
diff --git a/src/pmml/pmml_swig/PMMLBasicsTestLauncher.py b/src/pmml/pmml_swig/PMMLBasicsTestLauncher.py
new file mode 100755 (executable)
index 0000000..836d6ab
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os,sys,subprocess,shutil
+
+# Here the most beautiful part of test :)
+dirALaCon0="Test"
+dirAlaCon1="samples"
+if not os.path.exists(dirALaCon0):
+    os.mkdir(dirALaCon0)
+if not os.path.exists(os.path.join(dirALaCon0,dirAlaCon1)):
+    os.chdir(dirALaCon0)
+    os.symlink(os.path.join("..",dirAlaCon1),dirAlaCon1)
+    os.chdir("..")
+# GO !
+dn=os.path.dirname(__file__)
+p=subprocess.Popen(["python","PMMLBasicsTest.py"],cwd=dn,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+a,b=p.communicate()
+ret=p.returncode
+# Clean up the wonderful first part stuf
+shutil.rmtree(dirALaCon0)
+sys.exit(ret)
index 640d59070e30362956aa0447d8110460d3ff40da..70b220b68569d184f8c54827e9be7470ae00df14 100644 (file)
@@ -35,6 +35,24 @@ namespace YACS
     private:
       PyGILState_STATE _gstate;
     };
+
+    class AutoPyRef
+    {
+    public:
+      AutoPyRef(PyObject *pyobj=0):_pyobj(pyobj) { }
+      ~AutoPyRef() { release(); }
+      AutoPyRef(const AutoPyRef& other):_pyobj(other._pyobj) { if(_pyobj) Py_XINCREF(_pyobj); }
+      AutoPyRef& operator=(const AutoPyRef& other) { if(_pyobj==other._pyobj) return *this; release(); _pyobj=other._pyobj; Py_XINCREF(_pyobj); return *this; }
+      operator PyObject *() { return _pyobj; }
+      void set(PyObject *pyobj) { if(pyobj==_pyobj) return ; release(); _pyobj=pyobj; }
+      PyObject *get() { return _pyobj; }
+      bool isNull() const { return _pyobj==0; }
+      PyObject *retn() { if(_pyobj) Py_XINCREF(_pyobj); return _pyobj; }
+    private:
+      void release() { if(_pyobj) Py_XDECREF(_pyobj); _pyobj=0; }
+    private:
+      PyObject *_pyobj;
+    };
   }
 }
 
index 83980a20f7682848754cde89175afefd571039b6..cc939672ce761a48d1c2619466dd956a6ef752f0 100644 (file)
 //
 
 #include "PyStdout.hxx"
+#include "Exception.hxx"
+#include "AutoGIL.hxx"
+
 #include <structmember.h>
+
 #include <string>
+#include <sstream>
+
+#ifdef WIN32
+#include <process.h>
+#define getpid _getpid
+#endif
 
 namespace YACS
 {
@@ -127,6 +137,56 @@ PyObject * newPyStdOut( std::string& out )
   return (PyObject*)self;
 }
 
+PyObject *evalPy(const std::string& funcName, const std::string& strToEval)
+{
+  std::ostringstream oss0; oss0 << "def " << funcName << "():\n";
+  std::string::size_type i0(0);
+  while(i0<strToEval.length() && i0!=std::string::npos)
+    {
+      std::string::size_type i2(strToEval.find('\n',i0));
+      std::string::size_type lgth(i2!=std::string::npos?i2-i0:std::string::npos);
+      std::string part(strToEval.substr(i0,lgth));
+      if(!part.empty())
+        oss0 << "  " << part << "\n";
+      i0=i2!=std::string::npos?i2+1:std::string::npos;
+    }
+  std::string zeCodeStr(oss0.str());
+  std::ostringstream stream;
+  stream << "/tmp/PythonNode_";
+  stream << getpid();
+  AutoPyRef context(PyDict_New());
+  PyDict_SetItemString( context, "__builtins__", PyEval_GetBuiltins() );
+  AutoPyRef code(Py_CompileString(zeCodeStr.c_str(), "kkkk", Py_file_input));
+  if(code.isNull())
+    {
+      std::string errorDetails;
+      PyObject *new_stderr(newPyStdOut(errorDetails));
+      PySys_SetObject((char*)"stderr", new_stderr);
+      PyErr_Print();
+      PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+      Py_DECREF(new_stderr);
+      std::ostringstream oss; oss << "evalPy failed : " << errorDetails;
+      throw Exception(oss.str());
+    }
+  AutoPyRef res(PyEval_EvalCode(reinterpret_cast<PyCodeObject *>((PyObject *)code),context,context));
+  PyObject *ret(PyDict_GetItemString(context,funcName.c_str())); //borrowed ref
+  if(!ret)
+    throw YACS::Exception("evalPy : Error on returned func !");
+  Py_XINCREF(ret);
+  return ret;
+}
+
+PyObject *evalFuncPyWithNoParams(PyObject *func)
+{
+  if(!func)
+    throw YACS::Exception("evalFuncPyWithNoParams : input func is NULL !");
+  AutoPyRef args(PyTuple_New(0));
+  AutoPyRef ret(PyObject_CallObject(func,args));
+  if(ret.isNull())
+    throw YACS::Exception("evalFuncPyWithNoParams : ret is null !");
+  return ret.retn();
+}
+
 }
 }
 
index af204cea6a2da745e70cf3322f33a38ea6c490ed..8899c0e6c88bc0df4a5024168724c37341b545bb 100644 (file)
@@ -29,7 +29,9 @@ namespace YACS
 {
   namespace ENGINE
   {
-    YACSRUNTIMESALOME_EXPORT PyObject * newPyStdOut( std::string& out );
+    YACSRUNTIMESALOME_EXPORT PyObject *newPyStdOut( std::string& out );
+    YACSRUNTIMESALOME_EXPORT PyObject *evalPy(const std::string& funcName, const std::string& strToEval);
+    YACSRUNTIMESALOME_EXPORT PyObject *evalFuncPyWithNoParams(PyObject *func);
   }
 }
 
index 1bb27a31d761ba20f5f05211b6d144a2dbdfbbae..b6b7bc47d39a80505bef12575e6cddd93be503ff 100644 (file)
@@ -815,6 +815,11 @@ PyFuncNode::~PyFuncNode()
 void PyFuncNode::init(bool start)
 {
   initCommonPartWithoutStateManagement(start);
+  if(_state == YACS::DISABLED)
+    {
+      exDisabledState(); // to refresh propagation of DISABLED state
+      return ;
+    }
   if(start) //complete initialization
     setState(YACS::READY);
   else if(_state > YACS::LOADED)// WARNING FuncNode has internal vars (CEA usecase) ! Partial initialization (inside a loop). Exclusivity of funcNode.
index 273be1c6cedf77090f3eecf1bb92b358a2899935..676f088c950ff5a5d0bf82b826fdb6a4f2bfe962 100644 (file)
@@ -17,8 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -90,12 +89,12 @@ SET(_moc_HEADERS
   )
 
 # header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
 
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 SET(YACS_SOURCES
   Yacsgui.cxx
@@ -113,7 +112,7 @@ TARGET_LINK_LIBRARIES(YACS ${_link_LIBRARIES})
 INSTALL(TARGETS YACS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${YACS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${YACS_RESOURCES}" "${SALOME_YACS_INSTALL_RES_DATA}")        
+QT_INSTALL_TS_RESOURCES("${YACS_RESOURCES}" "${SALOME_YACS_INSTALL_RES_DATA}") 
 
 INSTALL(FILES ${_res_files} DESTINATION ${SALOME_YACS_INSTALL_RES_DATA})
 SALOME_CONFIGURE_FILE(resources/YACSCatalog.xml.in 
index b9ea9921eba11720c7a2c0f072cfcd6a8dcfb466..e2fc04273a5d078b17a2044205413a07ae047c27 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
 
 # --- options ---
 
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
-  ${QT_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${GUI_INCLUDE_DIRS}
   ${PROJECT_SOURCE_DIR}/src/bases
@@ -65,7 +64,7 @@ SET(_moc_HEADERS
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 SET(SalomeWrap_SOURCES
   SalomeWrapExport.hxx
index 263036a03af8695cbe0aca1541436e138fb14637..8c9e72a4099fadd810b79af6eee89f50919e0712 100644 (file)
 #
 
 IF(NOT WIN32)
+  SET(SHELL /bin/sh)
   ADD_TEST(YacsLoaderTest python ${SALOME_TEST_DRIVER} ${TIMEOUT} ./runYacsLoaderTest.sh)
   SET_TESTS_PROPERTIES(YacsLoaderTest PROPERTIES
                                      LABELS "${COMPONENT_NAME}"
-                                     ENVIRONMENT "LD_LIBRARY_PATH=${YACS_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
-                      )
+                                     ENVIRONMENT "LD_LIBRARY_PATH=${YACS_TEST_LIB}:$ENV{LD_LIBRARY_PATH}")
+  ADD_TEST(YacsPmmlExeTest ${SHELL} ./PmmlExeTest.sh)
+  SET_TESTS_PROPERTIES(YacsPmmlExeTest PROPERTIES LABELS "${COMPONENT_NAME}")
 ENDIF()
index 341a6183a341ee8baf0b37e296ac0bd85bcc98f5..d0aba94e4b619c1ffc1a642c0baa603e236d7530 100755 (executable)
@@ -49,7 +49,7 @@ EOF
   # --- launch in background a SALOME session (servers)
 
   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
-  ./runAppli > log1 2>&1
+  ./salome > log1 2>&1 &
 
   # --- wait a little to let the background process define
   #     the CORBA naming service port and host
@@ -59,13 +59,13 @@ EOF
   # --- execute the test script in SALOME session environment
 
   chmod +x @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
-  ./runSession @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
+  ./salome shell @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
   ret=$?
 
   # ---------------------------------------------------------------------------
 
   kill -9 `cat "/tmp/YACSTEST_PidEcho"`
-  ./runSession killSalome.py
+  ./salome shell python killSalome.py
 
   echo "exec status YacsLoaderInSessionTest.sh "  $ret
 
index 100e08a183e75a2ea258ccd10b1130f94b49d505..cd2096b3aa1483cfa0d8b2f8e460de6f94dfb662 100644 (file)
@@ -39,6 +39,7 @@
 #include <iostream>
 #include <fstream>
 #include <signal.h>
+#include <list>
 
 #ifdef WIN32
 #else
@@ -72,6 +73,7 @@ static struct argp_option options[] =
     {"shutdown",        't', "level", 0,                   "Shutdown the schema: 0=no shutdown to 3=full shutdown (default 1)"},
     {"reset",           'r', "level", 0,                   "Reset the schema before execution: 0=nothing, 1=reset error nodes to ready state (default 0)"},
     {"kill-port",       'k', "port",  0,                   "Kill Salome application running on the specified port if the driver process is killed (with SIGINT or SIGTERM)"},
+    {"init_port",       'i', "value", OPTION_ARG_OPTIONAL, "Initialisation value of a port, specified as bloc.node.port=value."},
     { 0 }
   };
 #endif
@@ -90,6 +92,7 @@ struct arguments
   int shutdown;
   int reset;
   int killPort;
+  std::list<std::string> init_ports;
 };
 
 typedef struct {
@@ -159,6 +162,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
     case 'k':
       myArgs->killPort = atoi(arg);
       break;
+    case 'i':
+      if (arg)
+        myArgs->init_ports.push_back(std::string(arg));
+      break;
 
     case ARGP_KEY_ARG:
       if (state->arg_num >=1) // Too many arguments.
@@ -271,6 +278,20 @@ sighandler_t setsig(int sig, sighandler_t handler)
 }
 #endif
 
+bool parse_init_port(const std::string& input, std::string& node, std::string& port, std::string& value)
+{
+  bool ok = true;
+  size_t pos_eq = input.find('=');
+  if(pos_eq == std::string::npos || pos_eq == input.size())
+    return false;
+  value = input.substr(pos_eq+1);
+  size_t pos_dot = input.rfind('.', pos_eq);
+  if(!pos_dot || pos_dot == std::string::npos || pos_dot >= pos_eq-1)
+    return false;
+  port = input.substr(pos_dot+1, pos_eq-pos_dot-1);
+  node = input.substr(0, pos_dot);
+  return true;
+}
 
 int main (int argc, char* argv[])
 {
@@ -287,6 +308,7 @@ int main (int argc, char* argv[])
   myArgs.shutdown = 1;
   myArgs.reset = 0;
   myArgs.killPort = 0;
+  myArgs.init_ports.clear();
 
   // Parse our arguments; every option seen by parse_opt will be reflected in arguments.
 #ifdef WIN32
@@ -304,6 +326,11 @@ int main (int argc, char* argv[])
     std::cerr << " dumpErrorFile=" << myArgs.dumpErrorFile << std::endl;
   else
     std::cerr << std::endl;
+  std::list<std::string>::const_iterator it;
+  for(it=myArgs.init_ports.begin(); it != myArgs.init_ports.end(); it++)
+  {
+    std::cerr << (*it) << std::endl;
+  }
 #endif
 
 #ifndef WIN32
@@ -351,6 +378,31 @@ int main (int argc, char* argv[])
           std::cerr << "The imported file is probably not a YACS schema file" << std::endl;
           return 1;
         }
+      // Initialize the ports
+      for(it=myArgs.init_ports.begin(); it != myArgs.init_ports.end(); it++)
+      {
+        std::string node, port, value;
+        if(parse_init_port((*it), node, port, value))
+        {
+          std::cerr << "Initialization node=" << node
+                    << " port=" << port
+                    << " value=" << value << std::endl;
+
+          std::string init_state;
+          init_state = p->setInPortValue(node, port, value);
+          if(value.compare(init_state))
+          {
+            std::cerr << "Error on initialization:" << init_state << std::endl;
+            return 1;
+          }
+        }
+        else
+        {
+          std::cerr << "Error on parsing initialization string:" << (*it) << std::endl;
+          return 1;
+        }
+      }
+      
       //Get the parser logger
       Logger* logger=p->getLogger("parser");
       //Print errors logged if any
index ef3ef6006631746e413ecd73949fd84555e6d307..03564cfea67a9621e58fbe1d96146f8bb056f63a 100755 (executable)
@@ -60,4 +60,9 @@ IF(NOT WIN32)
   SALOME_CONFIGURE_FILE(PmmlExeTest.sh.in PmmlExeTest.sh)  
   SALOME_CONFIGURE_FILE(PmmlInSessionTest.sh.in PmmlInSessionTest.sh)
   ADD_TEST(NAME PmmlExeTest COMMAND ${SHELL} PmmlExeTest.sh)
-ENDIF()
\ No newline at end of file
+ENDIF()
+
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/yacsloader)
+INSTALL(TARGETS TestYACSPMML DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/PmmlExeTest.sh DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/config_appli.xml DESTINATION ${LOCAL_TEST_DIR})
index 0d01a824fcef0633c06a9d7958669e4e882a1bd8..3c4ca80e07b336e0623be58e2d4b5e1d8eb2c526 100755 (executable)
@@ -49,7 +49,7 @@ EOF
   # --- launch in background a SALOME session (servers)
 
   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
-  ./runAppli > log1 2>&1
+  ./salome > log1 2>&1 &
 
   # --- wait a little to let the background process define
   #     the CORBA naming service port and host
@@ -59,13 +59,13 @@ EOF
   # --- execute the test script in SALOME session environment
 
   chmod +x @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
-  ./runSession @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
+  ./salome shell @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
   ret=$?
 
   # ---------------------------------------------------------------------------
 
   kill -9 `cat "/tmp/YACSTEST_PidEcho"`
-  ./runSession killSalome.py
+  ./salome shell python killSalome.py
 
   echo "exec status PmmlInSessionTest.sh "  $ret
 
index f5c4b110c93559721a8c4e6327d4a606edacffd7..ee7278e6affb76549965eb1bc1ab5b67a723667e 100644 (file)
@@ -176,6 +176,22 @@ def sum(i):
     self.assertEqual(endNode_error.getPyObj(),0)
     pass
 
+  def test4(self):
+    """ test linked to TestSaveLoadRun.test20. This is a smaller test coming from EDF autotest"""
+    xmlFileName="test4.xml"
+    p=self.r.createProc("test26")
+    n=self.r.createScriptNode("","node1")
+    n.setScript("import os")
+    p.edAddChild(n)
+    n.setState(pilot.DISABLED)
+    #
+    ex=pilot.ExecutorSwig()
+    self.assertEqual(p.getState(),pilot.READY)
+    ex.RunW(p,0)
+    self.assertEqual(p.getState(),pilot.ACTIVATED)
+    self.assertEqual(n.getState(),pilot.DISABLED) # <- test is here.
+    pass
+
   def tearDown(self):
     del self.r
     del self.l
index 9a0076b6a1f0ab5f8d1709e66e03a7b621c6c9cb..d9399aff000aa14df088b37828fa01689c687e27 100755 (executable)
@@ -46,7 +46,7 @@ EOF
   # --- launch in background a SALOME session (servers)
 
   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
-  ./runAppli > log1 2>&1
+  ./salome > log1 2>&1 &
 
   # --- wait a little to let the background process define
   #     the CORBA naming service port and host
@@ -56,13 +56,13 @@ EOF
   # --- execute the test script in SALOME session environment
 
   chmod +x @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
-  ./runSession @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
+  ./salome shell @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
   ret=$?
 
   # ---------------------------------------------------------------------------
 
   kill -9 `cat "/tmp/YACSTEST_PidEcho"`
-  ./runSession killSalome.py
+  ./salome shell python killSalome.py
 
   echo "exec status YacsLoaderInSessionTest.sh "  $ret