]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
- Add an exception if parallelLib is not correct
authorribes <ribes>
Fri, 18 Jan 2008 15:19:55 +0000 (15:19 +0000)
committerribes <ribes>
Fri, 18 Jan 2008 15:19:55 +0000 (15:19 +0000)
src/Container/SALOME_ContainerManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.cxx

index 72a2b7345c2a85f5dbdf70406701cf299456d53f..b74dda3756bd2ab00479f0e0f0fd7caf81d4acb0 100644 (file)
@@ -361,7 +361,7 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const,
   if(CORBA::is_nil(ret)) {
     // Step 2 : Starting a new parallel container
     INFOS("[FindOrStartParallelContainer] Starting a parallel container");
-    
+
     // Step 2.1 : Choose a computer
     string theMachine = _ResManager->FindFirst(possibleComputers);
     if(theMachine == "") {
@@ -376,7 +376,13 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const,
        // Step 3 : starting parallel container proxy
        params.hostname = CORBA::string_dup(theMachine.c_str());
        Engines::MachineParameters params_proxy(params);
-       command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerProxy", params_proxy, "xterm");
+       try {
+         command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerProxy", params_proxy, "xterm");
+       }
+       catch(const SALOME_Exception & ex){
+         MESSAGE(ex.what());
+         return Engines::Container::_nil();
+       }
        // LaunchParallelContainer uses this value to know if it launches the proxy or the nodes
        params_proxy.nb_component_nodes = 0;
        obj = LaunchParallelContainer(command, params_proxy, _NS->ContainerName(params));
@@ -387,39 +393,38 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const,
        command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerNode", params, "xterm");
        string name = _NS->ContainerName(params) + "Node";
        LaunchParallelContainer(command, params, name);
-
        // Step 5 : connecting nodes and the proxy to actually create a parallel container
        try {
-       for (int i = 0; i < params.nb_component_nodes; i++) {
+         for (int i = 0; i < params.nb_component_nodes; i++) {
 
-       char buffer [5];
+           char buffer [5];
 #ifndef WNT
-         snprintf(buffer,5,"%d",i);
+           snprintf(buffer,5,"%d",i);
 #else
-         _snprintf(buffer,5,"%d",i);
+           _snprintf(buffer,5,"%d",i);
 #endif
-       string name_cont = name + string(buffer);
-
-       string theNodeMachine(CORBA::string_dup(params.hostname));
-       string containerNameInNS = _NS->BuildContainerNameForNS(name_cont.c_str(),theNodeMachine.c_str());
-       int count = TIME_OUT_TO_LAUNCH_CONT;
-       obj = _NS->Resolve(containerNameInNS.c_str());
-       while (CORBA::is_nil(obj) && count) {
-         INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!");
+           string name_cont = name + string(buffer);
+
+           string theNodeMachine(CORBA::string_dup(params.hostname));
+           string containerNameInNS = _NS->BuildContainerNameForNS(name_cont.c_str(),theNodeMachine.c_str());
+           int count = TIME_OUT_TO_LAUNCH_CONT;
+           obj = _NS->Resolve(containerNameInNS.c_str());
+           while (CORBA::is_nil(obj) && count) {
+             INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!");
 #ifndef WNT
-         sleep(1) ;
+             sleep(1) ;
 #else
-         Sleep(1000);
+             Sleep(1000);
 #endif
-         count-- ;
-         obj = _NS->Resolve(containerNameInNS.c_str());
-       }
-
-       PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
-       MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name);
-       node->deploy();
-       }
-       proxy->start();
+             count-- ;
+             obj = _NS->Resolve(containerNameInNS.c_str());
+           }
+
+           PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
+           MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name);
+           node->deploy();
+         }
+         proxy->start();
        }
        catch(CORBA::SystemException& e)
        {
@@ -443,13 +448,12 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const,
        }
        INFOS("[FindOrStartParallelContainer] node " << name << " deployed");
       }
-
       else {
        INFOS("[FindOrStartParallelContainer] Currently parallel containers are launched only on the local host");
       }
     }
-  }
-  return ret;
+}
+return ret;
 }
 #else
 //=============================================================================
@@ -558,7 +562,8 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
 {
   CORBA::Object_ptr obj = CORBA::Object::_nil();
   string containerNameInNS;
-
+  MESSAGE("[LaunchParallelContainer] : command to launch...");
+  MESSAGE(command);
   if (params.nb_component_nodes == 0) {
     INFOS("[LaunchParallelContainer] launching the proxy of the parallel container");
     int status = system(command.c_str());
@@ -573,7 +578,7 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
     string theMachine(CORBA::string_dup(params.hostname));
     containerNameInNS = _NS->BuildContainerNameForNS((char*) name.c_str(),theMachine.c_str());
 
-    INFOS("[LaunchContainer]  Waiting for Parallel Container proxy on " << theMachine);
+    INFOS("[LaunchParallelContainer]  Waiting for Parallel Container proxy on " << theMachine);
     while (CORBA::is_nil(obj) && count) {
 #ifndef WNT
       sleep(1) ;
index d693227a1bcca41baf1622ffc5823a26661ebbce..f282ac73515099a32713646ef29594b46ba6782c 100644 (file)
@@ -1040,9 +1040,9 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s
     //command = "gdb --args ";
     //command = "valgrind --tool=memcheck --log-file=val_log ";
     //command += real_exe_name;
-    
+
     command = real_exe_name;
-    
+
     command += " " + _NS->ContainerName(rtn);
     command += " " + parallelLib;
     command += " " + hostname;
@@ -1050,7 +1050,7 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s
     AddOmninamesParams(command);
   }
 
-  if (parallelLib == "Mpi")
+  else if (parallelLib == "Mpi")
   {
     // Step 1 : check if MPI is started
     if (_MpiStarted == false)
@@ -1084,6 +1084,11 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::s
       AddOmninamesParams(command);
     }
   }
+  else
+  {
+    std::string message("Unknown parallelLib" + parallelLib);
+    throw SALOME_Exception(message.c_str());
+  }
 
   // log choice
   if (log == "default")