X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FContainer%2FSALOME_ContainerManager.cxx;h=a22a39c2fc7a866980f68da5e639bb35c9fbe0e3;hb=6154bba6020465244a40f05f034ba93aabf304a2;hp=7d923bcf16e22c4ad4bb115a4623b657de09cebe;hpb=20d65cd1831737b804f73660899d4897dcd9d8cb;p=modules%2Fkernel.git diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 7d923bcf1..a22a39c2f 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "SALOME_ContainerManager.hxx" #include "SALOME_NamingService.hxx" #include "SALOME_ModuleCatalog.hh" @@ -33,14 +34,17 @@ #include "Utils_CorbaException.hxx" #include +#ifdef WNT +#include +#define getpid _getpid +#endif + #ifdef WITH_PACO_PARALLEL #include "PaCOPP.hxx" #endif #define TIME_OUT_TO_LAUNCH_CONT 61 -using namespace std; - const char *SALOME_ContainerManager::_ContainerManagerNameInNS = "/ContainerManager"; @@ -82,9 +86,14 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableSer #ifdef HAVE_MPI2 #ifdef WITHOPENMPI + std::string urifile = getenv("HOME"); + std::ostringstream mypid; + mypid << getpid(); + urifile += "/.urifile_" + mypid.str(); + setenv("OMPI_URI_FILE",urifile.c_str(),0); if( getenv("OMPI_URI_FILE") != NULL ){ system("killall ompi-server"); - string command; + std::string command; command = "ompi-server -r "; command += getenv("OMPI_URI_FILE"); int status=system(command.c_str()); @@ -141,9 +150,9 @@ void SALOME_ContainerManager::ShutdownContainers() bool isOK; isOK = _NS->Change_Directory("/Containers"); if( isOK ){ - vector vec = _NS->list_directory_recurs(); - list lstCont; - for(vector::iterator iter = vec.begin();iter!=vec.end();iter++) + std::vector vec = _NS->list_directory_recurs(); + std::list lstCont; + for(std::vector::iterator iter = vec.begin();iter!=vec.end();iter++) { SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); @@ -159,10 +168,10 @@ void SALOME_ContainerManager::ShutdownContainers() } } MESSAGE("Container list: "); - for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){ + for(std::list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){ SCRUTE((*iter)); } - for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++) + for(std::list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++) { try { @@ -203,7 +212,7 @@ void SALOME_ContainerManager::ShutdownContainers() Engines::Container_ptr SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& params) { - string machFile; + std::string machFile; Engines::Container_ptr ret = Engines::Container::_nil(); // Step 0: Default mode is start @@ -214,7 +223,7 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param MESSAGE("[GiveContainer] starting with mode: " << mode); // Step 1: Find Container for find and findorstart mode - if (mode == "find" or mode == "findorstart") + if (mode == "find" || mode == "findorstart") { ret = FindContainer(params, params.resource_params.resList); if(!CORBA::is_nil(ret)) @@ -223,12 +232,12 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param { if (mode == "find") { - MESSAGE("[GiveContainer] no container found"); - return ret; + MESSAGE("[GiveContainer] no container found"); + return ret; } else { - mode = "start"; + mode = "start"; } } } @@ -246,8 +255,8 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param Engines::Container_ptr cont = FindContainer(params, possibleResources[i].in()); try { - if(!cont->_non_existent()) - local_resources.push_back(string(possibleResources[i])); + if(!cont->_non_existent()) + local_resources.push_back(std::string(possibleResources[i])); } catch(CORBA::Exception&) {} } @@ -261,7 +270,7 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param } else for(unsigned int i=0; i < possibleResources->length(); i++) - local_resources.push_back(string(possibleResources[i])); + local_resources.push_back(std::string(possibleResources[i])); // Step 4: select the resource where to get/start the container std::string resource_selected; @@ -282,14 +291,10 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param std::string containerNameInNS; if(params.isMPI){ int nbproc; - if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; if( getenv("LIBBATCH_NODEFILE") != NULL ) machFile = machinesFile(nbproc); // A mpi parallel container register on zero node in NS @@ -310,14 +315,14 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param Engines::Container_var cont=Engines::Container::_narrow(obj); if(!cont->_non_existent()) { - if(std::string(params.mode.in())=="getorstart" or std::string(params.mode.in())=="get"){ - return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/ - } - else - { - INFOS("[GiveContainer] A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container"); - cont->Shutdown(); // shutdown the registered container if it exists - } + if(std::string(params.mode.in())=="getorstart" || std::string(params.mode.in())=="get"){ + return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/ + } + else + { + INFOS("[GiveContainer] A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container"); + cont->Shutdown(); // shutdown the registered container if it exists + } } } catch(CORBA::Exception&) @@ -349,20 +354,20 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(compoi); if (CORBA::is_nil (compoInfo)) { - continue; + continue; } SALOME_ModuleCatalog::ImplType impl=compoInfo->implementation_type(); container_exe_tmp=compoInfo->implementation_name(); if(impl==SALOME_ModuleCatalog::CEXE) { - if(found) - { - INFOS("ContainerManager Error: you can't have 2 CEXE component in the same container" ); - return Engines::Container::_nil(); - } - MESSAGE("[GiveContainer] Exe container found !: " << container_exe_tmp); - container_exe = container_exe_tmp.in(); - found=1; + if(found) + { + INFOS("ContainerManager Error: you can't have 2 CEXE component in the same container" ); + return Engines::Container::_nil(); + } + MESSAGE("[GiveContainer] Exe container found !: " << container_exe_tmp); + container_exe = container_exe_tmp.in(); + found=1; } } } @@ -400,10 +405,12 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param //redirect stdout and stderr in a file #ifdef WNT - string logFilename=getenv("TEMP"); + std::string logFilename=getenv("TEMP"); logFilename += "\\"; + std::string user = getenv( "USERNAME" ); #else - string logFilename="/tmp"; + std::string user = getenv( "USER" ); + std::string logFilename="/tmp"; char* val = getenv("SALOME_TMP_DIR"); if(val) { @@ -415,7 +422,11 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param } logFilename += "/"; #endif - logFilename += _NS->ContainerName(params)+"_"+ resource_selected +"_"+getenv( "USER" )+".log" ; + logFilename += _NS->ContainerName(params)+"_"+ resource_selected +"_"+user; + std::ostringstream tmp; + tmp << "_" << getpid(); + logFilename += tmp.str(); + logFilename += ".log" ; command += " > " + logFilename + " 2>&1"; #ifdef WNT command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\""; @@ -461,7 +472,7 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param // Setting log file name logFilename=":"+logFilename; logFilename="@"+Kernel_Utils::GetHostname()+logFilename; - logFilename=getenv( "USER" )+logFilename; + logFilename=user+logFilename; ret->logfilename(logFilename.c_str()); RmTmpFile(_TmpFileName); // command file can be removed here } @@ -520,6 +531,9 @@ SALOME_ContainerManager::FindContainer(const Engines::ContainerParameters& param } } + +bool isPythonContainer(const char* ContainerName); + //============================================================================= /*! * This is no longer valid (C++ container are also python containers) @@ -560,13 +574,13 @@ bool isPythonContainer(const char* ContainerName) */ //============================================================================= -string +std::string SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer -(const string& resource_name, +(const std::string& resource_name, const Engines::ContainerParameters& params, const std::string& container_exe) { - string command; + std::string command; if (!_isAppliSalomeDefined) command = BuildTempFileToLaunchRemoteContainer(resource_name, params); else @@ -578,14 +592,10 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer if (params.isMPI) { - if ((params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0)) - nbproc = 1; - else if (params.resource_params.nb_node == 0) - nbproc = params.resource_params.nb_proc_per_node; - else if (params.resource_params.nb_proc_per_node == 0) - nbproc = params.resource_params.nb_node; + if ( params.nb_proc <= 0 ) + nbproc = 1; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; } // "ssh -l user machine distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir \ @@ -630,7 +640,7 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer command += " WORKINGDIR "; command += " '"; if(wdir == "$TEMPDIR") - wdir="\\$TEMPDIR"; + wdir="\\$TEMPDIR"; command += wdir; // requested working directory command += "'"; } @@ -645,10 +655,10 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; #elif defined(WITHOPENMPI) if( getenv("OMPI_URI_FILE") == NULL ) - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; else{ - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; - command += getenv("OMPI_URI_FILE"); + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; + command += getenv("OMPI_URI_FILE"); } #endif command += " SALOME_MPIContainer "; @@ -671,33 +681,29 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer * builds the command to be launched. */ //============================================================================= -string +std::string SALOME_ContainerManager::BuildCommandToLaunchLocalContainer (const Engines::ContainerParameters& params, const std::string& machinesFile, const std::string& container_exe) { _TmpFileName = BuildTemporaryFileName(); - string command; + std::string command; int nbproc = 0; - ostringstream o; + std::ostringstream o; if (params.isMPI) { o << "mpirun -np "; - if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; o << nbproc << " "; if( getenv("LIBBATCH_NODEFILE") != NULL ) - o << "-machinefile " << machinesFile << " "; + o << "-machinefile " << machinesFile << " "; #ifdef WITHLAM o << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; @@ -726,9 +732,9 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer if(wdir == "$TEMPDIR") { // a new temporary directory is requested - string dir = Kernel_Utils::GetTmpDir(); + std::string dir = Kernel_Utils::GetTmpDir(); #ifdef WIN32 - o << "cd /d " << dir << endl; + o << "cd /d " << dir << std::endl; #else o << "cd " << dir << ";"; #endif @@ -738,8 +744,8 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer { // a permanent directory is requested use it or create it #ifdef WIN32 - o << "mkdir " + wdir << endl; - o << "cd /D " + wdir << endl; + o << "mkdir " + wdir << std::endl; + o << "cd /D " + wdir << std::endl; #else o << "mkdir -p " << wdir << " && cd " << wdir + ";"; #endif @@ -756,7 +762,7 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer o << " -"; AddOmninamesParams(o); - ofstream command_file( _TmpFileName.c_str() ); + std::ofstream command_file( _TmpFileName.c_str() ); command_file << o.str(); command_file.close(); @@ -783,9 +789,9 @@ void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName) if ( lenght > 0) { #ifdef WIN32 - string command = "del /F "; + std::string command = "del /F "; #else - string command = "rm "; + std::string command = "rm "; #endif if ( lenght > 4 ) command += tmpFileName.substr(0, lenght - 3 ); @@ -794,7 +800,7 @@ void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName) command += '*'; system(command.c_str()); //if dir is empty - remove it - string tmp_dir = Kernel_Utils::GetDirByPath( tmpFileName ); + std::string tmp_dir = Kernel_Utils::GetDirByPath( tmpFileName ); if ( Kernel_Utils::IsEmptyDir( tmp_dir ) ) { #ifdef WIN32 @@ -813,7 +819,7 @@ void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName) */ //============================================================================= -void SALOME_ContainerManager::AddOmninamesParams(string& command) const +void SALOME_ContainerManager::AddOmninamesParams(std::string& command) const { CORBA::String_var iorstr = _NS->getIORaddr(); command += "ORBInitRef NameService="; @@ -826,7 +832,7 @@ void SALOME_ContainerManager::AddOmninamesParams(string& command) const */ //============================================================================= -void SALOME_ContainerManager::AddOmninamesParams(ofstream& fileStream) const +void SALOME_ContainerManager::AddOmninamesParams(std::ofstream& fileStream) const { CORBA::String_var iorstr = _NS->getIORaddr(); fileStream << "ORBInitRef NameService="; @@ -839,7 +845,7 @@ void SALOME_ContainerManager::AddOmninamesParams(ofstream& fileStream) const */ //============================================================================= -void SALOME_ContainerManager::AddOmninamesParams(ostringstream& oss) const +void SALOME_ContainerManager::AddOmninamesParams(std::ostringstream& oss) const { CORBA::String_var iorstr = _NS->getIORaddr(); oss << "ORBInitRef NameService="; @@ -852,10 +858,10 @@ void SALOME_ContainerManager::AddOmninamesParams(ostringstream& oss) const */ //============================================================================= -string SALOME_ContainerManager::BuildTemporaryFileName() const +std::string SALOME_ContainerManager::BuildTemporaryFileName() const { //build more complex file name to support multiple salome session - string aFileName = Kernel_Utils::GetTmpFileName(); + std::string aFileName = Kernel_Utils::GetTmpFileName(); #ifndef WIN32 aFileName += ".sh"; #else @@ -874,22 +880,22 @@ string SALOME_ContainerManager::BuildTemporaryFileName() const */ //============================================================================= -string +std::string SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer -(const string& resource_name, +(const std::string& resource_name, const Engines::ContainerParameters& params) throw(SALOME_Exception) { int status; _TmpFileName = BuildTemporaryFileName(); - ofstream tempOutputFile; - tempOutputFile.open(_TmpFileName.c_str(), ofstream::out ); + std::ofstream tempOutputFile; + tempOutputFile.open(_TmpFileName.c_str(), std::ofstream::out ); const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesDescr(resource_name); - tempOutputFile << "#! /bin/sh" << endl; + tempOutputFile << "#! /bin/sh" << std::endl; // --- set env vars - tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace" + tempOutputFile << "export SALOME_trace=local" << std::endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace" //tempOutputFile << "source " << resInfo.PreReqFilePath << endl; // ! env vars @@ -899,14 +905,10 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer tempOutputFile << "mpirun -np "; int nbproc; - if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; std::ostringstream o; @@ -943,7 +945,7 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer tempOutputFile << _NS->ContainerName(params) << " -"; AddOmninamesParams(tempOutputFile); - tempOutputFile << " &" << endl; + tempOutputFile << " &" << std::endl; tempOutputFile.flush(); tempOutputFile.close(); #ifndef WIN32 @@ -952,12 +954,12 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer // --- Build command - string command; + std::string command; if (resInfo.Protocol == rsh) { command = "rsh "; - string commandRcp = "rcp "; + std::string commandRcp = "rcp "; commandRcp += _TmpFileName; commandRcp += " "; commandRcp += resInfo.HostName; @@ -969,7 +971,7 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer else if (resInfo.Protocol == ssh) { command = "ssh "; - string commandRcp = "scp "; + std::string commandRcp = "scp "; commandRcp += _TmpFileName; commandRcp += " "; commandRcp += resInfo.HostName; @@ -994,22 +996,65 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer } -string SALOME_ContainerManager::GetMPIZeroNode(const string machine, const string machinesFile) +std::string SALOME_ContainerManager::GetMPIZeroNode(const std::string machine, const std::string machinesFile) { int status; - string zeronode; - string cmd; - string tmpFile = BuildTemporaryFileName(); + std::string zeronode; + std::string command; + std::string tmpFile = BuildTemporaryFileName(); if( getenv("LIBBATCH_NODEFILE") == NULL ) - cmd = "ssh " + machine + " mpirun -np 1 hostname > " + tmpFile; + { + if (_isAppliSalomeDefined) + { + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesDescr(machine); + + if (resInfo.Protocol == rsh) + command = "rsh "; + else if (resInfo.Protocol == ssh) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (resInfo.UserName != "") + { + command += "-l "; + command += resInfo.UserName; + command += " "; + } + + command += resInfo.HostName; + command += " "; + + if (resInfo.AppliPath != "") + command += resInfo.AppliPath; // path relative to user@machine $HOME + else + { + ASSERT(getenv("APPLI")); + command += getenv("APPLI"); // path relative to user@machine $HOME + } + + command += "/runRemote.sh "; + + ASSERT(getenv("NSHOST")); + command += getenv("NSHOST"); // hostname of CORBA name server + + command += " "; + ASSERT(getenv("NSPORT")); + command += getenv("NSPORT"); // port of CORBA name server + + command += " mpirun -np 1 hostname > " + tmpFile; + } + else + command = "mpirun -np 1 hostname > " + tmpFile; + } else - cmd = "mpirun -np 1 -machinefile " + machinesFile + " hostname > " + tmpFile; + command = "mpirun -np 1 -machinefile " + machinesFile + " hostname > " + tmpFile; - status = system(cmd.c_str()); + status = system(command.c_str()); if( status == 0 ){ - ifstream fp(tmpFile.c_str(),ios::in); - fp >> zeronode; + std::ifstream fp(tmpFile.c_str(),std::ios::in); + while(fp >> zeronode); } RmTmpFile(tmpFile); @@ -1017,13 +1062,13 @@ string SALOME_ContainerManager::GetMPIZeroNode(const string machine, const strin return zeronode; } -string SALOME_ContainerManager::machinesFile(const int nbproc) +std::string SALOME_ContainerManager::machinesFile(const int nbproc) { - string tmp; - string nodesFile = getenv("LIBBATCH_NODEFILE"); - string machinesFile = Kernel_Utils::GetTmpFileName(); - ifstream fpi(nodesFile.c_str(),ios::in); - ofstream fpo(machinesFile.c_str(),ios::out); + std::string tmp; + std::string nodesFile = getenv("LIBBATCH_NODEFILE"); + std::string machinesFile = Kernel_Utils::GetTmpFileName(); + std::ifstream fpi(nodesFile.c_str(),std::ios::in); + std::ofstream fpo(machinesFile.c_str(),std::ios::out); _numInstanceMutex.lock(); @@ -1032,7 +1077,7 @@ string SALOME_ContainerManager::machinesFile(const int nbproc) for(int i=0;i> tmp ) - fpo << tmp << endl; + fpo << tmp << std::endl; else throw SALOME_Exception("You ask more processes than batch session have allocated!"); @@ -1060,7 +1105,7 @@ SALOME_ContainerManager::checkPaCOParameters(Engines::ContainerParameters & para } // Check parallelLib std::string parallelLib = params.parallelLib.in(); - if (parallelLib != "Mpi" and parallelLib != "Dummy") + if (parallelLib != "Mpi" && parallelLib != "Dummy") { INFOS("[checkPaCOParameters] parallelLib is not correctly defined"); INFOS("[checkPaCOParameters] you can chosse between: Mpi and Dummy"); @@ -1080,7 +1125,7 @@ SALOME_ContainerManager::checkPaCOParameters(Engines::ContainerParameters & para std::string username = resource_definition->username.in(); std::string applipath = resource_definition->applipath.in(); - if (protocol == "" or username == "" or applipath == "") + if (protocol == "" || username == "" || applipath == "") { INFOS("[checkPaCOParameters] resource selected is not well defined"); INFOS("[checkPaCOParameters] resource name: " << resource_definition->name.in()); @@ -1104,7 +1149,7 @@ SALOME_ContainerManager::checkPaCOParameters(Engines::ContainerParameters & para //============================================================================= Engines::Container_ptr SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& params_const, - std::string resource_selected) + std::string resource_selected) { CORBA::Object_var obj; PaCO::InterfaceManager_var container_proxy; @@ -1125,8 +1170,8 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters // Step 2 : Get a MachineFile for the parallel container std::string machine_file_name = _ResManager->getMachineFile(resource_selected, - params.nb_proc, - params.parallelLib.in()); + params.nb_proc, + params.parallelLib.in()); if (machine_file_name == "") { @@ -1265,8 +1310,8 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters std::string SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params, - std::string machine_file_name, - std::string & proxy_hostname) + std::string machine_file_name, + std::string & proxy_hostname) { // In the proxy case, we always launch a Dummy Proxy std::string exe_name = "SALOME_ParallelContainerProxyDummy"; @@ -1286,7 +1331,7 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::C std::ifstream machine_file(machine_file_name.c_str()); std::getline(machine_file, hostname, ' '); size_t found = hostname.find('\n'); - if (found!=string::npos) + if (found!=std::string::npos) hostname.erase(found, 1); // Remove \n proxy_hostname = hostname; MESSAGE("[BuildCommandToLaunchPaCOProxyContainer] machine file name extracted is " << hostname); @@ -1348,9 +1393,9 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::C std::string SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params, - const std::string & machine_file_name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string & proxy_hostname) + const std::string & machine_file_name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string & proxy_hostname) { // Name of exe std::string exe_name = "SALOME_ParallelContainerNode"; @@ -1387,8 +1432,8 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co bool remote_execution = false; if (hostname != std::string(Kernel_Utils::GetHostname())) { - MESSAGE("[BuildCommandToLaunchPaCONodeContainer] remote machine case detected !"); - remote_execution = true; + MESSAGE("[BuildCommandToLaunchPaCONodeContainer] remote machine case detected !"); + remote_execution = true; } // For each node we have a new command @@ -1406,17 +1451,17 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co // a SALOME application if (remote_execution) { - ASSERT(getenv("NSHOST")); - ASSERT(getenv("NSPORT")); - - command_node_stream << resource_definition->protocol.in(); - command_node_stream << " -l "; - command_node_stream << resource_definition->username.in(); - command_node_stream << " " << hostname; - command_node_stream << " " << resource_definition->applipath.in(); - command_node_stream << "/runRemote.sh "; - command_node_stream << getenv("NSHOST") << " "; // hostname of CORBA name server - command_node_stream << getenv("NSPORT") << " "; // port of CORBA name server + ASSERT(getenv("NSHOST")); + ASSERT(getenv("NSPORT")); + + command_node_stream << resource_definition->protocol.in(); + command_node_stream << " -l "; + command_node_stream << resource_definition->username.in(); + command_node_stream << " " << hostname; + command_node_stream << " " << resource_definition->applipath.in(); + command_node_stream << "/runRemote.sh "; + command_node_stream << getenv("NSHOST") << " "; // hostname of CORBA name server + command_node_stream << getenv("NSPORT") << " "; // port of CORBA name server } command_node_stream << exe_name; @@ -1524,11 +1569,11 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co void SALOME_ContainerManager::LogConfiguration(const std::string & log_type, - const std::string & exe_type, - const std::string & container_name, - const std::string & hostname, - std::string & begin, - std::string & end) + const std::string & exe_type, + const std::string & container_name, + const std::string & hostname, + std::string & begin, + std::string & end) { if(log_type == "xterm") { @@ -1551,8 +1596,8 @@ SALOME_ContainerManager::LogConfiguration(const std::string & log_type, CORBA::Object_ptr SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string & hostname) + const Engines::ContainerParameters& params, + const std::string & hostname) { PaCO::InterfaceManager_ptr container_proxy = PaCO::InterfaceManager::_nil(); @@ -1570,7 +1615,7 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, int count = TIME_OUT_TO_LAUNCH_CONT; CORBA::Object_var obj = CORBA::Object::_nil(); std::string containerNameInNS = _NS->BuildContainerNameForNS(params.container_name.in(), - hostname.c_str()); + hostname.c_str()); MESSAGE("[LaunchParallelContainer] Waiting for Parallel Container proxy : " << containerNameInNS); while (CORBA::is_nil(obj) && count) @@ -1670,7 +1715,7 @@ SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command, Engines::Container_ptr SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& params, - std::string resource_selected) + std::string resource_selected) { Engines::Container_ptr ret = Engines::Container::_nil(); INFOS("[StarPaCOPPContainer] is disabled !"); @@ -1680,34 +1725,34 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters std::string SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params, - std::string machine_file_name, - std::string & proxy_hostname) + std::string machine_file_name, + std::string & proxy_hostname) { return ""; } std::string SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params, - const std::string & machine_file_name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string & proxy_hostname) + const std::string & machine_file_name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string & proxy_hostname) { return ""; } void SALOME_ContainerManager::LogConfiguration(const std::string & log_type, - const std::string & exe_type, - const std::string & container_name, - const std::string & hostname, - std::string & begin, - std::string & end) + const std::string & exe_type, + const std::string & container_name, + const std::string & hostname, + std::string & begin, + std::string & end) { } CORBA::Object_ptr SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string& hostname) + const Engines::ContainerParameters& params, + const std::string& hostname) { CORBA::Object_ptr ret = CORBA::Object::_nil(); return ret; @@ -1715,9 +1760,9 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, bool SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine) + const Engines::ContainerParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine) { return false; }