-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 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
threadPol->destroy();
PortableServer::ObjectId_var id = _poa->activate_object(this);
CORBA::Object_var obj = _poa->id_to_reference(id);
- Engines::ContainerManager_var refContMan =
- Engines::ContainerManager::_narrow(obj);
-
- _NS->Register(refContMan,_ContainerManagerNameInNS);
+ Engines::ContainerManager_var refContMan = Engines::ContainerManager::_narrow(obj);
+ if(_NS)
+ _NS->Register(refContMan,_ContainerManagerNameInNS);
_isAppliSalomeDefined = (GetenvThreadSafe("APPLI") != 0);
#ifdef HAVE_MPI2
{
MESSAGE("Shutdown");
ShutdownContainers();
- _NS->Destroy_Name(_ContainerManagerNameInNS);
+ if(_NS)
+ _NS->Destroy_Name(_ContainerManagerNameInNS);
PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
_poa->deactivate_object(oid);
}
void SALOME_ContainerManager::ShutdownContainers()
{
MESSAGE("ShutdownContainers");
-
+ if(!_NS)
+ return ;
SALOME::Session_var session = SALOME::Session::_nil();
CORBA::Long pid = 0;
CORBA::Object_var objS = _NS->Resolve("/Kernel/Session");
if(!CORBA::is_nil(cont) && pid != cont->getPID())
lstCont.push_back((*iter));
}
- catch(const CORBA::Exception& e)
+ catch(const CORBA::Exception&)
{
// ignore this entry and continue
}
break;
}
}
- catch(const SALOME_Exception &ex)
+ catch(const SALOME_Exception &ex) //!< TODO: unused variable
{
MESSAGE("[GiveContainer] Exception in ResourceManager find !: " << ex.what());
return ret;
std::string hostname(resource_definition.HostName);
std::string containerNameInNS;
if(params.isMPI){
- int nbproc;
- if ( params.nb_proc <= 0 )
- nbproc = 1;
- else
- nbproc = params.nb_proc;
+ int nbproc = params.nb_proc <= 0 ? 1 : params.nb_proc;
try
{
if( GetenvThreadSafe("LIBBATCH_NODEFILE") != NULL )
// Launch remote command
command += " \"ls /tmp >/dev/null 2>&1\"";
- int status = SystemThreadSafe(command.c_str());
+ // Anthony : command is NO MORE launched to improve dramatically time to launch containers
+ int status = 0;
if (status != 0)
{
// Error on resource - cannot launch commands
else
return Engines::Container::_narrow(obj);
}
- catch(const CORBA::Exception& e)
+ catch(const CORBA::Exception&)
{
return Engines::Container::_nil();
}
{
return false; // VSR 02/08/2013: Python containers are no more supported
bool ret = false;
- int len = strlen(ContainerName);
+ size_t len = strlen(ContainerName);
if (len >= 2)
if (strcmp(ContainerName + len - 2, "Py") == 0)
command = BuildTempFileToLaunchRemoteContainer(resource_name, params, tmpFileName);
else
{
- int nbproc;
const ParserResourcesType resInfo(_resManager->GetResourceDefinition(resource_name));
- if (params.isMPI)
- {
- if ( params.nb_proc <= 0 )
- nbproc = 1;
- else
- nbproc = params.nb_proc;
- }
-
std::string wdir = params.workingdir.in();
- // "ssh -l user machine distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir \
- // SALOME_Container containerName -ORBInitRef NameService=IOR:01000..."
+ // "ssh -l user machine distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir
+ // SALOME_Container containerName -ORBInitRef NameService=IOR:01000..."
// or
// "ssh -l user machine distantLauncher remote -p hostNS -m portNS -d dir
// -- SALOME_Container contName -ORBInitRef NameService=IOR:01000..."
if(params.isMPI)
{
+ int nbproc = params.nb_proc <= 0 ? 1 : params.nb_proc;
command += " mpirun -np ";
std::ostringstream o;
o << nbproc << " ";
{
tmpFileName = BuildTemporaryFileName();
std::string command;
- int nbproc = 0;
std::ostringstream o;
if (params.isMPI)
{
- o << "mpirun -np ";
+ int nbproc = params.nb_proc <= 0 ? 1 : params.nb_proc;
- if ( params.nb_proc <= 0 )
- nbproc = 1;
- else
- nbproc = params.nb_proc;
+ o << "mpirun -np ";
o << nbproc << " ";
void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName)
{
- int length = tmpFileName.size();
+ size_t length = tmpFileName.size();
if ( length > 0)
{
#ifdef WIN32
if (params.isMPI)
{
- tempOutputFile << "mpirun -np ";
- int nbproc;
-
- if ( params.nb_proc <= 0 )
- nbproc = 1;
- else
- nbproc = params.nb_proc;
+ int nbproc = params.nb_proc <= 0 ? 1 : params.nb_proc;
- std::ostringstream o;
+ tempOutputFile << "mpirun -np ";
tempOutputFile << nbproc << " ";
#ifdef LAM_MPI
case srun:
// no need to redefine the user with srun, the job user is taken by default
// (note: for srun, user id can be specified with " --uid=<user>")
- command << "srun -n 1 -N 1 --share --mem-per-cpu=0 --nodelist=" << hostname << " ";
+ command << "srun -n 1 -N 1 -s --mem-per-cpu=0 --nodelist=" << hostname << " ";
break;
case pbsdsh:
command << "pbsdsh -o -h " << hostname << " ";
for(std::size_t i=0;i<sz;i++)
args[i] = strdup(command[i].c_str());
args[sz] = nullptr;
- execvp( command[0].c_str() , args );
+ execvp( command[0].c_str() , args );
std::ostringstream oss;
oss << "Error when launching " << command[0];
throw SALOME_Exception(oss.str().c_str()); // execvp failed
#else
Engines::Container_ptr
-SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& params,
- std::string resource_selected)
+SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& /*params*/,
+ std::string /*resource_selected*/)
{
Engines::Container_ptr ret = Engines::Container::_nil();
INFOS("[StarPaCOPPContainer] is disabled !");
}
std::string
-SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params,
- std::string machine_file_name,
- std::string & proxy_hostname)
+SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& /*params*/,
+ 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)
+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*/)
{
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)
+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*/)
{
}
CORBA::Object_ptr
-SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command,
- const Engines::ContainerParameters& params,
- const std::string& hostname)
+SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& /*command*/,
+ const Engines::ContainerParameters& /*params*/,
+ const std::string& /*hostname*/)
{
CORBA::Object_ptr ret = CORBA::Object::_nil();
return ret;
}
bool
-SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
- const Engines::ContainerParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
+SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& /*command*/,
+ const Engines::ContainerParameters& /*params*/,
+ const std::string& /*name*/,
+ SALOME_ContainerManager::actual_launch_machine_t & /*vect_machine*/)
{
return false;
}