Version: 8.3.0
SALOME_ContainerManager Class Reference

#include <SALOME_ContainerManager.hxx>

Inheritance diagram for SALOME_ContainerManager:

Public Member Functions

 SALOME_ContainerManager (CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns)
 Constructor. More...
 
 ~SALOME_ContainerManager ()
 destructor More...
 
Engines::Container_ptr GiveContainer (const Engines::ContainerParameters &params)
 Give a suitable Container given constraints. More...
 
void ShutdownContainers ()
 Loop on all the containers listed in naming service, ask shutdown on each. More...
 
void Shutdown ()
 shutdown all the containers, then the ContainerManager servant More...
 

Static Public Member Functions

static charGetenvThreadSafe (const char *name)
 
static std::string GetenvThreadSafeAsString (const char *name)
 
static int SystemThreadSafe (const char *command)
 
static void AddOmninamesParams (std::ostream &fileStream, SALOME_NamingService *ns)
 add to command all options relative to naming service. More...
 
static void MakeTheCommandToBeLaunchedASync (std::string &command)
 
static int GetTimeOutToLoaunchServer ()
 
static void SleepInSecond (int ellapseTimeInSecond)
 

Static Public Attributes

static const char_ContainerManagerNameInNS
 

Protected Types

typedef std::vector< std::string > actual_launch_machine_t
 

Protected Member Functions

Engines::Container_ptr FindContainer (const Engines::ContainerParameters &params, const Engines::ResourceList &possibleResources)
 Find a container given constraints (params) on a list of machines (possibleComputers) agy : this method is ThreadSafe. More...
 
Engines::Container_ptr FindContainer (const Engines::ContainerParameters &params, const std::string &resource)
 Find a container given constraints (params) on a machine (theMachine) agy : this method is ThreadSafe. More...
 
std::string BuildCommandToLaunchRemoteContainer (const std::string &resource_name, const Engines::ContainerParameters &params, const std::string &container_exe="SALOME_Container") const
 Builds the script to be launched. More...
 
std::string BuildCommandToLaunchLocalContainer (const Engines::ContainerParameters &params, const std::string &machinesFile, const std::string &container_exe, std::string &tmpFileName) const
 builds the command to be launched. More...
 
std::string BuildTempFileToLaunchRemoteContainer (const std::string &resource_name, const Engines::ContainerParameters &params, std::string &tmpFileName) const
 Builds in a temporary file the script to be launched. More...
 
void AddOmninamesParams (std::string &command) const
 add to command all options relative to naming service. More...
 
void AddOmninamesParams (std::ostream &fileStream) const
 add to command all options relative to naming service. More...
 
std::string GetMPIZeroNode (const std::string machine, const std::string machinesFile) const
 
std::string machinesFile (const int nbproc)
 
std::set< pid_t > getpidofprogram (const std::string program)
 
Engines::Container_ptr LaunchContainer (const Engines::ContainerParameters &params, const std::string &resource_selected, const std::string &hostname, const std::string &machFile, const std::string &containerNameInNS)
 
bool checkPaCOParameters (Engines::ContainerParameters &params, std::string resource_selected)
 
Engines::Container_ptr StartPaCOPPContainer (const Engines::ContainerParameters &params, std::string resource_selected)
 
std::string BuildCommandToLaunchPaCOProxyContainer (const Engines::ContainerParameters &params, std::string machine_file_name, std::string &proxy_hostname)
 
std::string BuildCommandToLaunchPaCONodeContainer (const Engines::ContainerParameters &params, const std::string &machine_file_name, SALOME_ContainerManager::actual_launch_machine_t &vect_machine, const std::string &proxy_hostname)
 
void 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 LaunchPaCOProxyContainer (const std::string &command, const Engines::ContainerParameters &params, const std::string &hostname)
 
bool LaunchPaCONodeContainer (const std::string &command, const Engines::ContainerParameters &params, const std::string &name, SALOME_ContainerManager::actual_launch_machine_t &vect_machine)
 

Static Protected Member Functions

static void RmTmpFile (std::string &tmpFile)
 removes the generated temporary file in case of a remote launch. More...
 
static std::string BuildTemporaryFileName ()
 generate a file name in /tmp directory More...
 
static std::string getCommandToRunRemoteProcess (AccessProtocolType protocol, const std::string &hostname, const std::string &username)
 

Protected Attributes

CORBA::ORB_var _orb
 
PortableServer::POA_var _poa
 
