From: ribes Date: Fri, 18 Jan 2008 15:19:55 +0000 (+0000) Subject: - Add an exception if parallelLib is not correct X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ac4d443a217f68ae47eac48ac0a5736a772777ae;p=modules%2Fkernel.git - Add an exception if parallelLib is not correct --- diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 72a2b7345..b74dda375 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -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) ; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index d693227a1..f282ac735 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -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")