#include <SALOME_ContainerManager.hxx>
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 ¶ms) |
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 char * | GetenvThreadSafe (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 ¶ms, 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 ¶ms, 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 ¶ms, const std::string &container_exe="SALOME_Container") const |
Builds the script to be launched. More... | |
std::string | BuildCommandToLaunchLocalContainer (const Engines::ContainerParameters ¶ms, 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 ¶ms, 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 ¶ms, const std::string &resource_selected, const std::string &hostname, const std::string &machFile, const std::string &containerNameInNS) |
bool | checkPaCOParameters (Engines::ContainerParameters ¶ms, std::string resource_selected) |
Engines::Container_ptr | StartPaCOPPContainer (const Engines::ContainerParameters ¶ms, std::string resource_selected) |
std::string | BuildCommandToLaunchPaCOProxyContainer (const Engines::ContainerParameters ¶ms, std::string machine_file_name, std::string &proxy_hostname) |
std::string | BuildCommandToLaunchPaCONodeContainer (const Engines::ContainerParameters ¶ms, 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 ¶ms, const std::string &hostname) |
bool | LaunchPaCONodeContainer (const std::string &command, const Engines::ContainerParameters ¶ms, 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 |
|
protected |
SALOME_ContainerManager::SALOME_ContainerManager | ( | CORBA::ORB_ptr | orb, |
PortableServer::POA_var | poa, | ||
SALOME_NamingService * | ns | ||
) |
Constructor.
orb | Define 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 | ( | ) |
destructor
References _pid_mpiServer, _resManager, GetenvThreadSafe(), MESSAGE, and SystemThreadSafe().
|
protected |
add to command all options relative to naming service.
Referenced by AddOmninamesParams(), BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), BuildTempFileToLaunchRemoteContainer(), and CreateDataScope().
|
protected |
add to command all options relative to naming service.
References _NS, and AddOmninamesParams().
|
static |
add to command all options relative to naming service.
References SALOME_NamingService::getIORaddr().
|
protected |
builds the command to be launched.
References _NS, AddOmninamesParams(), BuildTemporaryFileName(), Engines::ContainerParameters::container_name, SALOME_NamingService::ContainerName(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), Kernel_Utils::GetTmpDir(), Engines::ContainerParameters::isMPI, isPythonContainer(), MESSAGE, Engines::ContainerParameters::nb_proc, and Engines::ContainerParameters::workingdir.
Referenced by LaunchContainer().
|
protected |
|
protected |
|
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 &"
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().
|
protected |
Builds in a temporary file the script to be launched.
Used if SALOME Application ($APPLI) is not defined. The command is build with data from CatalogResources, in which every path used on remote computer must be defined.
References _NS, _resManager, AddOmninamesParams(), BuildTemporaryFileName(), Engines::ContainerParameters::container_name, SALOME_NamingService::ContainerName(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), SALOME_ResourcesManager_Client::GetResourceDefinition(), Engines::ContainerParameters::isMPI, isPythonContainer(), Engines::ContainerParameters::nb_proc, out, rsh, SCRUTE, srun, ssh, and SystemThreadSafe().
Referenced by BuildCommandToLaunchRemoteContainer().
|
staticprotected |
generate a file name in /tmp directory
References Kernel_Utils::GetTmpFileName().
Referenced by BuildCommandToLaunchLocalContainer(), BuildTempFileToLaunchRemoteContainer(), and GetMPIZeroNode().
|
protected |
References _resManager, ParserResourcesType::AppliPath, Engines::ContainerParameters::container_name, ParserResourcesType::getAccessProtocolTypeStr(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, INFOS, ParserResourcesType::Name, Engines::ContainerParameters::nb_proc, Engines::ContainerParameters::parallelLib, and ParserResourcesType::UserName.
|
protected |
Find a container given constraints (params) on a list of machines (possibleComputers) agy : this method is ThreadSafe.
References MESSAGE.
Referenced by GiveContainer().
|
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().
|
staticprotected |
References blaunch, pbsdsh, rsh, srun, and ssh.
Referenced by BuildCommandToLaunchRemoteContainer(), and LaunchContainer().
References _getenvMutex, and SALOMEDS::lock().
Referenced by BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), BuildTempFileToLaunchRemoteContainer(), GetenvThreadSafeAsString(), GetMPIZeroNode(), GetTimeOutToLoaunchServer(), GiveContainer(), LaunchContainer(), SALOME_ContainerManager(), and ~SALOME_ContainerManager().
|
static |
|
protected |
References _isAppliSalomeDefined, _resManager, ASSERT, BuildTemporaryFileName(), GetenvThreadSafe(), GetenvThreadSafeAsString(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, RmTmpFile(), rsh, sh, srun, ssh, and SystemThreadSafe().
Referenced by GiveContainer().
|
protected |
References Kernel_Utils::GetTmpFileName(), and SystemThreadSafe().
Referenced by SALOME_ContainerManager().
|
static |
References GetenvThreadSafe(), GetenvThreadSafeAsString(), INFOS, and TIME_OUT_TO_LAUNCH_CONT.
Referenced by CreateDataScope(), and LaunchContainer().
Engines::Container_ptr SALOME_ContainerManager::GiveContainer | ( | const Engines::ContainerParameters & | params | ) |
Give a suitable Container given constraints.
CORBA Method:
params | Container Parameters required for the container |
References _giveContainerMutex1, _NS, _resManager, SALOME_NamingService::BuildContainerNameForNS(), resourceParams::can_run_containers, Engines::ContainerParameters::container_name, SALOME_ResourcesManager_Client::Find(), FindContainer(), GetenvThreadSafe(), SALOME_ResourcesManager_Client::GetFittingResources(), GetMPIZeroNode(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, INFOS, Engines::ContainerParameters::isMPI, LaunchContainer(), SALOMEDS::lock(), machinesFile(), MESSAGE, Engines::ContainerParameters::mode, Engines::ContainerParameters::nb_proc, Engines::ResourceParameters::policy, Engines::ResourceParameters::resList, SALOME_NamingService::Resolve(), Engines::ContainerParameters::resource_params, resourceParameters_CORBAtoCPP(), and SALOME_Exception::what().
|
protected |
References _giveContainerMutex1, _isAppliSalomeDefined, _NS, _resManager, ASSERT, BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), SALOME_ModuleCatalog::CEXE, Engines::ResourceParameters::componentList, SALOME_NamingService::ContainerName(), getCommandToRunRemoteProcess(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), SALOME_ResourcesManager_Client::GetResourceDefinition(), GetTimeOutToLoaunchServer(), INFOS, Engines::ContainerParameters::isMPI, SALOMEDS::lock(), MakeTheCommandToBeLaunchedASync(), MESSAGE, Engines::ContainerParameters::parallelLib, SALOME_NamingService::Resolve(), Engines::ContainerParameters::resource_params, RmTmpFile(), SleepInSecond(), StartPaCOPPContainer(), and SystemThreadSafe().
Referenced by GiveContainer().
|
protected |
|
protected |
|
protected |
|
protected |
References _nbprocUsed, _numInstanceMutex, GetenvThreadSafeAsString(), Kernel_Utils::GetTmpFileName(), and out.
Referenced by GiveContainer().
|
static |
Referenced by CreateDataScope(), and LaunchContainer().
|
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().
|
static |
Referenced by CreateDataScope(), and LaunchContainer().
|
protected |
References INFOS.
Referenced by LaunchContainer().
|
static |
References _systemMutex, and SALOMEDS::lock().
Referenced by BuildTempFileToLaunchRemoteContainer(), CreateDataScope(), GetMPIZeroNode(), getpidofprogram(), LaunchContainer(), RmTmpFile(), SALOME_ContainerManager(), and ~SALOME_ContainerManager().
|
static |
Referenced by main(), SALOME_ContainerManager(), SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(), and Shutdown().
|
staticprivate |
Referenced by GetenvThreadSafe().
|
protected |
attributes to allow concurrency for // GiveContainer
Referenced by GiveContainer(), and LaunchContainer().
|
protected |
different behaviour if $APPLI exists (SALOME Application)
Referenced by BuildCommandToLaunchRemoteContainer(), GetMPIZeroNode(), LaunchContainer(), and SALOME_ContainerManager().
|
protected |
attribute that contains the number of processes used in batch mode by MPI containers
Referenced by machinesFile().
|
protected |
|
staticprotected |
Referenced by machinesFile().
|
protected |
Referenced by SALOME_ContainerManager().
|
protected |
Referenced by SALOME_ContainerManager(), and ~SALOME_ContainerManager().
|
protected |
Referenced by SALOME_ContainerManager(), and Shutdown().
|
protected |
|
staticprivate |
Referenced by SystemThreadSafe().
|
staticprivate |
Referenced by GetTimeOutToLoaunchServer().