SALOME_ResourcesManager_Client_resManager
 
SALOME_NamingService_NS
 
bool _isAppliSalomeDefined
 different behaviour if $APPLI exists (SALOME Application) More...
 
int _nbprocUsed
 attribute that contains the number of processes used in batch mode by MPI containers More...
 
Utils_Mutex _giveContainerMutex1
 attributes to allow concurrency for // GiveContainer More...
 
pid_t _pid_mpiServer
 

Static Protected Attributes

static omni_mutex _numInstanceMutex
 

Static Private Attributes

static const int TIME_OUT_TO_LAUNCH_CONT =60
 
static Utils_Mutex _getenvMutex
 
static Utils_Mutex _systemMutex
 

Member Typedef Documentation

typedef std::vector<std::string> SALOME_ContainerManager::actual_launch_machine_t
protected

Constructor & Destructor Documentation

SALOME_ContainerManager::SALOME_ContainerManager ( CORBA::ORB_ptr  orb,
PortableServer::POA_var  poa,
SALOME_NamingService ns 
)

Constructor.

Parameters
orbDefine a CORBA single thread policy for the server, which avoid to deal with non thread-safe usage like Change_Directory in SALOME naming service

References _ContainerManagerNameInNS, _isAppliSalomeDefined, _NS, _orb, _pid_mpiServer, _poa, _resManager, GetenvThreadSafe(), GetenvThreadSafeAsString(), getpidofprogram(), MESSAGE, SALOME_NamingService::Register(), and SystemThreadSafe().

SALOME_ContainerManager::~SALOME_ContainerManager ( )

Member Function Documentation

void SALOME_ContainerManager::AddOmninamesParams ( std::string &  command) const
protected
void SALOME_ContainerManager::AddOmninamesParams ( std::ostream &  fileStream) const
protected

add to command all options relative to naming service.

References _NS, and AddOmninamesParams().

void SALOME_ContainerManager::AddOmninamesParams ( std::ostream &  fileStream,
SALOME_NamingService ns 
)
static

add to command all options relative to naming service.

References SALOME_NamingService::getIORaddr().

std::string SALOME_ContainerManager::BuildCommandToLaunchLocalContainer ( const Engines::ContainerParameters params,
const std::string &  machinesFile,
const std::string &  container_exe,
std::string &  tmpFileName 
) const
protected
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 
)
protected
std::string SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer ( const Engines::ContainerParameters params,
std::string  machine_file_name,
std::string &  proxy_hostname 
)
protected
std::string SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer ( const std::string &  resource_name,
const Engines::ContainerParameters params,
const std::string &  container_exe = "SALOME_Container" 
) const
protected

Builds the script to be launched.

If SALOME Application not defined ($APPLI), see BuildTempFileToLaunchRemoteContainer()

