]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
manage MPI containers in resources manager
authorsecher <secher>
Tue, 24 May 2005 11:59:53 +0000 (11:59 +0000)
committersecher <secher>
Tue, 24 May 2005 11:59:53 +0000 (11:59 +0000)
30 files changed:
Makefile.in
idl/SALOME_ContainerManager.idl
idl/SALOME_MPIContainer.idl
resources/CatalogResources.xml
resources/CatalogRessources.xml [deleted file]
src/Container/Component_i.cxx
src/Container/Container_i.cxx
src/Container/SALOME_Component_i.hxx
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/SALOME_Container_i.hxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
src/MPIContainer/MPIContainer_i.cxx
src/MPIContainer/MPIContainer_i.hxx
src/MPIContainer/SALOME_MPIContainer.cxx
src/MPILifeCycleCORBA/MPILifeCycleCORBA.py [deleted file]
src/MPILifeCycleCORBA/MPIsalome.py [deleted file]
src/MPILifeCycleCORBA/Makefile.in [deleted file]
src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx [deleted file]
src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx [deleted file]
src/MPILifeCycleCORBA/TestMPILifeCycleCORBA.cxx [deleted file]
src/Makefile.in
src/NamingService/SALOME_NamingService.cxx
src/NamingService/SALOME_NamingService.hxx
src/RegistryDisplay/RegWidget.hxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx
src/TestMPIContainer/Makefile.in
src/TestMPIContainer/TestMPIContainer.cxx

index 5c92e402e779095989ee492e830ebc35c5d90c73..84ed33f36e0328ffe434fee2ccddedde274128f8 100644 (file)
@@ -22,7 +22,6 @@ cascade.png \
 CatalogDataType.xml \
 KERNELCatalog.xml \
 CatalogResources.xml \
-CatalogRessources.xml \
 close.png \
 config \
 default.png \
index d8a57247e64dc64a88d089854c57999d41949d2d..cba348c1825691d8ad6c3206caf71355f04e13d8 100644 (file)
@@ -17,6 +17,7 @@ struct MachineParameters {
   long cpu_clock;
   long nb_proc_per_node;
   long nb_node;
+  boolean isMPI;
 };
 
 /*!
@@ -29,7 +30,7 @@ struct MachineParameters {
 */
   interface ContainerManager
   {
-    Container FindOrStartContainer( in string containerName, in MachineList possibleComputers);
+    Container FindOrStartContainer( in MachineParameters params, in MachineList possibleComputers);
     string FindBest(in MachineList possibleComputers);
     MachineList GetFittingResources( in MachineParameters params, in string componentName );
     void Shutdown();
index c23e1c06107f97c6d1b8e9c6d03077fbdcb5db95..8265c7380425796268ea6a409a5da2f29015db68 100644 (file)
@@ -34,9 +34,6 @@ module Engines
     // start MPI container executable
     MPIContainer start_MPIimpl( in string ContainerName, in short nbproc );
 
-    //   shutdown corba server
-    void MPIShutdown() ;
-
     // asynchronous version to load and remove parallel component in parallel
     oneway void SPload_impl(in string nameToRegister, in string componentName);
     oneway void SPremove_impl(in Component component_i);
index 99939a37803fa36e607d76e9a7b5b5610afb20ba..985ea985888aab820ebb42cc2158d8399e87ca4b 100644 (file)
@@ -1,8 +1,18 @@
 <!DOCTYPE ResourcesCatalog>
 <resources>
-<machine protocol="r" nbOfNodes="1" mode="i" OS="LINUX" CPUFreqMHz="3200" userName="BS" memInMB="1024" preReqFilePath="/export/home/kloss/Salome2_2.1.0_22.12.04/env_products.sh" nbOfProcPerNode="1" alias="is111793" hostname="is111793" >
-<modules modulePath="/export/home/kloss/Salome2_2.1.0_22.12.04/CCRTTEST_INSTALL" moduleName="CCRTTEST" />
-  <modules modulePath="/export/home/kloss/Salome2_2.1.0_22.12.04/KERNEL_INSTALL" moduleName="KERNEL" /> </machine>
- <machine protocol="r" nbOfNodes="1" mode="i" OS="LINUX" CPUFreqMHz="3200" userName="geay" memInMB="1024" preReqFilePath="/export/home/geay/SALOME_RES_MAN/env_products.sh" nbOfProcPerNode="1" alias="is111918" hostname="is111918" >
-<modules modulePath="/export/home/geay/CCRTTEST/CCRTTEST_INSTALL" moduleName="CCRTTEST" />
-  <modules modulePath="/export/home/geay/SALOME_RES_MAN/KERNEL_INSTALL" moduleName="KERNEL" /> </machine></resources>
+<machine protocol="r" nbOfNodes="1" mode="i" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" nbOfProcPerNode="1" alias="is111790" hostname="is111790" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+  <modules modulePath="/export/home/LGLS/Products/MED_2.2.2" moduleName="MED" />   <modules modulePath="/export/home/LGLS/Products/GEOM_2.2.2" moduleName="GEOM" />   <modules modulePath="/export/home/LGLS/Products/SMESH_2.2.2" moduleName="SMESH" />   <modules modulePath="/export/home/LGLS/Products/SUPERV_2.2.2" moduleName="SUPERV" />   <modules modulePath="/export/home/LGLS/Products/VISU_2.2.2" moduleName="VISU" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" /> </machine>
+
+<machine protocol="r" nbOfNodes="1" mode="i" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" nbOfProcPerNode="1" alias="is111915" hostname="is111915" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+  <modules modulePath="/export/home/LGLS/Products/MED_2.2.2" moduleName="MED" />   <modules modulePath="/export/home/LGLS/Products/GEOM_2.2.2" moduleName="GEOM" />   <modules modulePath="/export/home/LGLS/Products/SMESH_2.2.2" moduleName="SMESH" />   <modules modulePath="/export/home/LGLS/Products/SUPERV_2.2.2" moduleName="SUPERV" />   <modules modulePath="/export/home/LGLS/Products/VISU_2.2.2" moduleName="VISU" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" /> </machine>
+
+<machine protocol="r" nbOfNodes="1" mode="i" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" nbOfProcPerNode="1" alias="is111918" hostname="is111918" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+  <modules modulePath="/export/home/LGLS/Products/MED_2.2.2" moduleName="MED" />   <modules modulePath="/export/home/LGLS/Products/GEOM_2.2.2" moduleName="GEOM" />   <modules modulePath="/export/home/LGLS/Products/SMESH_2.2.2" moduleName="SMESH" />   <modules modulePath="/export/home/LGLS/Products/SUPERV_2.2.2" moduleName="SUPERV" />   <modules modulePath="/export/home/LGLS/Products/VISU_2.2.2" moduleName="VISU" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" /> </machine>
+
+<machine protocol="r" nbOfNodes="1" mode="i" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" nbOfProcPerNode="1" alias="is111996" hostname="is111996" >
+<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
+  <modules modulePath="/export/home/LGLS/Products/MED_2.2.2" moduleName="MED" />   <modules modulePath="/export/home/LGLS/Products/GEOM_2.2.2" moduleName="GEOM" />   <modules modulePath="/export/home/LGLS/Products/SMESH_2.2.2" moduleName="SMESH" />   <modules modulePath="/export/home/LGLS/Products/SUPERV_2.2.2" moduleName="SUPERV" />   <modules modulePath="/export/home/LGLS/Products/VISU_2.2.2" moduleName="VISU" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" /> <modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" /> </machine>
+</resources>
diff --git a/resources/CatalogRessources.xml b/resources/CatalogRessources.xml
deleted file mode 100644 (file)
index 2200b41..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<Ressources-list>
-       <computer>
-               <name>eri</name>
-               <OS>Linux</OS>
-               <OS-version>2.2.14-6.1.1smp</OS-version>
-               <proc-list>
-                       <proc>
-                               <number>0</number>
-                               <model>Pentium III (Coppermine)</model>
-                               <CPU-MHz>860.946775</CPU-MHz>
-                               <cache>256</cache>
-                       </proc>
-                       <proc>
-                               <number>1</number>
-                               <model>Pentium III (Coppermine)</model>
-                               <CPU-MHz>860.946775</CPU-MHz>
-                               <cache>256</cache>
-                       </proc>
-               </proc-list>
-               <containertype-list>
-                               <containertype>C++</containertype>
-                               <containertype>python</containertype>
-                               <containertype>NP</containertype>
-               </containertype-list>
-       </computer>
-       <computer>
-               <name>omote</name>
-               <OS>Linux</OS>
-               <OS-version>2.4.3-12smp</OS-version>
-               <proc-list>
-                       <proc>
-                               <number>0</number>
-                               <model>Pentium II (Deschutes)</model>
-                               <CPU-MHz>398.780</CPU-MHz>
-                               <cache>512</cache>
-                       </proc>
-               </proc-list>
-               <containertype-list>
-                               <containertype>C++</containertype>
-                               <containertype>python</containertype>
-               </containertype-list>
-       </computer>
-</Ressources-list>
index ff343a2cc5065e9a6c22413bd13dc2dfca994d59..7bde5d8fc107af34b4121cc4897ca6902cab7500 100644 (file)
@@ -407,11 +407,3 @@ string Engines_Component_i::GetDynLibraryName(const char *componentName)
   return ret;
 }
 
-string Engines_Component_i::BuildComponentNameForNS(const char *ComponentName, const char *ContainerName, const char *hostname)
-{
-  string ret=Engines_Container_i::BuildContainerNameForNS(ContainerName,hostname);
-  ret+="/";
-  ret+=ComponentName;
-  return ret;
-}
-
index 2a4257217fc0f766672fc8be8a8c7a98637aea0c..919bbf03bbd138950211a0ae9facde332680ea9b 100644 (file)
@@ -53,8 +53,6 @@ char ** _ArgV ;
 extern "C" {void ActSigIntHandler() ; }
 extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
 
