]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
add compo list in StartContainer() method, and remove compoPath and PrereqFile in...
authorsecher <secher>
Tue, 15 May 2007 10:31:06 +0000 (10:31 +0000)
committersecher <secher>
Tue, 15 May 2007 10:31:06 +0000 (10:31 +0000)
17 files changed:
idl/SALOME_ContainerManager.idl
src/Container/Makefile.am
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/TestContainerManager.cxx [deleted file]
src/LifeCycleCORBA/Makefile.am
src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx
src/LifeCycleCORBA/TestContainerManager.cxx [new file with mode: 0644]
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx
src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx
src/SALOMELocalTrace/LocalTraceBufferPool.hxx

index 04980beab65b519c09cbf7572419c8c6a7ae6a9d..cdd128f72d73008ab16bc72e8f4920c56de44cf2 100644 (file)
@@ -45,6 +45,7 @@ struct MachineParameters
     Type to transmit list of machines.
 */
   typedef sequence<string> MachineList;
+  typedef sequence<string> CompoList;
 
 /*!
     exception thrown if a computer is not found in the catalog
@@ -64,12 +65,13 @@ struct MachineParameters
                                    in MachineList possibleComputers);
 
     Container StartContainer( in MachineParameters params,
-                             in ResPolicy policy);
+                             in ResPolicy policy,
+                             in CompoList componentList );
 
     string FindFirst(in MachineList possibleComputers);
 
     MachineList GetFittingResources( in MachineParameters params,
-                                    in string componentName )
+                                    in CompoList componentList )
       raises (SALOME::SALOME_Exception);
 
     MachineParameters GetMachineParameters( in string hostname );
index d929d72779fc81d95c9011a5ac01fa72fd61ff32..a41b9009b88961d97dd0dd82e23f89e3ca7881b8 100644 (file)
@@ -67,7 +67,6 @@ COMMON_CPPFLAGS=\
        -I$(srcdir)/../Basics \
        -I$(srcdir)/../SALOMELocalTrace \
        -I$(srcdir)/../NamingService \
-       -I$(srcdir)/../LifeCycleCORBA \
        -I$(srcdir)/../Utils \
        -I$(srcdir)/../Registry \
        -I$(srcdir)/../Notification \
@@ -82,7 +81,6 @@ COMMON_LIBS =\
        ../Notification/libSalomeNotification.la \
        ../ResourcesManager/libSalomeResourcesManager.la \
        ../NamingService/libSalomeNS.la \
-       ../LifeCycleCORBA/libSalomeLifeCycleCORBA.la \
        ../Utils/libOpUtil.la \
        ../SALOMELocalTrace/libSALOMELocalTrace.la \
        ../Basics/libSALOMEBasics.la \
@@ -123,7 +121,7 @@ libSalomeContainer_la_LIBADD =\
 # Executables targets
 # ===============================================================
 #
-bin_PROGRAMS = SALOME_Container SALOME_ContainerManagerServer TestContainerManager
+bin_PROGRAMS = SALOME_Container SALOME_ContainerManagerServer
 SALOME_Container_SOURCES =\
        SALOME_Container.cxx \
        SALOME_Container_SignalsHandler.cxx
@@ -149,13 +147,3 @@ SALOME_ContainerManagerServer_LDADD =\
        $(COMMON_LIBS) \
        ../Basics/libSALOMEBasics.la
 
-TestContainerManager_SOURCES =\
-       TestContainerManager.cxx
-
-TestContainerManager_CPPFLAGS=\
-       $(COMMON_CPPFLAGS)
-
-TestContainerManager_LDADD =\
-       libSalomeContainer.la \
-       $(COMMON_LIBS) \
-       ../Basics/libSALOMEBasics.la
index 33cc6c5799f7a86dc6ef858c97c848d98584e5d8..0bbea7465c9e5446fadc6a3175f0b6adb452a1f9 100644 (file)
@@ -286,9 +286,10 @@ StartContainer(const Engines::MachineParameters& params,
 Engines::Container_ptr
 SALOME_ContainerManager::
 StartContainer(const Engines::MachineParameters& params,
-              Engines::ResPolicy policy)
+              Engines::ResPolicy policy,
+              const Engines::CompoList& componentList)
 {
-  Engines::MachineList_var possibleComputers = GetFittingResources(params,"");
+  Engines::MachineList_var possibleComputers = GetFittingResources(params,componentList);
   return StartContainer(params,possibleComputers,policy);
 }
 
@@ -301,14 +302,14 @@ StartContainer(const Engines::MachineParameters& params,
 Engines::MachineList *
 SALOME_ContainerManager::
 GetFittingResources(const Engines::MachineParameters& params,
-                   const char *componentName)
+                   const Engines::CompoList& componentList)
 {
   MESSAGE("SALOME_ContainerManager::GetFittingResources");
   Engines::MachineList *ret=new Engines::MachineList;
   vector<string> vec;
   try
     {
-      vec = _ResManager->GetFittingResources(params,componentName);
+      vec = _ResManager->GetFittingResources(params,componentList);
     }
   catch(const SALOME_Exception &ex)
     {
index 25c4c1f6ee12e2cc45b04b1e6cad6b4d79f9e24b..42f727c125a32189663b91e49aa20b0d5391d828 100644 (file)
@@ -64,11 +64,12 @@ public:
 
   Engines::Container_ptr
   StartContainer(const Engines::MachineParameters& params,
-                Engines::ResPolicy policy);
+                Engines::ResPolicy policy,
+                const Engines::CompoList& componentList);
 
   Engines::MachineList *
   GetFittingResources(const Engines::MachineParameters& params,
-                     const char *componentName);
+                     const Engines::CompoList& componentList);
 
   char* FindFirst(const Engines::MachineList& possibleComputers);
 
diff --git a/src/Container/TestContainerManager.cxx b/src/Container/TestContainerManager.cxx
deleted file mode 100644 (file)
index ca20a10..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-//  SALOME TestContainer : test of container creation and its life cycle
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  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. 
-// 
-//  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
-//
-//
-//
-//  File   : TestContainer.cxx
-//  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
-//  Module : SALOME
-//  $Header$
-
-#include "utilities.h"
-#include <iostream>
-#include <unistd.h>
-#include <SALOMEconfig.h>
-#include "SALOME_NamingService.hxx"
-#include "SALOME_ContainerManager.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-#include "NamingService_WaitForServerReadiness.hxx"
-#include "OpUtil.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_SALOME_Exception.hxx"
-#include "Utils_CommException.hxx"
-using namespace std;
-
-int main (int argc, char * argv[])
-{
-  map<string, int> cycle;
-  map<string, int> first;
-  Engines::Container_ptr cont;
-  Engines::Component_ptr compo;
-  bool error = false;
-  bool bestImplemented;
-
-  // Initializing omniORB
-  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-  CORBA::ORB_ptr orb = init( argc , argv ) ;
-
-  SALOME_NamingService *_NS=new SALOME_NamingService(orb);
-
-  CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
-  ASSERT( !CORBA::is_nil(obj));
-  Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj);
-
-  Engines::MachineParameters p;
-
-  p.hostname = "";
-  p.OS = "LINUX";
-  p.mem_mb = 1000;
-  p.cpu_clock = 1000;
-  p.nb_proc_per_node = 1;
-  p.nb_node = 1;
-  p.isMPI = false;
-
-  char st[10];
-  for(int i=0;i<10;i++){
-    sprintf(st,"cycl_%d",i);
-    p.container_name = CORBA::string_dup(st);
-    cont = _ContManager->StartContainer(p,Engines::P_CYCL);
-    if(CORBA::is_nil(cont)) error = true;
-  }
-
-  for(int i=0;i<10;i++){
-    sprintf(st,"first_%d",i);
-    p.container_name = CORBA::string_dup(st);
-    cont = _ContManager->StartContainer(p,Engines::P_FIRST);
-    if(CORBA::is_nil(cont)) error = true;
-  }
-
-  p.container_name = CORBA::string_dup("best");
-  cont = _ContManager->StartContainer(p,Engines::P_BEST);
-  if(CORBA::is_nil(cont)) bestImplemented = false;
-  else bestImplemented = true;
-
-  SALOME_LifeCycleCORBA LCC(_NS);
-  compo = LCC.FindOrLoad_Component("FactoryServer","GEOM");
-  if(CORBA::is_nil(compo)) error = true;
-  compo = LCC.FindOrLoad_Component("FactoryServer","GEOM");
-  if(CORBA::is_nil(compo)) error = true;
-
-  _NS->Change_Directory("/Containers");
-
-  vector<string> vec = _NS->list_directory_recurs();
-  list<string> lstCont;
-  for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
-    CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
-    Engines::Container_var cont=Engines::Container::_narrow(obj);
-    if(!CORBA::is_nil(cont)){
-      cycle[cont->getHostName()]=0;
-      first[cont->getHostName()]=0;
-      lstCont.push_back((*iter));
-    }
-  }
-  for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
-    CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
-    Engines::Container_var cont=Engines::Container::_narrow(obj);
-    if(!CORBA::is_nil(cont)){
-      if(strncmp(basename(cont->name()),"cycl",4)==0)
-       cycle[cont->getHostName()]++;
-      if(strncmp(basename(cont->name()),"first",5)==0)
-       first[cont->getHostName()]++;
-    }
-  }
-  _ContManager->ShutdownContainers();
-
-  int cmin=10;
-  int cmax=0;
-  int fmin=10;
-  int fmax=0;
-  int nbpmax;
-  for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
-    if(strcmp((*iter).first.c_str(),"localhost")!=0){
-      Engines::MachineParameters *p = _ContManager->GetMachineParameters((*iter).first.c_str());
-      int nbproc = p->nb_node * p->nb_proc_per_node;
-      if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
-      if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
-      if(first[(*iter).first]/nbproc<fmin) fmin=first[(*iter).first]/nbproc;
-      if(first[(*iter).first]/nbproc>fmax){
-       fmax=first[(*iter).first]/nbproc;
-       nbpmax = nbproc;
-      }
-    }
-  }
-  if( ((cmax-cmin) <= 1) && (fmax == 10/nbpmax) && !error ){
-    string msg;
-    if(bestImplemented)
-      msg = "TEST OK";
-    else
-      msg = "TEST OK but FindBest not implemented!";
-    MESSAGE(msg);
-    return 0;
-  }
-  else{
-    MESSAGE("TEST KO");
-    return 1;
-  }
-}
index 6bee2cf3c56c4420a2c2d31c6412866c2a3de316..d6ab39e7176783fec30f1388f79c29029012e305 100644 (file)
@@ -50,11 +50,13 @@ salomeinclude_HEADERS = \
 
 # This local variable defines the list of CPPFLAGS common to all target in this package.
 COMMON_CPPFLAGS=\
+       @QT_MT_INCLUDES@ \
        -I$(srcdir)/../Basics \
        -I$(srcdir)/../SALOMELocalTrace \
        -I$(srcdir)/../SALOMETraceCollector \
        -I$(srcdir)/../NamingService \
        -I$(srcdir)/../Utils \
+       -I$(srcdir)/../Container \
        -I$(srcdir)/../ResourcesManager \
        -I$(top_builddir)/salome_adm/unix \
        -I$(top_builddir)/idl \
@@ -97,7 +99,7 @@ libSalomeLifeCycleCORBA_la_LIBADD   = $(COMMON_LIBS)
 # Executables targets
 # ===============================================================
 #
-bin_PROGRAMS = Test_LifeCycleCORBA
+bin_PROGRAMS = Test_LifeCycleCORBA TestContainerManager
 Test_LifeCycleCORBA_SOURCES  = Test_LifeCycleCORBA.cxx
 Test_LifeCycleCORBA_CPPFLAGS =\
        -I$(srcdir)/../Registry \
@@ -112,6 +114,20 @@ Test_LifeCycleCORBA_LDADD    = \
        $(COMMON_LIBS) \
        @CORBA_LIBS@
 
+TestContainerManager_SOURCES  = TestContainerManager.cxx
+TestContainerManager_CPPFLAGS =\
+       -I$(srcdir)/../Registry \
+       -I$(srcdir)/../Notification \
+       $(COMMON_CPPFLAGS)
+
+TestContainerManager_LDADD    = \
+       libSalomeLifeCycleCORBA.la \
+       ../Registry/libRegistry.la \
+       ../Notification/libSalomeNotification.la \
+       ../Container/libSalomeContainer.la \
+       $(COMMON_LIBS) \
+       @CORBA_LIBS@
+
 #CPPFLAGS += $(PYTHON_INCLUDES) $(QT_MT_INCLUDES)
 
 #LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager
index 8f7aa6ca70a8e324eedc21a8b2eed475cf575907..1503a28413a49a5d0acf939ab376963b94441a6a 100644 (file)
@@ -122,8 +122,9 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile)
       params.container_name = _containerName.c_str();
       params.hostname = _refMachine.c_str();
 
+      Engines::CompoList clist;
       Engines::MachineList_var listOfMachines =
-       contManager->GetFittingResources(params, "");
+       contManager->GetFittingResources(params, clist);
 
       container = contManager->FindOrStartContainer(params,
                                                    listOfMachines);
index ace68d25bce4db897d0b30b3a1428bdad446405d..ab84068df192536bee829494c012b3b69d76f5fe 100644 (file)
@@ -122,8 +122,11 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params,
   if (! isKnownComponentClass(componentName))
     return Engines::Component::_nil();
 
+  Engines::CompoList clist;
+  clist.length(1);
+  clist[0] = componentName;
   Engines::MachineList_var listOfMachines =
-    _ContManager->GetFittingResources(params, componentName);
+    _ContManager->GetFittingResources(params, clist);
 
   Engines::Component_var compo = _FindComponent(params,
                                                componentName,
@@ -153,8 +156,11 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params,
   if (! isKnownComponentClass(componentName))
     return Engines::Component::_nil();
 
+  Engines::CompoList clist;
+  clist.length(1);
+  clist[0] = componentName;
   Engines::MachineList_var listOfMachines =
-    _ContManager->GetFittingResources(params, componentName);
+    _ContManager->GetFittingResources(params, clist);
 
   Engines::Component_var compo = _LoadComponent(params,
                                                componentName,
@@ -186,8 +192,11 @@ FindOrLoad_Component(const Engines::MachineParameters& params,
   if (! isKnownComponentClass(componentName))
     return Engines::Component::_nil();
 
+  Engines::CompoList clist;
+  clist.length(1);
+  clist[0] = componentName;
   Engines::MachineList_var listOfMachines =
-    _ContManager->GetFittingResources(params,componentName);
+    _ContManager->GetFittingResources(params,clist);
 
   Engines::Component_var compo = _FindComponent(params,
                                                componentName,
index a1a5827706ce0c4e71b3a0ae59611f0f3acac60d..dbcca2882290dff4e16ed21ce674d14d85055401 100644 (file)
@@ -681,8 +681,11 @@ string LifeCycleCORBATest::GetRemoteHost()
   Engines::MachineParameters params;
   _LCC.preSet(params);               // empty params to get all the machines
 
+  Engines::CompoList clist;
+  clist.length(1);
+  clist[0] = "SalomeTestComponent";
   Engines::MachineList_var hostList =
-    containerManager->GetFittingResources(params,"SalomeTestComponent");
+    containerManager->GetFittingResources(params,clist);
   CPPUNIT_ASSERT(hostList->length() > 1);
 
   string localHost = GetHostname();
diff --git a/src/LifeCycleCORBA/TestContainerManager.cxx b/src/LifeCycleCORBA/TestContainerManager.cxx
new file mode 100644 (file)
index 0000000..75ecf1d
--- /dev/null
@@ -0,0 +1,160 @@
+//  SALOME TestContainer : test of container creation and its life cycle
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  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
+//
+//
+//
+//  File   : TestContainer.cxx
+//  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+//  Module : SALOME
+//  $Header$
+
+#include "utilities.h"
+#include <iostream>
+#include <unistd.h>
+#include <SALOMEconfig.h>
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "NamingService_WaitForServerReadiness.hxx"
+#include "OpUtil.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "Utils_SALOME_Exception.hxx"
+#include "Utils_CommException.hxx"
+using namespace std;
+
+int main (int argc, char * argv[])
+{
+  map<string, int> cycle;
+  map<string, int> first;
+  Engines::Container_ptr cont;
+  Engines::Component_ptr compo;
+  bool error = false;
+  bool bestImplemented;
+
+  // Initializing omniORB
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  CORBA::ORB_ptr orb = init( argc , argv ) ;
+
+  SALOME_NamingService *_NS=new SALOME_NamingService(orb);
+
+  CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+  ASSERT( !CORBA::is_nil(obj));
+  Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj);
+
+  Engines::MachineParameters p;
+  Engines::CompoList clist;
+  clist.length(2);
+  clist[0] = "MED";
+  clist[1] = "GEOM";
+
+  p.hostname = "";
+  p.OS = "LINUX";
+  p.mem_mb = 1000;
+  p.cpu_clock = 1000;
+  p.nb_proc_per_node = 1;
+  p.nb_node = 1;
+  p.isMPI = false;
+
+  char st[10];
+  for(int i=0;i<10;i++){
+    sprintf(st,"cycl_%d",i);
+    p.container_name = CORBA::string_dup(st);
+    cont = _ContManager->StartContainer(p,Engines::P_CYCL,clist);
+    if(CORBA::is_nil(cont)) error = true;
+  }
+
+  for(int i=0;i<10;i++){
+    sprintf(st,"first_%d",i);
+    p.container_name = CORBA::string_dup(st);
+    cont = _ContManager->StartContainer(p,Engines::P_FIRST,clist);
+    if(CORBA::is_nil(cont)) error = true;
+  }
+
+  p.container_name = CORBA::string_dup("best");
+  cont = _ContManager->StartContainer(p,Engines::P_BEST,clist);
+  if(CORBA::is_nil(cont)) bestImplemented = false;
+  else bestImplemented = true;
+
+  SALOME_LifeCycleCORBA LCC(_NS);
+  p.container_name = CORBA::string_dup("FactoryServer");
+  compo = LCC.FindOrLoad_Component(p,"SMESH");
+  if(CORBA::is_nil(compo)) error = true;
+  compo = LCC.FindOrLoad_Component(p,"SMESH");
+  if(CORBA::is_nil(compo)) error = true;
+
+  _NS->Change_Directory("/Containers");
+
+  vector<string> vec = _NS->list_directory_recurs();
+  list<string> lstCont;
+  for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
+    CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+    Engines::Container_var cont=Engines::Container::_narrow(obj);
+    if(!CORBA::is_nil(cont)){
+      cycle[cont->getHostName()]=0;
+      first[cont->getHostName()]=0;
+      lstCont.push_back((*iter));
+    }
+  }
+  for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
+    CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+    Engines::Container_var cont=Engines::Container::_narrow(obj);
+    if(!CORBA::is_nil(cont)){
+      if(strncmp(basename(cont->name()),"cycl",4)==0)
+       cycle[cont->getHostName()]++;
+      if(strncmp(basename(cont->name()),"first",5)==0)
+       first[cont->getHostName()]++;
+    }
+  }
+  _ContManager->ShutdownContainers();
+
+  int cmin=10;
+  int cmax=0;
+  int fmin=10;
+  int fmax=0;
+  int nbpmax;
+  for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
+    if(strcmp((*iter).first.c_str(),"localhost")!=0){
+      Engines::MachineParameters *p = _ContManager->GetMachineParameters((*iter).first.c_str());
+      int nbproc = p->nb_node * p->nb_proc_per_node;
+      if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
+      if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
+      if(first[(*iter).first]/nbproc<fmin) fmin=first[(*iter).first]/nbproc;
+      if(first[(*iter).first]/nbproc>fmax){
+       fmax=first[(*iter).first]/nbproc;
+       nbpmax = nbproc;
+      }
+    }
+  }
+  if( ((cmax-cmin) <= 1) && (fmax == 10/nbpmax) && !error ){
+    string msg;
+    if(bestImplemented)
+      msg = "TEST OK";
+    else
+      msg = "TEST OK but FindBest not implemented!";
+    MESSAGE(msg);
+    return 0;
+  }
+  else{
+    MESSAGE("TEST KO");
+    return 1;
+  }
+}
index 53162f87c22eac4529f5514222d9e8aae0c1d102..8263ca440251fbbc18f7d9bb09e0c49e17e1f3a1 100755 (executable)
@@ -58,8 +58,6 @@ SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& listOfResources):
   test_appli_path = "appliPath";
   test_modules = "modules";
   test_module_name = "moduleName";
-  test_module_path = "modulePath";
-  test_pre_req_file_path = "preReqFilePath";
   test_os = "OS";
   test_mem_in_mb = "memInMB";
   test_cpu_freq_mhz = "CPUFreqMHz";
@@ -127,6 +125,8 @@ startElement( const QString&,
               const QString& name,
               const QXmlAttributes& attrs )
 {
+  if( name.compare(QString(test_machine)) == 0 ) 
+    _resource.Clear();
   for (int i = 0;i < attrs.count();i++)
     {
       QString qName(attrs.localName(i));
@@ -187,12 +187,6 @@ startElement( const QString&,
       if ((qName.compare(QString(test_module_name)) == 0))
         previous_module_name = content;
 
-      if ((qName.compare(QString(test_module_path)) == 0))
-        previous_module_path = content;
-
-      if ((qName.compare(QString(test_pre_req_file_path)) == 0))
-        _resource.PreReqFilePath = content;
-
       if ((qName.compare(QString(test_os)) == 0))
         _resource.OS = content;
 
@@ -228,7 +222,7 @@ endElement(const QString&,
            const QString& qName)
 {
   if ((qName.compare(QString(test_modules)) == 0))
-    _resource.ModulesPath[previous_module_name] = previous_module_path;
+    _resource.ModulesList.push_back(previous_module_name);
 
   if ((qName.compare(QString(test_machine)) == 0)){
     int nbnodes = _resource.DataForSort._nbOfNodes;
@@ -239,12 +233,8 @@ endElement(const QString&,
         inode[0] = '\0' ;
         sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
         std::string nodeName(inode);
-//        _resource.DataForSort._nbOfNodes = 1;
         _resource.DataForSort._hostName = nodeName ;
         _resources_list[nodeName] = _resource;
-        //cout << "SALOME_ResourcesCatalog_Handler::endElement _resources_list["
-        //     << nodeName << "] = _resource " << _resource.DataForSort._hostName.c_str()
-        //     << endl ;
       }
     }
     else
@@ -279,21 +269,11 @@ bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars)
 
 bool SALOME_ResourcesCatalog_Handler::endDocument()
 {
-//   for (map<string, ParserResourcesType>::const_iterator iter =
-//          _resources_list.begin();
-//        iter != _resources_list.end();
-//        iter++)
-//     {
-//       SCRUTE((*iter).second.Alias);
-//       SCRUTE((*iter).second.UserName);
-//       SCRUTE((*iter).second.AppliPath);
-//       SCRUTE((*iter).second.PreReqFilePath);
-//       SCRUTE((*iter).second.OS);
-//       SCRUTE((*iter).second.Protocol);
-//       SCRUTE((*iter).second.Mode);
-//    }
+  map<string, ParserResourcesType>::const_iterator it;
+  for(it=_resources_list.begin();it!=_resources_list.end();it++)
+    (*it).second.Print();
   
-//  MESSAGE("This is the end of document");
+  MESSAGE("This is the end of document");
   return true;
 }
 
@@ -388,21 +368,17 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(QDomDocument& doc)
       eltRoot.setAttribute((char *)test_user_name,
                            (*iter).second.UserName.c_str());
 
-      for (map<string, string>::const_iterator iter2 =
-             (*iter).second.ModulesPath.begin();
-           iter2 != (*iter).second.ModulesPath.end();
+      for (vector<string>::const_iterator iter2 =
+             (*iter).second.ModulesList.begin();
+           iter2 != (*iter).second.ModulesList.end();
            iter2++)
         {
-          QDomElement rootForModulesPaths = doc.createElement(test_modules);
-          rootForModulesPaths.setAttribute(test_module_name,
-                                           (*iter2).first.c_str());
-          rootForModulesPaths.setAttribute(test_module_path,
-                                           (*iter2).second.c_str());
-          eltRoot.appendChild(rootForModulesPaths);
+          QDomElement rootForModulesList = doc.createElement(test_modules);
+          rootForModulesList.setAttribute(test_module_name,
+                                         (*iter2).c_str());
+          eltRoot.appendChild(rootForModulesList);
         }
 
-      eltRoot.setAttribute(test_pre_req_file_path,
-                           (*iter).second.PreReqFilePath.c_str());
       eltRoot.setAttribute(test_os, (*iter).second.OS.c_str());
       eltRoot.setAttribute(test_mem_in_mb,
                            (*iter).second.DataForSort._memInMB);
index 497f0dddf8beada9608a5b576818f3535f946edb..49e42c3f8e7ccf84853c0b5181535a1082427705 100755 (executable)
@@ -71,7 +71,6 @@ class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler
     QString errorProt;
     std::string content;
     std::string previous_module_name;
-    std::string previous_module_path;
 
     ParserResourcesType _resource;
     MapOfParserResourcesType& _resources_list;
@@ -87,8 +86,6 @@ class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler
     const char *test_appli_path;
     const char *test_modules;
     const char *test_module_name;
-    const char *test_module_path;
-    const char *test_pre_req_file_path;
     const char *test_os;
     const char *test_mem_in_mb;
     const char *test_cpu_freq_mhz;
index 49e594e420588f76654001805548e3c1d799758a..4d4727f6277bf16b15e14bae6631028667cf42a7 100644 (file)
@@ -112,26 +112,42 @@ void ResourceDataToSort::Print() const
     SCRUTE(_memInMB);
   }
 
-void ParserResourcesType::Print()
+void ParserResourcesType::Print() const
 {
-  MESSAGE("##############*****");
-  MESSAGE("HostName : " << DataForSort._hostName);
-  MESSAGE("Alias : " << Alias);
-  MESSAGE("Protocol : " << Protocol);
-  MESSAGE("Mode : " << Mode);
-  MESSAGE("UserName : " << UserName);
-  MESSAGE("Modules : ");
-  int i = 1;
-
-  for (std::map<std::string, std::string>::iterator iter = ModulesPath.begin();
-       iter != ModulesPath.end();
-       iter++)
-    {
-      MESSAGE("Module " << i++ << " called : " << (*iter).first
-              << " with path : " << (*iter).second);
-    }
-
-  MESSAGE("PreReqFilePath : " << PreReqFilePath);
-  MESSAGE("OS : " << OS);
-  DataForSort.Print();
+  ostringstream oss;
+  oss << endl <<
+    "HostName : " << DataForSort._hostName << endl << 
+    "Alias : " << Alias << endl <<
+    "NbOfNodes : " << DataForSort._nbOfNodes << endl <<
+    "NbOfProcPerNode : " << DataForSort._nbOfProcPerNode << endl <<
+    "CPUFreqMHz : " << DataForSort._CPUFreqMHz << endl <<
+    "MemInMB : " << DataForSort._memInMB << endl <<
+    "Protocol : " << Protocol << endl <<
+    "Mode : " << Mode << endl <<
+    "UserName : " << UserName << endl <<
+    "AppliPath : " << AppliPath << endl <<
+    "OS : " << OS << endl <<
+    "Modules : " << endl;
+
+  for(int i=0;i<ModulesList.size();i++)
+    oss << "Module " << i+1 << " called : " << ModulesList[i] << endl;
+
+  MESSAGE(oss.str());
+
+}
+
+void ParserResourcesType::Clear()
+{
+  DataForSort._hostName = "";
+  DataForSort._nbOfNodes = 1;
+  DataForSort._nbOfProcPerNode = 1;
+  DataForSort._CPUFreqMHz = 0;
+  DataForSort._memInMB = 0;
+  Alias = "";
+  Protocol = rsh;
+  Mode = interactive;
+  UserName = "";
+  AppliPath = "";
+  ModulesList.clear();
+  OS = "";
 }
index 16e5e82af712bfd44066a4f8bd6c41ea6d64c433..025d1e62846cbf648159d24a8a5c354335ed514b 100755 (executable)
@@ -34,8 +34,6 @@
 #include <map>
 #include <iostream>
 
-typedef std::map<std::string, std::string> MapOfModulesPath;
-
 enum AccessProtocolType {rsh, ssh};
 
 enum AccessModeType {interactive, batch};
@@ -76,11 +74,11 @@ struct ParserResourcesType
     AccessModeType Mode;
     std::string UserName;
     std::string AppliPath;
-    MapOfModulesPath ModulesPath;
-    std::string PreReqFilePath;
+    std::vector<std::string> ModulesList;
     std::string OS;
 
-    void Print();
+    void Print() const;
+    void Clear();
   };
 
 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
index 2637bd5e280cbb58d17d16b21b7db1b7bd6b2fda..72073dbfa630dc6121bd837b2a401f2924e51692 100644 (file)
@@ -121,7 +121,7 @@ SALOME_ResourcesManager::~SALOME_ResourcesManager()
 vector<string>
 SALOME_ResourcesManager::
 GetFittingResources(const Engines::MachineParameters& params,
-                    const char *moduleName)
+                    const Engines::CompoList& componentList)
 throw(SALOME_Exception)
 {
 //   MESSAGE("ResourcesManager::GetFittingResources");
@@ -179,7 +179,7 @@ throw(SALOME_Exception)
     {
       SelectOnlyResourcesWithOS(ret, params.OS);
 
-      KeepOnlyResourcesWithModule(ret, moduleName);
+      KeepOnlyResourcesWithModule(ret, componentList);
 
       if (ret.size() == 0)
         SelectOnlyResourcesWithOS(ret, params.OS);
@@ -226,16 +226,16 @@ throw(SALOME_Exception)
 int
 SALOME_ResourcesManager::
 AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources,
-                     const map<string, string>& modulesOnNewResources,
-                     const char *environPathOfPrerequired,
+                     const vector<string>& modulesOnNewResources,
                      const char *alias,
                      const char *userName,
                      AccessModeType mode,
                      AccessProtocolType prot)
 throw(SALOME_Exception)
 {
-  map<string, string>::const_iterator iter =
-    modulesOnNewResources.find("KERNEL");
+  vector<string>::const_iterator iter = find(modulesOnNewResources.begin(),
+                                            modulesOnNewResources.end(),
+                                            "KERNEL");
 
   if (iter != modulesOnNewResources.end())
     {
@@ -245,8 +245,7 @@ throw(SALOME_Exception)
       newElt.Protocol = prot;
       newElt.Mode = mode;
       newElt.UserName = userName;
-      newElt.ModulesPath = modulesOnNewResources;
-      newElt.PreReqFilePath = environPathOfPrerequired;
+      newElt.ModulesList = modulesOnNewResources;
       newElt.OS = paramsOfNewResources.OS;
       newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
       newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
@@ -628,7 +627,7 @@ SALOME_ResourcesManager::BuildCommand
 
   command += machine;
   command += " ";
-  string path = (*(resInfo.ModulesPath.find("KERNEL"))).second;
+  string path = getenv("KERNEL_ROOT_DIR");
   command += path;
   command += "/bin/salome/";
 
@@ -689,17 +688,27 @@ throw(SALOME_Exception)
 void
 SALOME_ResourcesManager::KeepOnlyResourcesWithModule
 ( vector<string>& hosts,
-  const char *moduleName) const
+  const Engines::CompoList& componentList) const
 throw(SALOME_Exception)
 {
   for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
     {
       MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
-      const map<string, string>& mapOfModulesOfCurrentHost =
-        (((*it).second).ModulesPath);
-
-      if (mapOfModulesOfCurrentHost.find(moduleName) ==
-          mapOfModulesOfCurrentHost.end())
+      const vector<string>& mapOfModulesOfCurrentHost = (((*it).second).ModulesList);
+
+      bool erasedHost = false;
+      if( mapOfModulesOfCurrentHost.size() > 0 ){
+       for(int i=0;i<componentList.length();i++){
+         vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
+                                             mapOfModulesOfCurrentHost.end(),
+                                             componentList[i]);
+         if (itt == mapOfModulesOfCurrentHost.end()){
+           erasedHost = true;
+           break;
+         }
+       }
+      }
+      if(erasedHost)
         hosts.erase(iter);
       else
         iter++;
@@ -805,27 +814,6 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer
 
   // --- set env vars
 
-  tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
-
-  for (map<string, string>::const_iterator iter = resInfo.ModulesPath.begin();
-       iter != resInfo.ModulesPath.end();
-       iter++)
-    {
-      string curModulePath((*iter).second);
-      tempOutputFile << (*iter).first << "_ROOT_DIR=" << curModulePath << endl;
-      tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl;
-      tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath
-                    << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl;
-      tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:"
-                    << curModulePath << "/lib/salome:" << curModulePath
-                    << "/lib/python${PYTHON_VERSION}/site-packages/salome:";
-      tempOutputFile << curModulePath
-      << "/lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules:${PYTHONPATH}"
-      << endl;
-    }
-
-  tempOutputFile << "export LD_LIBRARY_PATH" << endl;
-  tempOutputFile << "export PYTHONPATH" << endl;
   tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace"
   //tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
 
@@ -853,8 +841,7 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer
 #endif
     }
 
-  tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second
-                << "/bin/salome/";
+  tempOutputFile << getenv("KERNEL_ROOT_DIR") << "/bin/salome/";
 
   if (params.isMPI)
     {
index 0d9c651374ee1f98e90aa5c5a12f3c4263c08351..5cd69615627b45972f813ceb565835ecbe501ce8 100644 (file)
@@ -65,7 +65,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
 
     std::vector<std::string>
     GetFittingResources(const Engines::MachineParameters& params,
-                        const char *moduleName)
+                        const Engines::CompoList& componentList)
     throw(SALOME_Exception);
 
     std::string FindFirst(const Engines::MachineList& listOfMachines);
@@ -86,8 +86,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
 
     int AddResourceInCatalog
     (const Engines::MachineParameters& paramsOfNewResources,
-     const std::map<std::string, std::string>& modulesOnNewResources,
-     const char *environPathOfPrerequired,
+     const std::vector<std::string>& modulesOnNewResources,
      const char *alias,
      const char *userName,
      AccessModeType mode,
@@ -116,7 +115,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
       throw(SALOME_Exception);
 
     void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
-                                    const char *moduleName) const
+                                    const Engines::CompoList& componentList) const
       throw(SALOME_Exception);
 
     void AddOmninamesParams(std::string& command) const;
index 85845ea2fc85badf1fca79aa5eb7a9e4f1233341..1575b186a0e3b1c042aea509518cb249a7f91429 100644 (file)
@@ -26,7 +26,7 @@
 
 #define TRACE_BUFFER_SIZE 256  // number of entries in circular buffer
                                // must be power of 2
-#define MAX_TRACE_LENGTH 256   // messages are truncated at this size
+#define MAX_TRACE_LENGTH 1024   // messages are truncated at this size
 
 #include <pthread.h>
 #include <semaphore.h>