Else rely on distant configuration. Command is under the form (example): ssh user distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir \ SALOME_Container containerName &"

  • where user is ommited if not specified in CatalogResources,
  • where distant path is always relative to user $HOME, and equal to $APPLI if not specified in CatalogResources,
  • where hostNS is the hostname of CORBA naming server (set by scripts to use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
  • where portNS is the port used by CORBA naming server (set by scripts to use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
  • where workingdir is the requested working directory for the container. If WORKINGDIR (and workingdir) is not present the working dir will be $HOME

References _isAppliSalomeDefined, _NS, _resManager, AddOmninamesParams(), ASSERT, BuildTempFileToLaunchRemoteContainer(), SALOME_NamingService::ContainerName(), getCommandToRunRemoteProcess(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), SALOME_ResourcesManager_Client::GetResourceDefinition(), Engines::ContainerParameters::isMPI, MESSAGE, Engines::ContainerParameters::nb_proc, and Engines::ContainerParameters::workingdir.

Referenced by LaunchContainer().

std::string SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer ( const std::string &  resource_name,
const Engines::ContainerParameters params,
std::string &  tmpFileName 
) const
protected
std::string SALOME_ContainerManager::BuildTemporaryFileName ( )
staticprotected
Engines::Container_ptr SALOME_ContainerManager::FindContainer ( const Engines::ContainerParameters params,
const Engines::ResourceList possibleResources 
)
protected

Find a container given constraints (params) on a list of machines (possibleComputers) agy : this method is ThreadSafe.

References MESSAGE.

Referenced by GiveContainer().

Engines::Container_ptr SALOME_ContainerManager::FindContainer ( const Engines::ContainerParameters params,
const std::string &  resource 
)
protected

Find a container given constraints (params) on a machine (theMachine) agy : this method is ThreadSafe.

References _NS, _resManager, SALOME_NamingService::BuildContainerNameForNS(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, MESSAGE, and SALOME_NamingService::Resolve().

std::string SALOME_ContainerManager::getCommandToRunRemoteProcess ( AccessProtocolType  protocol,
const std::string &  hostname,
const std::string &  username 
)
staticprotected
std::string SALOME_ContainerManager::GetMPIZeroNode ( const std::string  machine,
const std::string  machinesFile 
) const
protected
std::set< pid_t > SALOME_ContainerManager::getpidofprogram ( const std::string  program)
protected
int SALOME_ContainerManager::GetTimeOutToLoaunchServer ( )
static
bool SALOME_ContainerManager::LaunchPaCONodeContainer ( const std::string &  command,
const Engines::ContainerParameters params,
const std::string &  name,
SALOME_ContainerManager::actual_launch_machine_t vect_machine 
)
protected
CORBA::Object_ptr SALOME_ContainerManager::LaunchPaCOProxyContainer ( const std::string &  command,
const Engines::ContainerParameters params,
const std::string &  hostname 
)
protected
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 
)
protected
std::string SALOME_ContainerManager::machinesFile ( const int  nbproc)
protected
void SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync ( std::string &  command)
static

Referenced by CreateDataScope(), and LaunchContainer().

void SALOME_ContainerManager::RmTmpFile ( std::string &  tmpFileName)
staticprotected

removes the generated temporary file in case of a remote launch.

This method is thread safe

References Kernel_Utils::GetDirByPath(), Kernel_Utils::IsEmptyDir(), and SystemThreadSafe().

Referenced by GetMPIZeroNode(), and LaunchContainer().

void SALOME_ContainerManager::Shutdown ( )

shutdown all the containers, then the ContainerManager servant

CORBA method:

References _ContainerManagerNameInNS, _NS, _poa, SALOME_NamingService::Destroy_Name(), MESSAGE, and ShutdownContainers().

Referenced by SALOME_Launcher::Shutdown().

void SALOME_ContainerManager::ShutdownContainers ( )

Loop on all the containers listed in naming service, ask shutdown on each.

CORBA Method:

References _NS, SALOME_NamingService::Change_Directory(), INFOS, SALOME_NamingService::list_directory_recurs(), MESSAGE, SALOME_NamingService::Resolve(), and SCRUTE.

Referenced by Shutdown().

void SALOME_ContainerManager::SleepInSecond ( int  ellapseTimeInSecond)
static

Referenced by CreateDataScope(), and LaunchContainer().

Engines::Container_ptr SALOME_ContainerManager::StartPaCOPPContainer ( const Engines::ContainerParameters params,
std::string  resource_selected 
)
protected

References INFOS.

Referenced by LaunchContainer().

Field Documentation

const char * SALOME_ContainerManager::_ContainerManagerNameInNS
static
Initial value:
=
"/ContainerManager"

Referenced by main(), SALOME_ContainerManager(), SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(), and Shutdown().

Utils_Mutex SALOME_ContainerManager::_getenvMutex
staticprivate

Referenced by GetenvThreadSafe().

Utils_Mutex SALOME_ContainerManager::_giveContainerMutex1
protected

attributes to allow concurrency for // GiveContainer

Referenced by GiveContainer(), and LaunchContainer().

bool SALOME_ContainerManager::_isAppliSalomeDefined
protected

different behaviour if $APPLI exists (SALOME Application)

Referenced by BuildCommandToLaunchRemoteContainer(), GetMPIZeroNode(), LaunchContainer(), and SALOME_ContainerManager().

int SALOME_ContainerManager::_nbprocUsed
protected

attribute that contains the number of processes used in batch mode by MPI containers

Referenced by machinesFile().

omni_mutex SALOME_ContainerManager::_numInstanceMutex
staticprotected

Referenced by machinesFile().

CORBA::ORB_var SALOME_ContainerManager::_orb
protected

Referenced by SALOME_ContainerManager().

pid_t SALOME_ContainerManager::_pid_mpiServer
protected
PortableServer::POA_var SALOME_ContainerManager::_poa
protected
Utils_Mutex SALOME_ContainerManager::_systemMutex
staticprivate

Referenced by SystemThreadSafe().

const int SALOME_ContainerManager::TIME_OUT_TO_LAUNCH_CONT =60
staticprivate