-const char *Engines_Container_i::_defaultContainerName="FactoryServer";
-
 Engines_Container_i::Engines_Container_i () :
  _numInstance(0)
 {
@@ -102,8 +100,6 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
 
   SCRUTE(hostname);
 
-  _containerName = BuildContainerNameForNS(containerName,hostname.c_str());
-
   _orb = CORBA::ORB::_duplicate(orb) ;
   _poa = PortableServer::POA::_duplicate(poa) ;
 
@@ -116,6 +112,8 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
     CORBA::Object_var obj=_poa->id_to_reference(*_id);
     Engines::Container_var pCont 
       = Engines::Container::_narrow(obj);
+
+    _containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str());
     SCRUTE(_containerName);
     _NS->Register(pCont, _containerName.c_str()); 
   }
@@ -353,19 +351,6 @@ bool Engines_Container_i::isPythonContainer(const char* ContainerName)
   return ret;
 }
 
-string Engines_Container_i::BuildContainerNameForNS(const char *ContainerName, const char *hostname)
-{
-  string ret="/Containers/";
-  ret += hostname;
-  ret+="/";
-  if (strlen(ContainerName)== 0)
-    ret+=_defaultContainerName;
-  else
-    ret += ContainerName;
-  return ret;
-}
-
-
 /*
  *  Create one instance of componentName component and register it 
  *  as nameToRegister in naming service
index 620ca149985180f4ad5e05556e2a2f8757a9a46a..65e0ae77d3cf8e6488d32b6c861ace2afbf93eb7 100644 (file)
@@ -93,7 +93,6 @@ public:
   CORBA::Long CpuUsed_impl() ;
 
   static std::string GetDynLibraryName(const char *componentName);
-  static std::string BuildComponentNameForNS(const char *ComponentName, const char *ContainerName, const char *hostname);
 protected:
   std::string _instanceName ;
   std::string _interfaceName ;
index 77cebf354f276ab3fdf1011c6f677b222330fcbb..d3b5f53ffe52b1b0500bb050f23f810905046348 100644 (file)
@@ -14,6 +14,7 @@ const char *SALOME_ContainerManager::_ContainerManagerNameInNS="/ContainerManage
 SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb)
 {
   _NS=new SALOME_NamingService(orb);
+  _ResManager=new SALOME_ResourcesManager(orb);
   PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
   PortableServer::POAManager_var pman = root_poa->the_POAManager();
   PortableServer::POA_var my_poa;
@@ -32,6 +33,7 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb)
 SALOME_ContainerManager::~SALOME_ContainerManager()
 {
   delete _NS;
+  delete _ResManager;
 }
 
 void SALOME_ContainerManager::Shutdown()
@@ -49,6 +51,7 @@ void SALOME_ContainerManager::ShutdownContainers()
   vector<string> vec=_NS->list_directory_recurs();
   for(vector<string>::iterator iter=vec.begin();iter!=vec.end();iter++)
     {
+      cerr << "SALOME_ContainerManager::ShutdownContainers : " << (*iter).c_str() << endl;
       SCRUTE((*iter));
       CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
       Engines::Container_var cont=Engines::Container::_narrow(obj);
@@ -57,21 +60,23 @@ void SALOME_ContainerManager::ShutdownContainers()
     }
 }
 
-Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const char *containerName, const Engines::MachineList& possibleComputers)
+Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputers)
 {
-  Engines::Container_ptr ret=FindContainer(containerName,possibleComputers);
+  Engines::Container_ptr ret=FindContainer(params,possibleComputers);
   if(!CORBA::is_nil(ret))
     return ret;
   // Container doesn't exist try to launch it ...
+  MESSAGE("Container doesn't exist try to launch it ...");
   vector<string> vector;
   string theMachine=_LoadManager.FindBest(possibleComputers);
   string command;
   if(theMachine==GetHostname())
-    command=_ResManager.BuildCommandToLaunchLocalContainer(containerName);
+    command=_ResManager->BuildCommandToLaunchLocalContainer(params);
   else
-    command=_ResManager.BuildTempFileToLaunchRemoteContainer(theMachine,containerName);
-  _ResManager.RmTmpFile();
+    command=_ResManager->BuildTempFileToLaunchRemoteContainer(theMachine,params);
+  _ResManager->RmTmpFile();
   int status=system(command.c_str());
+  cerr << status << endl;
   if (status == -1) {
     MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)");
     return Engines::Container::_nil();
@@ -87,7 +92,7 @@ Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const char
       count-- ;
       if ( count != 10 )
        MESSAGE( count << ". Waiting for FactoryServer on " << theMachine);
-      string containerNameInNS=BuildContainerNameInNS(containerName,theMachine.c_str());
+      string containerNameInNS=_NS->BuildContainerNameForNS(params,theMachine.c_str());
       SCRUTE(containerNameInNS);
       CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
       ret=Engines::Container::_narrow(obj);
@@ -101,7 +106,7 @@ Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const char
 
 Engines::MachineList *SALOME_ContainerManager::GetFittingResources(const Engines::MachineParameters& params, const char *componentName)
 {
-  vector<string> vec=_ResManager.GetFittingResources(params,componentName);
+  vector<string> vec=_ResManager->GetFittingResources(params,componentName);
   Engines::MachineList *ret=new Engines::MachineList;
   ret->length(vec.size());
   for(unsigned int i=0;i<vec.size();i++)
@@ -117,10 +122,9 @@ char* SALOME_ContainerManager::FindBest(const Engines::MachineList& possibleComp
     return CORBA::string_dup(theMachine.c_str());
   }
 
-Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *containerName,const char *theMachine)
+Engines::Container_ptr SALOME_ContainerManager::FindContainer(const Engines::MachineParameters& params,const char *theMachine)
 {
-  string containerNameInNS(BuildContainerNameInNS(containerName,theMachine));
-  SCRUTE(containerNameInNS);
+  string containerNameInNS(_NS->BuildContainerNameForNS(params,theMachine));
   CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
   if( !CORBA::is_nil(obj) )
     return Engines::Container::_narrow(obj);
@@ -128,22 +132,13 @@ Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *contai
     return Engines::Container::_nil();
 }
 
-Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *containerName,const Engines::MachineList& possibleComputers)
+Engines::Container_ptr SALOME_ContainerManager::FindContainer(const Engines::MachineParameters& params,const Engines::MachineList& possibleComputers)
 {
   for(unsigned int i=0;i<possibleComputers.length();i++)
     {
-      Engines::Container_ptr cont=FindContainer(containerName,possibleComputers[i]);
+      Engines::Container_ptr cont=FindContainer(params,possibleComputers[i]);
       if( !CORBA::is_nil(cont) )
        return cont;
     }
   return Engines::Container::_nil();
 }
-
-string SALOME_ContainerManager::BuildContainerNameInNS(const char *containerName,const char *machineName)
-{
-  string containerNameInNS("/Containers/");
-  containerNameInNS+=machineName;
-  containerNameInNS+="/";
-  containerNameInNS+=containerName;
-  return containerNameInNS;
-}
index 9293f18814e7624fb78eab6f0b1f758838dec24d..d53ba5e8748cd8673d305d8bd489c891b41da5f2 100644 (file)
@@ -14,13 +14,13 @@ class SALOME_NamingService;
 class SALOME_ContainerManager: public POA_Engines::ContainerManager,
                               public PortableServer::RefCountServantBase {
 private:
-  SALOME_ResourcesManager _ResManager;
+  SALOME_ResourcesManager *_ResManager;
   SALOME_LoadRateManager _LoadManager;
   SALOME_NamingService *_NS;
 public:
   SALOME_ContainerManager(CORBA::ORB_ptr orb);
   ~SALOME_ContainerManager();
-  Engines::Container_ptr FindOrStartContainer(const char *containerName, const Engines::MachineList& possibleComputer);
+  Engines::Container_ptr FindOrStartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputer);
   Engines::MachineList *GetFittingResources(const Engines::MachineParameters& params, const char *componentName);
   char* FindBest(const Engines::MachineList& possibleComputers);
   void Shutdown();
@@ -28,9 +28,8 @@ public:
 
   static const char *_ContainerManagerNameInNS;
 private:
-  Engines::Container_ptr FindContainer(const char *containerName,const Engines::MachineList& possibleComputers);
-  Engines::Container_ptr FindContainer(const char *containerName,const char *theMachine);
-  std::string BuildContainerNameInNS(const char *containerName,const char *machineName);
+  Engines::Container_ptr FindContainer(const Engines::MachineParameters& params,const Engines::MachineList& possibleComputers);
+  Engines::Container_ptr FindContainer(const Engines::MachineParameters& params,const char *theMachine);
 };
 
 #endif
index 1f0eb93cc523e7fc83a71cc79063edc8d62354bf..c9272b5bb5a4a9357e390020a8fac95a86c71c28 100644 (file)
@@ -70,8 +70,8 @@ public:
 
   char* name();
   char* machineName();
-  void ping();
-  void Shutdown();
+  virtual void ping();
+  virtual void Shutdown();
   //! Kill current container
   bool Kill_impl() ;
 
@@ -79,8 +79,6 @@ public:
   CORBA::Long getPID();
   static bool isPythonContainer(const char* ContainerName);
 
-  static std::string BuildContainerNameForNS(const char *ContainerName, const char *hostname);
-  static const char *_defaultContainerName;
 protected:
 
   SALOME_NamingService *_NS ;
index af5848155456dab9d351cc21659f2bee223306c6..82408c66afc620447506c745a152e1aaf96db432 100644 (file)
@@ -2,7 +2,7 @@
 //
 //  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 
 #include "SALOME_NamingService.hxx"
 using namespace std;
 
+IncompatibleComponent::IncompatibleComponent( void ): SALOME_Exception( "IncompatibleComponent" )
+{
+       ;
+}
+IncompatibleComponent::IncompatibleComponent( const IncompatibleComponent &ex  ): SALOME_Exception( ex ) 
+{
+       ;
+}
+
 SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
 {
   _NS = ns;
@@ -58,39 +67,6 @@ SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
 {
 }
 
-string SALOME_LifeCycleCORBA::ContainerName(
-                                         const char * aComputerContainer ,
-                                         string * theComputer ,
-                                         string * theContainer ) {
-  char * ContainerName = new char [ strlen( aComputerContainer ) + 1 ] ;
-  strcpy( ContainerName , aComputerContainer ) ;
-  string theComputerContainer("/Containers/");
-  char * slash = strchr( ContainerName , '/' ) ;
-  if ( !slash ) {
-    *theComputer = GetHostname() ;
-    theComputerContainer += *theComputer ;
-    theComputerContainer += "/" ;
-    *theContainer = ContainerName ;
-    theComputerContainer += *theContainer ;
-  }
-  else {
-    slash[ 0 ] = '\0' ;
-    slash += 1 ;
-    *theContainer = slash ;
-    if ( !strcmp( ContainerName , "localhost" ) ) {
-      *theComputer = GetHostname() ;
-    }
-    else {
-      *theComputer = ContainerName ;
-    }
-    theComputerContainer += *theComputer ;
-    theComputerContainer += "/" ;
-    theComputerContainer += *theContainer ;
-  }
-  delete [] ContainerName;
-  return theComputerContainer ;
-}
-
 bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
 {
 
@@ -119,206 +95,117 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
   return false;
 }
 
-string SALOME_LifeCycleCORBA::ComputerPath(
-                                         const char * theComputer ) {
-  CORBA::String_var path;
-  CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
-  SALOME_ModuleCatalog::ModuleCatalog_var Catalog = 
-                    SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
-  try {
-    path = Catalog->GetPathPrefix( theComputer );
-  }
-  catch (SALOME_ModuleCatalog::NotFound&) {
-    INFOS("GetPathPrefix(" << theComputer << ") not found!");
-    path = "" ;
-  }
-  SCRUTE( path ) ;
-  return CORBA::string_dup( path ) ;
-}
-
-Engines::Container_ptr SALOME_LifeCycleCORBA::FindContainer(const char *containerName)
+bool SALOME_LifeCycleCORBA::isMpiContainer(const Engines::MachineParameters& params) throw(IncompatibleComponent)
 {
-  ASSERT(_NS != NULL);
-  string cont ;
-  if ( strncmp( containerName , "/Containers/" , 12 ) ) { // Compatibility ...
-    string theComputer ;
-    string theContainer ;
-    cont = ContainerName( containerName , &theComputer , &theContainer ) ;
-  }
-  else {
-    cont = containerName ;
-  }
-  try {
+//   MESSAGE(params.container_name)
+//   if( strstr(params.container_name,"MPI") ){
+//     if( !params.isMPI ){
+//       cerr << "IncompatibleComponent" << endl;
+//       throw IncompatibleComponent();
+//     }
+//     return true;
+//   }
+//   else{
+//     if( params.isMPI ){
+//       cerr << "IncompatibleComponent" << endl;
+//       throw IncompatibleComponent();
+//     }
+//     return false;
+//   }
+  if( params.isMPI )
+    return true;
+  else
+    return false;
 
-    SCRUTE( cont );
+}
 
-    CORBA::Object_var obj = _NS->Resolve( cont.c_str() );
-    if( !CORBA::is_nil( obj ) ) {
-      return Engines::Container::_narrow( obj ) ;
-    }
-  }
-  catch (ServiceUnreachable&) {
-    INFOS("Caught exception: Naming Service Unreachable");
-  }
-  catch (...) {
-    INFOS("Caught unknown exception.");
-  }
-  return Engines::Container::_nil();
+int SALOME_LifeCycleCORBA::NbProc(const Engines::MachineParameters& params)
+{
+  if( !isMpiContainer(params) )
+    return 0;
+  else if( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+    return 1;
+  else if( params.nb_node == 0 )
+    return params.nb_proc_per_node;
+  else if( params.nb_proc_per_node == 0 )
+    return params.nb_node;
+  else
+    return params.nb_node * params.nb_proc_per_node;
 }
 
 Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component
                                   (const char *containerName,
                                   const char *componentName)
 {
+  // Check if Component Name is known
   if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
+
+  // Chack if containerName contains machine name (if yes: rg>0)
   char *stContainer=strdup(containerName);
   string st2Container(stContainer);
   int rg=st2Container.find("/");
-  if(rg>=0)
-    {
-      stContainer[rg]='\0';
-      if(strcmp(stContainer,"localhost")==0)
-       {
-         Engines::Component_ptr ret=FindOrLoad_Component(stContainer+rg+1,componentName);
-         free(stContainer);
-         return ret;
-       }
-    }
+
+  Engines::MachineParameters_var params=new Engines::MachineParameters;
   if(rg<0) {
-    //containerName doesn't contain "/" => Local container
-    free(stContainer);
-    Engines::MachineList_var listOfMachine=new Engines::MachineList;
-    listOfMachine->length(1);
-    listOfMachine[0]=CORBA::string_dup(GetHostname().c_str());
-    Engines::Component_ptr ret=FindComponent(containerName,componentName,listOfMachine.in());
-    if(CORBA::is_nil(ret))
-      return LoadComponent(containerName,componentName,listOfMachine);
-    else
-      return ret;
+    params->container_name=CORBA::string_dup(stContainer);
+    params->hostname=CORBA::string_dup(GetHostname().c_str());
   }
   else {
-    //containerName contains "/" => Remote container
     stContainer[rg]='\0';
-    Engines::MachineParameters_var params=new Engines::MachineParameters;
     params->container_name=CORBA::string_dup(stContainer+rg+1);
     params->hostname=CORBA::string_dup(stContainer);
-    params->OS=CORBA::string_dup("LINUX");
-    free(stContainer);
-    return FindOrLoad_Component(params,componentName);
   }
+  free(stContainer);
+  return FindOrLoad_Component(params,componentName);
+  
 }
 
-Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& params,
-                                                                  const char *componentName)
+Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& params, const char *componentName)
 {
   if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
+
   Engines::MachineList_var listOfMachine=_ContManager->GetFittingResources(params,componentName);
-  Engines::Component_ptr ret=FindComponent(params.container_name,componentName,listOfMachine);
+  Engines::Component_ptr ret=FindComponent(params,componentName,listOfMachine);
   if(CORBA::is_nil(ret))
-    return LoadComponent(params.container_name,componentName,listOfMachine);
+    return LoadComponent(params,componentName,listOfMachine);
   else
     return ret;
 }
 
-Engines::Component_ptr SALOME_LifeCycleCORBA::FindComponent(const char *containerName,
-                                                                const char *componentName,
-                                                                const Engines::MachineList& listOfMachines)
+Engines::Component_ptr SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, const char *componentName, const Engines::MachineList& listOfMachines)
 {
+  const char *containerName = params.container_name;
+  int nbproc = NbProc(params);
+  cerr << nbproc << endl;;
+
   if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
-  if(containerName[0]!='\0')
-    {
-      Engines::MachineList_var machinesOK=new Engines::MachineList;
-      unsigned int lghtOfmachinesOK=0;
-      machinesOK->length(listOfMachines.length());
-      for(unsigned int i=0;i<listOfMachines.length();i++)
-       {
-         const char *currentMachine=listOfMachines[i];
-         string componentNameForNS=Engines_Component_i::BuildComponentNameForNS(componentName,containerName,currentMachine);
-         CORBA::Object_var obj = _NS->Resolve(componentNameForNS.c_str());
-         if(!CORBA::is_nil(obj))
-           {
-             machinesOK[lghtOfmachinesOK++]=CORBA::string_dup(currentMachine);
-           }
-       }
-      if(lghtOfmachinesOK!=0)
-       {
-         machinesOK->length(lghtOfmachinesOK);
-         CORBA::String_var bestMachine=_ContManager->FindBest(machinesOK);
-         string componentNameForNS=Engines_Component_i::BuildComponentNameForNS(componentName,containerName,bestMachine);
-         CORBA::Object_var obj=_NS->Resolve(componentNameForNS.c_str());
-         return Engines::Component::_narrow(obj);
-       }
-      else
-       return Engines::Component::_nil();
-    }
+
+  // find list of machines which have component
+  Engines::MachineList_var machinesOK=new Engines::MachineList;
+  unsigned int lghtOfmachinesOK=0;
+  machinesOK->length(listOfMachines.length());
+  for(unsigned int i=0;i<listOfMachines.length();i++) {
+    const char *currentMachine=listOfMachines[i];
+    
+    CORBA::Object_var obj = _NS->ResolveComponent(currentMachine,containerName,componentName,nbproc);
+    if(!CORBA::is_nil(obj))
+      machinesOK[lghtOfmachinesOK++]=CORBA::string_dup(currentMachine);
+  }
+
+  // find the best machine among the list which have component
+  if(lghtOfmachinesOK!=0) {
+    machinesOK->length(lghtOfmachinesOK);
+    CORBA::String_var bestMachine=_ContManager->FindBest(machinesOK);
+    CORBA::Object_var obj = _NS->ResolveComponent(bestMachine,containerName,componentName,nbproc);
+    return Engines::Component::_narrow(obj);
+  }
   else
-    {
-      //user specified no container name so trying to find a component in the best machine among listOfMachines
-      CORBA::String_var bestMachine=_ContManager->FindBest(listOfMachines);
-      //Normally look at all containers launched on bestMachine to see if componentName is already launched on one of them. To do..
-      string componentNameForNS=Engines_Component_i::BuildComponentNameForNS(componentName,containerName,bestMachine);
-      CORBA::Object_var obj = _NS->Resolve(componentNameForNS.c_str());
-      return Engines::Component::_narrow(obj);
-    }
+    return Engines::Component::_nil();
 }
 
-Engines::Component_ptr SALOME_LifeCycleCORBA::LoadComponent(const char *containerName, const char *componentName, const Engines::MachineList& listOfMachines)
+Engines::Component_ptr SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, const char *componentName, const Engines::MachineList& listOfMachines)
 {
-  Engines::Container_var cont=_ContManager->FindOrStartContainer(containerName,listOfMachines);
+  Engines::Container_var cont=_ContManager->FindOrStartContainer(params,listOfMachines);
   string implementation=Engines_Component_i::GetDynLibraryName(componentName);
   return cont->load_impl(componentName, implementation.c_str());
 }
-
-
-Engines::Container_ptr SALOME_LifeCycleCORBA::FindOrStartContainer(
-                                              const string aComputerContainer ,
-                                              const string theComputer ,
-                                              const string theContainer ) {
-  SCRUTE( aComputerContainer ) ;
-  SCRUTE( theComputer ) ;
-  SCRUTE( theContainer ) ;
-
-  Engines::Container_var aContainer = FindContainer( aComputerContainer.c_str() ) ;
-
-  if ( !CORBA::is_nil( aContainer ) ) {
-    return aContainer ;
-  }
-
-  Engines::Container_var aFactoryServer ;
-
-  bool pyCont = false ;
-  int len = theContainer.length() ;
-  if ( !strcmp( &theContainer.c_str()[len-2] , "Py" ) ) {
-    pyCont = true ;
-  }
-
-  string addr=_NS->getIORaddr();
-  string CMD="SALOME_Container";
-  if ( pyCont ) {
-    CMD="SALOME_ContainerPy.py";
-  }
-  CMD=CMD + " " + theContainer;
-  CMD=CMD + " -ORBInitRef NameService="+addr;
-
-  /*
-   *  Get the appropriate launcher and ask to launch
-   */
-  PyObject * launcher=getLauncher((char *)theComputer.c_str());
-  Launcher_Slaunch(launcher,(char *)theComputer.c_str(),(char *)CMD.c_str());
-  /*
-   *  Wait until the container is registered in Naming Service
-   */
-  int count = 5 ;
-  while ( CORBA::is_nil( aFactoryServer ) && count ) {
-      sleep( 1 ) ;
-      count-- ;
-      if ( count != 10 )
-            MESSAGE( count << ". Waiting for FactoryServer on " << theComputer)
-      aFactoryServer = FindContainer( aComputerContainer.c_str() ) ;
-  }
-  if ( !CORBA::is_nil( aFactoryServer ) ) {
-     return aFactoryServer;
-  }
-  MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed") ;
-  return Engines::Container::_nil();
-}
index ca91a238ffaf2f72756a930a699929b543d6ee1e..146ca44197df970b592cadea61090bf4ba482a7a 100644 (file)
 
 class SALOME_NamingService;
 
+class IncompatibleComponent : public SALOME_Exception
+{
+public :
+       IncompatibleComponent( void );
+       IncompatibleComponent( const IncompatibleComponent &ex  );
+} ;
+
 class SALOME_LifeCycleCORBA
 {
 public:
   SALOME_LifeCycleCORBA(SALOME_NamingService *ns);
   virtual ~SALOME_LifeCycleCORBA();
-  Engines::Container_ptr FindContainer(const char *containerName); // for supervision
   Engines::Component_ptr FindOrLoad_Component(const Engines::MachineParameters& params,
                                              const char *componentName);
   Engines::Component_ptr FindOrLoad_Component(const char *containerName,
                                              const char *componentName);
-  bool isKnownComponentClass(const char *componentName);
 protected:
+  bool isKnownComponentClass(const char *componentName);
+  bool isMpiContainer(const Engines::MachineParameters& params) throw(IncompatibleComponent);
+  int NbProc(const Engines::MachineParameters& params);
   //! Establish if a component called "componentName" in a container called "containerName" exists among the list of resources
   //! in "listOfMachines". This method uses Naming Service to find the component.
-  Engines::Component_ptr FindComponent(const char *containerName,
-                                           const char *componentName,
-                                           const Engines::MachineList& listOfMachines);
+  Engines::Component_ptr FindComponent(const Engines::MachineParameters& params, const char *componentName, const Engines::MachineList& listOfMachines);
 
-  Engines::Component_ptr LoadComponent(const char *containerName, const char *componentName, const Engines::MachineList& listOfMachines);
+  Engines::Component_ptr LoadComponent(const Engines::MachineParameters& params, const char *componentName, const Engines::MachineList& listOfMachines);
 
   SALOME_NamingService *_NS;
   Engines::ContainerManager_var _ContManager;
   
-  //private:
-  std::string ContainerName( const char * aComputerContainer ,
-                            std::string * theComputer ,
-                            std::string * theContainer ) ;
-  std::string ComputerPath( const char * theComputer ) ;
-  Engines::Container_ptr FindOrStartContainer(const std::string aComputerContainer ,
-                                              const std::string theComputer ,
-                                              const std::string theContainer ) ;
 } ;
 
 #endif
index c190fa2bbecb992e4a176cd12f928fb8b042568a..f95236226d14923137e954b4557862987072972b 100644 (file)
@@ -44,18 +44,21 @@ Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc,
 {
   MESSAGE("[" << numproc << "] activate object");
   _id = _poa->activate_object(this);
-  this->_add_ref();
+//   this->_add_ref();
 
   if(numproc==0){
 
-    //   _NS = new SALOME_NamingService(_orb);
-    _NS = SINGLETON_<SALOME_NamingService>::Instance() ;
-    ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
-    _NS->init_orb( orb ) ;
+    _NS = new SALOME_NamingService();
+//     _NS = SINGLETON_<SALOME_NamingService>::Instance() ;
+//     ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
+    _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ;
 
 //     Engines::Container_ptr pCont 
 //       = Engines::Container::_narrow(POA_Engines::MPIContainer::_this());
-    Engines::Container_ptr pCont = Engines::Container::_narrow(_poa->id_to_reference(*_id));
+    CORBA::Object_var obj=_poa->id_to_reference(*_id);
+    Engines::Container_var pCont = Engines::Container::_narrow(obj);
+    string hostname = GetHostname();
+    _containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str());
     SCRUTE(_containerName);
     _NS->Register(pCont, _containerName.c_str());
   }
@@ -388,16 +391,17 @@ void Engines_MPIContainer_i::Lfinalize_removal()
 }
 
 // Load component
-void Engines_MPIContainer_i::MPIShutdown()
+void Engines_MPIContainer_i::Shutdown()
 {
   int ip;
-  MESSAGE("[" << _numproc << "] shutdown of Corba Server");
+  MESSAGE("[" << _numproc << "] shutdown of MPI Corba Server");
   if( _numproc == 0 ){
+    MESSAGE("[" << _numproc << "] destroy from Naming Service of " << _containerName);
+    _NS->Destroy_Name(_containerName.c_str());
     for(ip= 1;ip<_nbproc;ip++)
       (Engines::MPIContainer::_narrow((*_tior)[ip]))->Shutdown();
   }
-
-  Shutdown();
+  _orb->shutdown(0);
 
 }
 
index a971b7f201da226ea3da739a2c82a24b63f7da7c..d58aef574f5f18a110d40ad04224c4e002626cbd 100644 (file)
@@ -57,7 +57,7 @@ class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
   Engines::Component_ptr load_impl(const char* nameToRegister,
                                   const char* componentName);
   // shutdown corba server
-  void MPIShutdown();
+  void Shutdown();
 
   // asynchronous version for other process
   void SPload_impl(const char* nameToRegister, const char* componentName);
index 52152364e87d181e0fd157abda372b2a4a82c569..1d74a218b11a2b2e1a7ece8033030e9afc6b20c9 100644 (file)
@@ -4,13 +4,12 @@
 #include "Utils_SINGLETON.hxx"
 #include "utilities.h"
 #include <mpi.h>
-#include "LocalTraceCollector.hxx"
+#include "SALOMETraceCollector.hxx"
 using namespace std;
 
 int main(int argc, char* argv[])
 {
   int nbproc, numproc;
-  int flag;
   Engines_MPIContainer_i * myContainer=NULL;
 
   MPI_Init(&argc,&argv);
@@ -20,7 +19,7 @@ int main(int argc, char* argv[])
   // Initialise the ORB.
   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
   CORBA::ORB_var &orb = init( argc , argv ) ;
-  LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(orb);
+  SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
  
   BEGIN_OF("[" << numproc << "] " << argv[0])
   try {
@@ -69,7 +68,6 @@ int main(int argc, char* argv[])
     pman->activate();
 
     orb->run();
-    orb->destroy();
 
   }
   catch(CORBA::SystemException&){
@@ -90,12 +88,11 @@ int main(int argc, char* argv[])
 
   if(myContainer)
     delete myContainer;
-  MPI_Initialized(&flag);
-  if(flag)
-    MPI_Finalize();
 
   END_OF("[" << numproc << "] " << argv[0]);
   delete myThreadTrace;
-  return 0 ;
+
+  MPI_Finalize();
+
 }
 
diff --git a/src/MPILifeCycleCORBA/MPILifeCycleCORBA.py b/src/MPILifeCycleCORBA/MPILifeCycleCORBA.py
deleted file mode 100644 (file)
index 0b26acf..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#==============================================================================
-#  File      : MPILifeCycleCORBA.py
-#  Created   : ven may 30 08:42:01 CEST 2003
-#  Author    : Bernard SECHER, CEA
-#  Project   : SALOME
-#  Copyright : CEA 2003
-#  $Header$
-#==============================================================================
-
-from LifeCycleCORBA import *
-from Utils_Identity import getShortHostName
-
-class MPILifeCycleCORBA(LifeCycleCORBA):
-    #-------------------------------------------------------------------------
-
-    def __init__(self, orb):
-        MESSAGE( "MPILifeCycleCORBA::__init__" )
-        LifeCycleCORBA.__init__(self, orb)
-
-    #-------------------------------------------------------------------------
-
-    def FindOrStartMPIContainer(self, theComputer , theMPIContainerRoot, nbproc ):
-        theMPIContainer = theMPIContainerRoot + "_" + str(nbproc)
-        MESSAGE( "FindOrStartMPIContainer" + theComputer + theMPIContainer )
-        aMPIContainer = self.FindContainer( theComputer + "/" + theMPIContainer )
-        if aMPIContainer is None :
-            if (theMPIContainerRoot == "MPIFactoryServer") | (theMPIContainerRoot == "MPIFactoryServerPy") :
-                if theComputer == getShortHostName() :
-                    rshstr = ""
-                else :
-                    rshstr = "rsh -n " + theComputer + " "
-                path = self.ComputerPath( theComputer )
-##                if path != "" :
-##                    rshstr = rshstr + path + "/../bin/salome/"
-##                else :
-##                    rshstr = rshstr + os.getenv( "KERNEL_ROOT_DIR" ) + "/bin/"
-#                    rshstr = rshstr + os.getenv( "PWD" ) + "/"
-                if theMPIContainerRoot == "MPIFactoryServer" :
-                    rshstr = rshstr + "mpirun -np " + str(nbproc) + " " + path + "SALOME_MPIContainer "
-                else :
-                    rshstr = rshstr + path + "SALOME_MPIContainerPy.py '"
-                rshstr = rshstr + theMPIContainer + " -"
-                omniORBcfg = os.getenv( "OMNIORB_CONFIG" )
-#                omniORBcfg = os.getenv( "HOME" ) + "/.omniORB.cfg"
-                file = os.open( omniORBcfg , os.O_RDONLY )
-                ORBInitRef = os.read(file,132)
-                if ORBInitRef[len(ORBInitRef)-1] == '\n' :
-                    ORBInitRef,bsn = ORBInitRef.split('\n')
-                os.close( file )
-                rshstr = rshstr + ORBInitRef
-                if theMPIContainerRoot == "MPIFactoryServerPy" :
-                    rshstr = rshstr + "'"
-                rshstr = rshstr + " > /tmp/" + theMPIContainer + "_"
-                rshstr = rshstr + theComputer
-                rshstr = rshstr + ".log 2>&1 &"
-                os.system( rshstr )
-                MESSAGE( "FindOrStartMPIContainer" + rshstr + " done" )
-            else :
-                if theMPIContainer.find('Py') == -1 :
-                    aMPIContainer = self.FindContainer( theComputer + "/" + "MPIFactoryServer_" + str(nbproc) )
-                else :
-                    aMPIContainer = self.FindContainer( theComputer + "/" + "MPIFactoryServerPy_" + str(nbproc) )
-                aMPIContainer = aMPIContainer.start_impl( theMPIContainer )
-
-            count = 21
-            while aMPIContainer is None :
-                time.sleep(1)
-                count = count - 1
-                MESSAGE( str(count) + ". Waiting for " + theComputer + "/" + theMPIContainer )
-                aMPIContainer = self.FindContainer( theComputer + "/" + theMPIContainer )
-                if count == 0 :
-                    return aMPIContainer
-            
-        return  aMPIContainer       
-        #os.system("rsh -n dm2s0017 /export/home/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515")
-
-    #-------------------------------------------------------------------------
-
-    def FindOrLoadMPIComponent(self, MPIcontainerName, MPIcomponentName, nbproc):
-
-        theComputer,theMPIContainerRoot = self.ContainerName( MPIcontainerName )
-        theMPIContainer = theMPIContainerRoot + "_" + str(nbproc)
-        name = [CosNaming.NameComponent(theComputer,"dir"),
-                CosNaming.NameComponent(theMPIContainer,"dir"),
-                CosNaming.NameComponent(MPIcomponentName,"object")]
-        try:
-            obj = self._containerRootContext.resolve(name)
-        except CosNaming.NamingContext.NotFound, ex:
-            MESSAGE( "component " + MPIcomponentName + " not found, trying to load" )
-            MPIcontainer = self.FindContainer(theComputer + "/" + theMPIContainer)
-            if MPIcontainer is None:
-                MESSAGE( "MPIcontainer " + theComputer + "/" + theMPIContainer + " not found in Naming Service, trying to start" )
-                if (theMPIContainerRoot != "MPIFactoryServer") & (theMPIContainerRoot != "MPIFactoryServerPy") :
-                    if theMPIContainer.find('Py') == -1 :
-                        theMPIFactorycontainerRoot = "MPIFactoryServer"
-                        theMPIFactorycontainer = theMPIFactorycontainerRoot + "_" + str(nbproc)
-                    else :
-                        theMPIFactorycontainerRoot = "MPIFactoryServerPy"
-                        theMPIFactorycontainer = theMPIFactorycontainerRoot + "_" + str(nbproc)
-                    MPIFactorycontainer = self.FindContainer(theComputer + "/" + theMPIFactorycontainer)
-                    if MPIFactorycontainer is None:
-                        MESSAGE( "MPIcontainer " + theComputer + "/" + theMPIFactorycontainer + " not found in Naming Service, trying to start" )
-                        MPIFactorycontainer = self.FindOrStartMPIContainer(theComputer,theMPIFactorycontainerRoot,nbproc)
-                else:
-                    MPIFactorycontainer = self.FindOrStartMPIContainer(theComputer,theMPIContainerRoot,nbproc)
-                if MPIFactorycontainer != None :
-                    MPIcontainer = self.FindOrStartMPIContainer(theComputer,theMPIContainerRoot,nbproc)
-
-            if MPIcontainer != None:
-                compoinfo = self._catalog.GetComponent(MPIcomponentName)
-                if compoinfo is None:
-                    MESSAGE( "MPIcomponent " + MPIcomponentName + " not found in Module Catalog" )
-                else:
-                    try:
-                        machineName = theComputer
-                        path = compoinfo.GetPathPrefix(machineName) + "/"
-                    except SALOME_ModuleCatalog.NotFound, ex:
-                        MESSAGE( "machine " + machineName + " not found in Module Catalog" )
-                        MESSAGE( "trying localhost" )
-                        try:
-                            path = compoinfo.GetPathPrefix("localhost") + "/"
-                        except SALOME_ModuleCatalog.NotFound, ex:
-                            path = ""
-                    implementation = path + "lib" + MPIcomponentName + "Engine.so"
-                    MESSAGE( "Trying to load " + implementation )
-                    try:
-                        MPIcomponent = MPIcontainer.load_impl(MPIcomponentName, implementation)
-                        MESSAGE( "component " + MPIcomponent._get_instanceName() + " launched !" )
-                        return MPIcomponent
-                    except:
-                        MESSAGE( "component " + MPIcomponentName + " NOT launched !" )
-
-        else:
-            try:
-                MPIcomponent = obj._narrow(Engines.Component)
-                if MPIcomponent is None:
-                    MESSAGE( MPIcomponentName + " is not a component !" )
-                else:
-                    MESSAGE( "MPIcomponent " + MPIcomponent._get_instanceName() + " found !" )
-                return MPIcomponent
-            except:
-                MESSAGE( MPIcomponentName + " failure" )
-                return None
diff --git a/src/MPILifeCycleCORBA/MPIsalome.py b/src/MPILifeCycleCORBA/MPIsalome.py
deleted file mode 100644 (file)
index 789641f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-import salome
-from MPILifeCycleCORBA import *
-
-# create an LifeCycleCORBA instance
-lcc = MPILifeCycleCORBA(salome.orb)
diff --git a/src/MPILifeCycleCORBA/Makefile.in b/src/MPILifeCycleCORBA/Makefile.in
deleted file mode 100644 (file)
index ab76b03..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#==============================================================================
-#  File      : Makefile.in
-#  Created   : lun jui  2 20:32:24 CEST 2001
-#  Author    : Paul RASCLE, EDF - Marc Tajchman, CEA
-#  Project   : SALOME
-#  Copyright : EDF 2001
-#  $Header$
-#==============================================================================
-
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = SALOME_MPILifeCycleCORBA.hxx
-
-EXPORT_PYSCRIPTS = MPIsalome.py MPILifeCycleCORBA.py
-
-# Libraries targets
-
-LIB = libSalomeMPILifeCycleCORBA.la
-LIB_SRC = SALOME_MPILifeCycleCORBA.cxx
-LIB_CLIENT_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl \
-                 SALOME_Component.idl SALOME_ModuleCatalog.idl
-
-# Executables targets
-BIN = TestMPILifeCycleCORBA
-BIN_SRC =
-BIN_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl
-
-LDFLAGS += -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace
-
-@CONCLUDE@
-
diff --git a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx
deleted file mode 100644 (file)
index 5dfe13f..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-//=============================================================================
-// File      : SALOME_MPILifeCycleCORBA.cxx
-// Created   : mar jui 03 14:55:50 CEST 2003
-// Author    : Bernard SECHER CEA
-// Project   : SALOME
-// Copyright : CEA 2003
-// $Header$
-//=============================================================================
-
-#include <iostream>
-#include <fstream>
-#include <strstream>
-#include <iomanip>
-#include <stdio.h>
-#include <string.h>
-
-#include "OpUtil.hxx"
-#include "utilities.h"
-
-#include <ServiceUnreachable.hxx>
-
-#include "SALOME_MPILifeCycleCORBA.hxx"
-#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
-#include "SALOME_NamingService.hxx"
-using namespace std;
-
-SALOME_MPILifeCycleCORBA::SALOME_MPILifeCycleCORBA() : 
-  SALOME_LifeCycleCORBA()
-{
-  _MPIFactoryServer = NULL;
-}
-
-SALOME_MPILifeCycleCORBA::SALOME_MPILifeCycleCORBA(SALOME_NamingService *ns) :
-  SALOME_LifeCycleCORBA(ns)
-{
-  _MPIFactoryServer = NULL;
-}
-
-SALOME_MPILifeCycleCORBA::~SALOME_MPILifeCycleCORBA()
-{
-}
-
-Engines::MPIContainer_var SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer(
-                                              const std::string theComputer ,
-                                              const std::string theMPIContainerRoot,
-                                             const int nbproc)
-{
-  char nbp[1024];
-
-  sprintf(nbp,"_%d",nbproc);
-  std::string theMPIContainer = theMPIContainerRoot + nbp; 
-  std::string aComputerContainer = theComputer + "/" + theMPIContainer;
-
-  SCRUTE( aComputerContainer ) ;
-  SCRUTE( theComputer ) ;
-  SCRUTE( theMPIContainer ) ;
-
-  // On recherche si le containe rest deja lance
-  Engines::MPIContainer_var aMPIContainer = Engines::MPIContainer::_narrow(FindContainer(aComputerContainer.c_str()));
-
-  //On a trouve le container: on renvoie une poigne dessus
-  if ( !CORBA::is_nil( aMPIContainer ) ) {
-    MESSAGE("MPIContainer " << aComputerContainer << " found!!!");
-    return aMPIContainer ;
-  }
-  // On a pas trouve le container
-  else {
-    MESSAGE("MPIContainer " << aComputerContainer << " not found!!!");
-    // On recherche un container generique
-    bool pyCont = false ;
-    int len = theMPIContainer.length() ;
-    if ( !strcmp( &theMPIContainerRoot.c_str()[len-2] , "Py" ) ) {
-      pyCont = true ;
-    }
-    std::string MPIFactoryServer = theComputer ;
-    if ( pyCont ) {
-      MPIFactoryServer += "/MPIFactoryServerPy" ;
-    }
-    else {
-      MPIFactoryServer += "/MPIFactoryServer" ;
-    }
-    MPIFactoryServer += nbp;
-    Engines::MPIContainer_var aMPIFactoryServer = Engines::MPIContainer::_narrow(FindContainer( MPIFactoryServer.c_str()));
-
-    // On n'a pas trouve le container generique: on lance le container demande
-    if ( CORBA::is_nil( aMPIFactoryServer ) ) {
-// rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 &
-      std::string rsh( "" ) ;
-      if ( theComputer!= GetHostname() ) {
-        rsh += "rsh -n " ;
-        rsh += theComputer ;
-        rsh += " " ;
-      }
-      std::string path = ComputerPath( theComputer.c_str() ) ;
-      SCRUTE( path ) ;
-      //      rsh += "runSession " ;
-      if ( pyCont ) {
-       MESSAGE("MPI python container not implemented");
-       return Engines::MPIContainer::_nil();
-//         rsh += "SALOME_MPIContainerPy.py " ;
-//         rsh += "MPIFactoryServerPy -" ;
-      }
-      else {
-       sprintf(nbp,"mpirun -np %d %sSALOME_MPIContainer ",nbproc,path.c_str());
-        rsh += nbp;
-        rsh += theMPIContainer +" -" ;
-      }
-      std::string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
-      ifstream omniORBfile( omniORBcfg.c_str() ) ;
-      char ORBInitRef[12] ;
-      char nameservice[132] ;
-      omniORBfile >> ORBInitRef ;
-      rsh += ORBInitRef ;
-      rsh += " " ;
-      omniORBfile >> nameservice ;
-      omniORBfile.close() ;
-      char * bsn = strchr( nameservice , '\n' ) ;
-      if ( bsn ) {
-        bsn[ 0 ] = '\0' ;
-      }
-      rsh += nameservice ;
-      if ( pyCont ) {
-        rsh += " > /tmp/MPIFactoryServerPy_" ;
-      }
-      else {
-        rsh += " > /tmp/MPIFactoryServer_" ;
-      }
-      sprintf(nbp,"%d_",nbproc);
-      rsh += nbp;
-      rsh += theComputer ;
-      rsh += ".log 2>&1 &" ;
-      SCRUTE( rsh );
-      int status = system( rsh.c_str() ) ;
-      if (status == -1) {
-        INFOS("SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer rsh failed (system command status -1)") ;
-      }
-      else if (status == 217) {
-        INFOS("SALOME_MPILifeCycleCORBA::FindOrStartContainer rsh failed (system command status 217)") ;
-      }
-      else {
-        int count = 21 ;
-        while ( CORBA::is_nil( aMPIFactoryServer ) && count ) {
-          sleep( 1 ) ;
-          count-- ;
-          if ( count != 10 )
-            MESSAGE( count << ". Waiting for FactoryServer on " << theComputer)
-          aMPIFactoryServer = Engines::MPIContainer::_narrow(FindContainer( MPIFactoryServer.c_str()));
-       }
-        if ( CORBA::is_nil( aMPIFactoryServer ) ) {
-          INFOS("SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer rsh failed") ;
-       }
-        else if ( strcmp( theComputer.c_str() , GetHostname().c_str() ) ) {
-          _MPIFactoryServer = aMPIFactoryServer ;
-       }
-      }
-    }
-    // On a trouve le container generique distant: on se sert de lui
-    // pour lancer un nouveau container MPI
-    // a revoir...
-    if ( !CORBA::is_nil( aMPIFactoryServer ) ) {
-      if ( strcmp( theMPIContainer.c_str() , "MPIFactoryServer" ) ||
-           strcmp( theMPIContainer.c_str() , "MPIFactoryServerPy" ) ) {
-        MESSAGE("MPI Container not found ! trying to start " << aComputerContainer);
-        Engines::MPIContainer_var myMPIContainer = aMPIFactoryServer->start_MPIimpl( theMPIContainer.c_str(), nbproc ) ;
-        if ( !CORBA::is_nil( myMPIContainer ) ) {
-          MESSAGE("MPIContainer " << aComputerContainer << " started");
-          return myMPIContainer ;
-        }
-        else {
-          MESSAGE("MPIContainer " << aComputerContainer << " NOT started");
-        }
-      }
-      else {
-        MESSAGE("MPIContainer " << aComputerContainer << " started");
-        return aMPIFactoryServer ;
-      }
-    }
-  }
-  return Engines::MPIContainer::_nil();
-}
-
-// Engines::Component_var SALOME_MPILifeCycleCORBA::FindOrLoad_MPIComponent
-//                                    (const char *MPIcontainerName,
-//                                 const char *MPIcomponentName,
-//                                 const char *implementation,
-//                                 const int nbproc)
-// {
-//   BEGIN_OF("FindOrLoad_MPIComponent(1)");
-//   ASSERT(_NS != NULL);
-//   string theComputer ;
-//   string theMPIContainer ;
-//   string theComputerContainer = ContainerName( MPIcontainerName ,
-//                                                &theComputer ,
-//                                                &theMPIContainer ) ;
-//   Engines::MPIContainer_var cont = FindOrStartMPIContainer( theComputerContainer ,
-//                                                         theComputer ,
-//                                                         theMPIContainer,
-//                                                         nbproc) ;
-// //  ASSERT(!CORBA::is_nil(cont));
-
-//   string path( theComputerContainer );
-//   path = path + "/";
-//   path = path + MPIcomponentName;
-//   SCRUTE(path);
-//   try
-//     {
-//       CORBA::Object_var obj = _NS->Resolve(path.c_str());
-//       if (CORBA::is_nil(obj))
-//     {
-//       MESSAGE("MPIComponent not found ! trying to load " << path);
-//       Engines::Component_var compo 
-//         = cont->load_impl(MPIcomponentName, implementation);
-// //    ASSERT(!CORBA::is_nil(compo));
-//       MESSAGE("MPIComponent launched !" << path);
-//       return compo;
-//     }
-//       else
-//     {
-//       MESSAGE("MPIComponent found !" << path);
-//       Engines::Component_var compo = Engines::Component::_narrow(obj);
-// //    ASSERT(!CORBA::is_nil(compo));
-//       try
-//         {
-//           compo->ping(); 
-//         }
-//       catch (CORBA::COMM_FAILURE&)
-//         {
-//           INFOS("Caught CORBA::SystemException CommFailure. Engine "
-//                 << path << "does not respond" );
-//         }
-//       return compo;
-//     }
-//     }
-//   catch (ServiceUnreachable&)
-//     {
-//       INFOS("Caught exception: Naming Service Unreachable");
-//     }
-//   catch (...)
-//     {
-//       INFOS("Caught unknown exception.");
-//     }
-//   return Engines::Component::_nil();
-// }
-
-Engines::Component_var SALOME_MPILifeCycleCORBA::FindOrLoad_MPIComponent
-                                  (const char *MPIcontainerName,
-                                  const char *MPIcomponentName,
-                                  const int nbproc)
-{
-
-  char nbp[1024];
-
-  sprintf(nbp,"_%d",nbproc);
-//  BEGIN_OF("FindOrLoad_Component(2)");
-  ASSERT(_NS != NULL);
-  string theComputer ;
-  string theMPIContainerRoot ;
-  string theMPIContainer;
-  string theComputerContainer = ContainerName( MPIcontainerName ,
-                                               &theComputer ,
-                                               &theMPIContainerRoot ) ;
-  theMPIContainer = theMPIContainerRoot + nbp;
-  Engines::MPIContainer_var cont = FindOrStartMPIContainer( theComputer ,
-                                                           theMPIContainerRoot,
-                                                           nbproc ) ;
-
-  if ( CORBA::is_nil( cont ) ) {
-    MESSAGE("MPIContainer not found ! " << theComputerContainer );
-    return Engines::Component::_nil();
-  }
-
-//  char * machine = cont->machineName() ;
-  const char * machine = theComputer.c_str() ;
-
-  string path( theComputerContainer );
-  path += nbp;
-  path += "/";
-  path += MPIcomponentName;
-  SCRUTE(path);
-
-  try {
-    CORBA::Object_var obj = _NS->Resolve(path.c_str());
-    if ( CORBA::is_nil( obj ) ) {
-      MESSAGE("MPIComponent not found ! trying to load " << path);
-      CORBA::Object_var obj2 = _NS->Resolve("/Kernel/ModulCatalog");
-      SALOME_ModuleCatalog::ModuleCatalog_var Catalog = 
-       SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj2);
-
-      SALOME_ModuleCatalog::Acomponent_ptr compoInfo = 
-       Catalog->GetComponent(MPIcomponentName);
-      if (CORBA::is_nil (compoInfo)) 
-       {
-         INFOS("Catalog Error : Component not found in the catalog")
-           return Engines::Component::_nil();
-//             exit (-1);
-       }
-      
-      string  path;
-      try
-       {
-         path = compoInfo->GetPathPrefix( machine ) ;
-         path += "/" ;
-       }
-      catch (SALOME_ModuleCatalog::NotFound&)
-       {
-         MESSAGE("GetPathPrefix(" << machine << ") not found!"
-                 << "trying localhost");
-         try {
-           path = compoInfo->GetPathPrefix("localhost") ;
-           path += "/" ;
-         }
-         catch (SALOME_ModuleCatalog::NotFound&) {
-           MESSAGE("GetPathPrefix(localhost) not found!") ;
-           path = "" ;
-         }
-       }
-      
-      SCRUTE(path); 
-      string implementation(path);
-      implementation += "lib";
-      implementation += MPIcomponentName;
-      implementation += "Engine.so";
-      
-      Engines::Component_var compo 
-       = cont->load_impl(MPIcomponentName, implementation.c_str());
-      
-//       ASSERT(!CORBA::is_nil(compo));
-//       MESSAGE("Component launched !" << path);
-      return compo;
-    }
-    else
-      {
-       MESSAGE("MPIComponent found !" << path);
-       Engines::Component_var compo = Engines::Component::_narrow(obj);
-       //        ASSERT(!CORBA::is_nil(compo));
-       try
-         {
-           string instanceName = compo->instanceName(); 
-         }
-       catch (CORBA::SystemException&)
-         {
-           INFOS("Caught CORBA::SystemException CommFailure. Engine "
-                 << path << "does not respond" );
-         }
-       return compo;
-      }
-  }
-  catch (ServiceUnreachable&)
-    {
-      INFOS("Caught exception: Naming Service Unreachable");
-    }
-  catch (...)
-    {
-      INFOS("Caught unknown exception.");
-    }
-  return Engines::Component::_nil();
-}
diff --git a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.hxx
deleted file mode 100644 (file)
index e560a07..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//=============================================================================
-// File      : SALOME_MPILifeCycleCORBA.hxx
-// Created   : mar jui 03 14:55:45 CEST 2003
-// Author    : Bernard SECHER, CEA
-// Project   : SALOME
-// Copyright : CEA 2003
-// $Header$
-//=============================================================================
-
-#ifndef _SALOME_MPILIFECYCLECORBA_HXX_
-#define _SALOME_MPILIFECYCLECORBA_HXX_
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string>
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
-#include "SALOME_LifeCycleCORBA.hxx"
-
-class SALOME_MPILifeCycleCORBA : public SALOME_LifeCycleCORBA
-{
-public:
-  SALOME_MPILifeCycleCORBA();
-  SALOME_MPILifeCycleCORBA(SALOME_NamingService *ns);
-  virtual ~SALOME_MPILifeCycleCORBA();
-
-//   Engines::Component_var FindOrLoad_MPIComponent(const char *MPIcontainerName,
-//                                              const char *MPIcomponentName,
-//                                              const char *implementationPath,
-//                                              const int nbproc);
-  Engines::Component_var FindOrLoad_MPIComponent(const char *MPIcontainerName,
-                                                const char *MPIcomponentName,
-                                                const int nbproc);
-protected:
-  Engines::MPIContainer_var _MPIFactoryServer ;
-
-private:
-  Engines::MPIContainer_var FindOrStartMPIContainer(const std::string theComputer ,
-                                                   const std::string theMPIContainerRoot,
-                                                   const int nbproc) ;
-
-} ;
-
-#endif
diff --git a/src/MPILifeCycleCORBA/TestMPILifeCycleCORBA.cxx b/src/MPILifeCycleCORBA/TestMPILifeCycleCORBA.cxx
deleted file mode 100644 (file)
index 680ba37..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// using namespace std;
-//=============================================================================
-// File      : TestMPILifeCycleCORBA.cxx
-// Created   : mer jui 4 13:11:27 CEST 2003
-// Author    : Bernard SECHER, 2003
-// Project   : SALOME
-// Copyright : CEA 2003
-// $Header$
-//=============================================================================
-
-#include "utilities.h"
-#include <iostream>
-#include <unistd.h>
-#include <string>
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
-#include CORBA_CLIENT_HEADER(SALOME_TestMPIComponent)
-
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-#include "SALOME_NamingService.hxx"
-#include "SALOME_MPILifeCycleCORBA.hxx"
-#include "OpUtil.hxx"
-using namespace std;
-
-int main (int argc, char * argv[])
-{
-
-  try{
-    // Initializing omniORB
-    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
-    
-    // Obtain a reference to the root POA
-    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
-    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
-    
-    // Use Name Service to find container
-    SALOME_NamingService NS(orb);
-    
-    SALOME_MPILifeCycleCORBA LCC(&NS);
-    
-    Engines::Component_var comp = LCC.FindOrLoad_MPIComponent("MPIFactoryServer","TestMPIComponent",2);
-    
-    Engines::TestMPIComponent_var m1 = Engines::TestMPIComponent::_narrow(comp);
-    if(CORBA::is_nil(m1)){
-      INFOS("echec recuperation poignee composant");
-    }
-    else{
-      
-      INFOS("Lancement de coucou");
-      m1->Coucou(1L);
-    }
-
-    orb->destroy();
-  }
-  catch(CORBA::COMM_FAILURE& ex) {
-    INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
-  }
-  catch(CORBA::SystemException&) {
-    INFOS("Caught a CORBA::SystemException.");
-  }
-  catch(CORBA::Exception&) {
-    INFOS("Caught CORBA::Exception.");
-  }
-  catch(...) {
-    INFOS("Caught unknown exception.");
-  }
-
-  return 0;
-}
index d0daa6ea2ccadc113dbad80d8cfa27adc50801cd..f8bc74369ff911a40266f770430bdd10f46731b4 100644 (file)
@@ -57,7 +57,7 @@ SUBDIRS = MSG2QM SALOMELocalTrace SALOMETraceCollector Logger Utils CASCatch \
 endif
 
 ifeq (@mpi_ok@,yes)
-  SUBDIRS+= MPIContainer MPILifeCycleCORBA TestMPIContainer
+  SUBDIRS+= MPIContainer TestMPIContainer
 endif
 
 ifeq (@WITH_BATCH@,yes)
index 4beb6d4e3606c5d5463cdfee7f501900dc6ee2c3..70ea6e56ae0a270b20ae8d7d20cbdd274eb41f3f 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <iostream>
 #include <cstring>
+#include <string>
 
 using namespace std;
 
@@ -368,6 +369,109 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path)
   return _obj;
 }
 
+//----------------------------------------------------------------------
+/*! Function : Resolve Component  from hostname, containername, componentName and number of prcoessors
+ *  Purpose  : method to get the ObjRef of a component
+ *  If the NamingService is out, the exception ServiceUnreachable is thrown 
+ * \param hostname const char* argument
+ * \param containername const char* argument
+ * \param componentname const char* argument
+ * \param nbproc const int argument
+ * \return the object reference
+ */
+//----------------------------------------------------------------------
+
+CORBA::Object_ptr SALOME_NamingService::ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc)
+{
+
+  string name="/Containers/";
+  name += hostname;
+  if( strlen(containerName) != 0 ){
+    name += "/";
+    if( nbproc >=1 ){
+      char *newContainerName = new char[strlen(containerName)+8];
+      sprintf(newContainerName,"%s_%d",containerName,nbproc);
+      name += newContainerName;
+    }
+    else
+      name += containerName;
+    name += "/";
+    name += componentName;
+    return Resolve(name.c_str());
+  }
+  else {
+    Change_Directory(name.c_str());
+    vector<string> contList = list_directory();
+    for(unsigned int ind = 0; ind < contList.size(); ind++){
+      name = contList[ind].c_str();
+      name += "/";
+      name += componentName;
+      CORBA::Object_ptr obj = Resolve(name.c_str());
+      if( !CORBA::is_nil(obj) )
+       return obj;
+    }
+    return CORBA::Object::_nil();
+  }
+
+}
+
+string SALOME_NamingService::ContainerName(const char *containerName)
+{
+  string ret;
+
+  if (strlen(containerName)== 0)
+    ret = "FactoryServer";
+  else
+    ret = containerName;
+
+  return ret;
+}
+
+string SALOME_NamingService::ContainerName(const Engines::MachineParameters& params)
+{
+  int nbproc;
+  if( !params.isMPI )
+    nbproc = 0;
+  else if( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+    nbproc = 1;
+  else if( params.nb_node == 0 )
+    nbproc = params.nb_proc_per_node;
+  else if( params.nb_proc_per_node == 0 )
+    nbproc = params.nb_node;
+  else
+    nbproc = params.nb_node * params.nb_proc_per_node;
+
+  string ret=ContainerName(params.container_name);
+
+  if( nbproc >=1 ){
+    char *suffix = new char[8];
+    sprintf(suffix,"_%d",nbproc);
+    ret += suffix;
+  }
+
+  return ret;
+}
+
+string SALOME_NamingService::BuildContainerNameForNS(const char *containerName, const char *hostname)
+{
+  string ret="/Containers/";
+  ret += hostname;
+  ret+="/";
+  ret+=ContainerName(containerName);
+
+  return ret;
+}
+
+string SALOME_NamingService::BuildContainerNameForNS(const Engines::MachineParameters& params, const char *hostname)
+{
+  string ret="/Containers/";
+  ret += hostname;
+  ret+="/";
+  ret+=ContainerName(params);
+
+  return ret;
+}
+
 //----------------------------------------------------------------------
 /*!  Function : Find
  *  Purpose  : method to research a name from the current directory 
index db9c39e17865a0a55a776342536b465ec57bfac2..31866d4c8d972574aefba55e31c7f7abdcccd3c9 100644 (file)
@@ -34,6 +34,9 @@
 #include <vector>
 #include <string>
 
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include CORBA_CLIENT_HEADER(SALOME_Component)
 //class ServiceUnreachable;
 #include "ServiceUnreachable.hxx"
 
@@ -60,6 +63,15 @@ public:
   CORBA::Object_ptr Resolve(const char* Path)
     throw( ServiceUnreachable); 
 
+  //! method to get the ObjRef of a component
+  CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0);
+
+  std::string ContainerName(const char *ContainerName);
+  std::string ContainerName(const Engines::MachineParameters& params);
+
+  std::string BuildContainerNameForNS(const char *ContainerName, const char *hostname);
+  std::string BuildContainerNameForNS(const Engines::MachineParameters& params, const char *hostname);
+
   //! method to research a name from the naming service's current directory 
   int Find(const char* name)
     throw(ServiceUnreachable);
index 556d267271a6dcb5e24a98ae74526c593a7b91a0..02ad9ab9cefece58fe2a63617d0bbd41c89d9a89 100644 (file)
@@ -33,6 +33,8 @@
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_Registry)
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
 
 #include <IntervalWindow.hxx>
 
index da3c8997719c5ed064796246f516d69831eba151..89c34e8d09481053967afdc2dce3d8c5a8e360a4 100644 (file)
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <fstream>
 #include <iostream>
+#include <sstream>
 #include <string.h>
 #include <map>
 #include <list>
 using namespace std;
 
 //just for test
-SALOME_ResourcesManager::SALOME_ResourcesManager(const char *xmlFilePath):_path_resources(xmlFilePath)
+SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,const char *xmlFilePath):_path_resources(xmlFilePath)
 {
+  _NS=new SALOME_NamingService(orb);  
 }
 
-SALOME_ResourcesManager::SALOME_ResourcesManager()
+SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb)
 {
+  _NS=new SALOME_NamingService(orb);
   _path_resources=getenv("KERNEL_ROOT_DIR");
   _path_resources+="/share/salome/resources/CatalogResources.xml";
   ParseXmlFile();
@@ -34,17 +37,21 @@ SALOME_ResourcesManager::SALOME_ResourcesManager()
 
 SALOME_ResourcesManager::~SALOME_ResourcesManager()
 {
+  delete _NS;
 }
 
 vector<string> SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params,const char *moduleName) throw(SALOME_Exception)
 {
+  MESSAGE("ResourcesManager::GetFittingResources");
   vector <std::string> ret;
   //To be sure that we search in a correct list.
   ParseXmlFile();
   const char *hostname=(const char *)params.hostname;
   if(hostname[0]!='\0')
     {
-      if(_resourcesList.find(hostname)!=_resourcesList.end())
+      if( strcmp(hostname,"localhost") == 0 || strcmp(hostname,GetHostname().c_str()) == 0 )
+       ret.push_back(GetHostname().c_str());
+      else if(_resourcesList.find(hostname)!=_resourcesList.end())
        // params.hostame is in the list of resources so return it.
        ret.push_back(hostname);
       else
@@ -176,7 +183,7 @@ string SALOME_ResourcesManager::FindBest(const Engines::MachineList& listOfMachi
   return _dynamicResourcesSelecter.FindBest(listOfMachines);
 }
 
-string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer(const string& machine,const char *containerName)
+string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer(const string& machine,const Engines::MachineParameters& params)
 {
   _TmpFileName=BuildTemporaryFileName();
   ofstream tempOutputFile;
@@ -197,12 +204,34 @@ string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer(const strin
   tempOutputFile << "export PYTHONPATH" << endl;
   tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
   // ! env vars
+  if(params.isMPI){
+    tempOutputFile << "mpirun -np ";
+    int nbproc;
+    if( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+      nbproc = 1;
+    else if( params.nb_node == 0 )
+      nbproc = params.nb_proc_per_node;
+    else if( params.nb_proc_per_node == 0 )
+      nbproc = params.nb_node;
+    else
+      nbproc = params.nb_node * params.nb_proc_per_node;
+    std::ostringstream o;
+    tempOutputFile << nbproc << " ";
+  }
   tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second << "/bin/salome/";
-  if(Engines_Container_i::isPythonContainer(containerName))
-    tempOutputFile << "SALOME_ContainerPy.py ";
-  else
-    tempOutputFile << "SALOME_Container ";
-  tempOutputFile << containerName << " -";
+  if(params.isMPI){
+    if(Engines_Container_i::isPythonContainer(params.container_name))
+      tempOutputFile << "pyMPI SALOME_ContainerPy.py ";
+    else
+      tempOutputFile << "SALOME_MPIContainer ";
+  }
+  else{
+    if(Engines_Container_i::isPythonContainer(params.container_name))
+      tempOutputFile << "SALOME_ContainerPy.py ";
+    else
+      tempOutputFile << "SALOME_Container ";
+  }
+  tempOutputFile << _NS->ContainerName(params) << " -";
   AddOmninamesParams(tempOutputFile);
   tempOutputFile << " &" << endl;
   tempOutputFile.flush();
@@ -231,27 +260,48 @@ string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer(const strin
   command+=_TmpFileName;
   command += " > ";
   command += "/tmp/";
-  command += containerName;
+  command += _NS->ContainerName(params);
   command += "_";
   command += machine;
-  command += ".log &";
+  command += ".log 2>&1 &";
   cout << "Command is ... " << command << endl;
   return command;
 }
 
-string SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer(const char *containerName)
+string SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params)
 {
   _TmpFileName="";
   string command;
-  if(Engines_Container_i::isPythonContainer(containerName))
-    command="SALOME_ContainerPy.py ";
-  else
-    command="SALOME_Container ";
-  command+=containerName;
+  int nbproc=0;
+  if(params.isMPI){
+    command="mpirun -np ";
+    if( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
+      nbproc = 1;
+    else if( params.nb_node == 0 )
+      nbproc = params.nb_proc_per_node;
+    else if( params.nb_proc_per_node == 0 )
+      nbproc = params.nb_node;
+    else
+      nbproc = params.nb_node * params.nb_proc_per_node;
+    std::ostringstream o;
+    o << nbproc << " ";
+    command += o.str();
+    if(Engines_Container_i::isPythonContainer(params.container_name))
+      command+="pyMPI SALOME_ContainerPy.py ";
+    else
+      command+="SALOME_MPIContainer ";
+  }
+  else{
+    if(Engines_Container_i::isPythonContainer(params.container_name))
+      command="SALOME_ContainerPy.py ";
+    else
+      command="SALOME_Container ";
+  }
+  command+=_NS->ContainerName(params);
   command+=" -";
   AddOmninamesParams(command);
   command+=" > /tmp/";
-  command+=containerName;
+  command+=_NS->ContainerName(params);
   command += "_";
   command += GetHostname();
   command += ".log 2>&1 &" ;
index c0b6ef38530492a15d9dcd5a6e33e1921cbc99d4..9bfe9a075564987a6934cf07f4bb1b6ea62c342c 100644 (file)
@@ -6,6 +6,7 @@
 #include <SALOMEconfig.h>
 #include "SALOME_ResourcesCatalog_Handler.hxx"
 #include "SALOME_LoadRateManager.hxx"
+#include "SALOME_NamingService.hxx"
 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
 #include <string>
 #include <fstream>
@@ -18,10 +19,10 @@ class SALOME_ResourcesManager
 {
 public:
   //! standard constructor
-  SALOME_ResourcesManager();
+  SALOME_ResourcesManager(CORBA::ORB_ptr orb);
 
   //!just for test
-  SALOME_ResourcesManager(const char *xmlFilePath);
+  SALOME_ResourcesManager(CORBA::ORB_ptr orb,const char *xmlFilePath);
   
   //! standard destructor
   ~SALOME_ResourcesManager();
@@ -33,10 +34,10 @@ public:
   std::string FindBest(const Engines::MachineList& listOfMachines);
 
   //! method that builds in a temporary file the script to be launched
-  std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine,const char *containerName);
+  std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine,const Engines::MachineParameters& params);
 
   //! method that builds the command to be launched.
-  std::string BuildCommandToLaunchLocalContainer(const char *containerName);
+  std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params);
 
   //! method that remove the generated temporary file in case of a remote launch.
   void RmTmpFile();
@@ -62,6 +63,7 @@ public:
   const MapOfParserResourcesType& GetList() const;
 
 private:
+  SALOME_NamingService *_NS;
 
   //! method to verify ressources catalog content - return true if verfication is OK
   bool _verify_resources(MapOfParserResourcesType resourceslist);
index b268fd20e47117e0ef1943f61b4c4e417ffa1102..451d9d20f912790be42294b205bd19b3aff3b34e 100644 (file)
@@ -31,7 +31,7 @@ BIN_SRC =
 BIN_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl
 BIN_SERVER_IDL = 
 
-LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeMPILifeCycleCORBA -lSalomeLifeCycleCORBA -lSalomeMPIContainer -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace ${MPI_LIBS}
+LDFLAGSFORBIN+= -lSalomeNotification -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeMPIContainer -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace  -lSalomeResourcesManager ${MPI_LIBS}
 
 CXXFLAGS+=${MPI_INCLUDES}
 CXX_DEPEND_FLAG+=${MPI_INCLUDES}
index 8980074879dea70df07bec5e4d0b4c6f88d91c97..f17d5a630778eb474065bd4ccad8ee6b41530001 100644 (file)
@@ -20,7 +20,7 @@
 # include "Utils_SINGLETON.hxx"
 #include "SALOME_NamingService.hxx"
 #include "OpUtil.hxx"
-#include "LocalTraceCollector.hxx"
+#include "SALOMETraceCollector.hxx"
 using namespace std;
 
 int main (int argc, char * argv[])
@@ -29,7 +29,7 @@ int main (int argc, char * argv[])
   // Initializing omniORB
   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
   CORBA::ORB_var &orb = init( argc , argv ) ;
-  LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(orb);
+  SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
     
   BEGIN_OF(argv[0])
   try{
@@ -115,7 +115,7 @@ int main (int argc, char * argv[])
 //     // Clean-up.
 // //     iGenFact->finalize_removal() ;
 // //     sleep(5);
-    iGenFact->MPIShutdown();
+    iGenFact->Shutdown();
 //     INFOS("shut down corba server for Test MPI Container");
 //     orb->destroy();
   }