#include <SALOME_ContainerManager.hxx>
Public Member Functions | |
SALOME_ContainerManager (CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns) | |
Constructor. More... | |
~SALOME_ContainerManager () | |
destructor More... | |
Engines::Container_ptr | GiveContainer (const Engines::ContainerParameters ¶ms) override |
Give a suitable Container given constraints. More... | |
void | ShutdownContainers () override |
Loop on all the containers listed in naming service, ask shutdown on each. More... | |
void | SetOverrideEnvForContainers (const Engines::KeyValDict &env) override |
Engines::KeyValDict * | GetOverrideEnvForContainers () override |
void | SetCodeOnContainerStartUp (const char *code) override |
void | Shutdown () |
shutdown all the containers, then the ContainerManager servant More... | |
void | DeclareUsingSalomeSession () |
CORBA::Long | GetTimeOutToLaunchServerInSecond () override |
void | SetTimeOutToLaunchServerInSecond (CORBA::Long timeInSecond) override |
CORBA::Long | GetDeltaTimeBetweenNSLookupAtLaunchTimeInMilliSecond () override |
void | SetDeltaTimeBetweenNSLookupAtLaunchTimeInMilliSecond (CORBA::Long timeInMS) override |
Static Public Member Functions | |
static char * | GetenvThreadSafe (const char *name) |
static std::string | GetenvThreadSafeAsString (const char *name) |
static int | SystemThreadSafe (const char *command) |
static long | SystemWithPIDThreadSafe (const std::vector< std::string > &command) |
static void | AddOmninamesParams (std::ostream &fileStream, SALOME_NamingService_Abstract *ns) |
add to command all options relative to naming service. More... | |
static void | MakeTheCommandToBeLaunchedASync (std::string &command) |
static int | GetTimeOutToLoaunchServer () |
Return in second the time out to give chance to server to be launched and to register into NS. More... | |
static void | SleepInSecond (int ellapseTimeInSecond) |
Static Public Attributes | |
static const char * | _ContainerManagerNameInNS = "/ContainerManager" |
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 | GetCppBinaryOfKernelContainer () const |
std::string | GetRunRemoteExecutableScript () const |
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::string | getCommandToRunRemoteProcessCommon (const std::string &templateName, const std::string &remoteScript, AccessProtocolType protocol, const std::string &hostname, const std::string &username, const std::string &applipath, const std::string &workdir) const |
std::string | getCommandToRunRemoteProcess (AccessProtocolType protocol, const std::string &hostname, const std::string &username, const std::string &applipath, const std::string &workdir="") const |
std::string | getCommandToRunRemoteProcessNoAppli (AccessProtocolType protocol, const std::string &hostname, const std::string &username, const std::string &applipath, const std::string &workdir="") const |
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... | |
Protected Attributes | |
CORBA::ORB_var | _orb |
PortableServer::POA_var | _poa |
SALOME_ResourcesManager_Client * | _resManager |
SALOME_NamingService_Abstract * | _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... | |
bool | _isSSL = true |
attribute that specifies the launch mode. More... | |
Utils_Mutex | _giveContainerMutex1 |
attributes to allow concurrency for // GiveContainer More... | |
pid_t | _pid_mpiServer |
Static Protected Attributes | |
static omni_mutex | _numInstanceMutex |
Private Attributes | |
std::vector< std::pair< std::string, std::string > > | _override_env |
int | _time_out_in_second |
int | _delta_time_ns_lookup_in_ms |
std::string | _code_to_exe_on_startup |
Static Private Attributes | |
static const int | TIME_OUT_TO_LAUNCH_CONT =60 |
static const int | DFT_DELTA_TIME_NS_LOOKUP_IN_MS =1000 |
static Utils_Mutex | _getenvMutex |
static Utils_Mutex | _systemMutex |
|
protected |
SALOME_ContainerManager::SALOME_ContainerManager | ( | CORBA::ORB_ptr | orb, |
PortableServer::POA_var | poa, | ||
SALOME_NamingService_Abstract * | 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, _time_out_in_second, GetenvThreadSafe(), GetenvThreadSafeAsString(), GetTimeOutToLoaunchServer(), MESSAGE, KERNEL_PY.batchmode_salome::obj, salome::orb, SALOME_ContainerPy::poa, and SALOME_NamingService_Container_Abstract::Register().
SALOME_ContainerManager::~SALOME_ContainerManager | ( | ) |
destructor
References _pid_mpiServer, _resManager, GetenvThreadSafe(), MESSAGE, salomeContext::status, and SystemThreadSafe().
|
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 |
add to command all options relative to naming service.
References TestKernelHelpers::command.
Referenced by AddOmninamesParams(), BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), BuildTempFileToLaunchRemoteContainer(), and CreateDataScope().
|
protected |
builds the command to be launched.
References _isSSL, _NS, _orb, AddOmninamesParams(), BuildTemporaryFileName(), TestKernelHelpers::command, TestComponentPy::container, Engines::ContainerParameters::container_name, SALOME_NamingService_Abstract::ContainerName(), GetCommandFromTemplate(), GetEmbeddedNamingService(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), Kernel_Utils::GetTmpDir(), Engines::ContainerParameters::isMPI, isPythonContainer(), machinesFile(), 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@machine distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir \ SALOME_Container containerName &"
References _isAppliSalomeDefined, _isSSL, _NS, _orb, _resManager, AddOmninamesParams(), ParserResourcesType::AppliPath, TestKernelHelpers::command, SALOME_NamingService_Abstract::ContainerName(), getCommandToRunRemoteProcess(), getCommandToRunRemoteProcessNoAppli(), GetEmbeddedNamingService(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, Engines::ContainerParameters::isMPI, MESSAGE, Engines::ContainerParameters::nb_proc, ParserResourcesType::Protocol, ParserResourcesType::UserName, 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(), TestKernelHelpers::command, Engines::ContainerParameters::container_name, SALOME_NamingService_Abstract::ContainerName(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, Engines::ContainerParameters::isMPI, isPythonContainer(), Engines::ContainerParameters::nb_proc, out, ParserResourcesType::Protocol, rsh, SCRUTE, srun, ssh, salomeContext::status, and SystemThreadSafe().
|
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.
void SALOME_ContainerManager::DeclareUsingSalomeSession | ( | ) |
Referenced by SALOME_Launcher::DeclareUsingSalomeSession().
|
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_Abstract::BuildContainerNameForNS(), SALOME_ResourcesManager_Client::GetResourceDefinition(), test::hostname, ParserResourcesType::HostName, MESSAGE, KERNEL_PY.batchmode_salome::obj, and SALOME_NamingService_Container_Abstract::Resolve().
|
protected |
References getCommandToRunRemoteProcessCommon(), GetRunRemoteExecutableScript(), and test::hostname.
Referenced by BuildCommandToLaunchRemoteContainer(), GetMPIZeroNode(), and LaunchContainer().
|
protected |
References _isSSL, _orb, ASSERT, blaunch, TestKernelHelpers::command, GetCommandFromTemplate(), GetEmbeddedNamingService(), GetenvThreadSafe(), GetenvThreadSafeAsString(), test::hostname, pbsdsh, rsh, srun, and ssh.
Referenced by getCommandToRunRemoteProcess(), and getCommandToRunRemoteProcessNoAppli().
|
protected |
References getCommandToRunRemoteProcessCommon(), and test::hostname.
Referenced by BuildCommandToLaunchRemoteContainer().
|
protected |
References _isSSL, and TestKernelHelpers::ret.
Referenced by LaunchContainer().
|
override |
References _delta_time_ns_lookup_in_ms.
|
static |
References _getenvMutex, SALOMEDS::lock(), and pythfilter::name.
Referenced by BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), BuildTempFileToLaunchRemoteContainer(), getCommandToRunRemoteProcessCommon(), GetenvThreadSafeAsString(), GetMPIZeroNode(), GetTimeOutToLoaunchServer(), GiveContainer(), LaunchContainer(), SALOME_ContainerManager(), and ~SALOME_ContainerManager().
|
static |
References GetenvThreadSafe(), and pythfilter::name.
Referenced by BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), BuildTempFileToLaunchRemoteContainer(), getCommandToRunRemoteProcessCommon(), getScriptTemplateFilePath(), GetTimeOutToLoaunchServer(), LaunchContainer(), machinesFile(), and SALOME_ContainerManager().
|
protected |
References _isAppliSalomeDefined, _resManager, ParserResourcesType::AppliPath, BuildTemporaryFileName(), TestKernelHelpers::command, getCommandToRunRemoteProcess(), GetenvThreadSafe(), SALOME_ResourcesManager_Client::GetResourceDefinition(), ParserResourcesType::HostName, machinesFile(), ParserResourcesType::Protocol, RmTmpFile(), sh, salomeContext::status, SystemThreadSafe(), and ParserResourcesType::UserName.
Referenced by GiveContainer().
|
override |
References _override_env, first, and TestKernelHelpers::ret.
|
protected |
References _isSSL, and TestKernelHelpers::ret.
Referenced by getCommandToRunRemoteProcess().
|
override |
References _time_out_in_second.
|
static |
Return in second the time out to give chance to server to be launched and to register into NS.
References GetenvThreadSafe(), GetenvThreadSafeAsString(), INFOS, and TIME_OUT_TO_LAUNCH_CONT.
Referenced by CreateDataScope(), and SALOME_ContainerManager().
|
override |
Give a suitable Container given constraints.
CORBA Method:
params | Container Parameters required for the container |
< TODO: unused variable
References _code_to_exe_on_startup, _giveContainerMutex1, _NS, _override_env, _resManager, SALOME_NamingService_Abstract::BuildContainerNameForNS(), resourceParams::can_run_containers, Engines::ContainerParameters::container_name, SALOME_ResourcesManager_Client::Find(), FindContainer(), first, GetenvThreadSafe(), SALOME_ResourcesManager_Client::GetFittingResources(), GetMPIZeroNode(), SALOME_ResourcesManager_Client::GetResourceDefinition(), test::hostname, ParserResourcesType::HostName, INFOS, Engines::ContainerParameters::isMPI, LaunchContainer(), SALOMEDS::lock(), machinesFile(), MESSAGE, Engines::ContainerParameters::mode, Engines::ContainerParameters::nb_proc, KERNEL_PY.batchmode_salome::obj, Engines::ResourceParameters::policy, Engines::ResourceParameters::resList, SALOME_NamingService_Container_Abstract::Resolve(), Engines::ContainerParameters::resource_params, resourceParameters_CORBAtoCPP(), TestKernelHelpers::ret, and SALOME_Exception::what().
|
protected |
References _delta_time_ns_lookup_in_ms, _giveContainerMutex1, _isAppliSalomeDefined, _NS, _resManager, _time_out_in_second, ParserResourcesType::AppliPath, BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), SALOME_ModuleCatalog::CEXE, TestKernelHelpers::command, Engines::ResourceParameters::componentList, SALOME_NamingService_Abstract::ContainerName(), getCommandToRunRemoteProcess(), GetCppBinaryOfKernelContainer(), GetenvThreadSafe(), GetenvThreadSafeAsString(), Kernel_Utils::GetHostname(), SALOME_ResourcesManager_Client::GetResourceDefinition(), test::hostname, ParserResourcesType::HostName, INFOS, Engines::ContainerParameters::isMPI, SALOMEDS::lock(), MakeTheCommandToBeLaunchedASync(), MESSAGE, KERNEL_PY.batchmode_salome::obj, Engines::ContainerParameters::parallelLib, ParserResourcesType::Protocol, SALOME_NamingService_Container_Abstract::Resolve(), Engines::ContainerParameters::resource_params, TestKernelHelpers::ret, RmTmpFile(), StartPaCOPPContainer(), salomeContext::status, SystemThreadSafe(), TestSalomeSDS1::tmp, and ParserResourcesType::UserName.
Referenced by GiveContainer().
|
protected |
|
protected |
References TestKernelHelpers::ret.
|
protected |
|
protected |
References _nbprocUsed, _numInstanceMutex, GetenvThreadSafeAsString(), Kernel_Utils::GetTmpFileName(), out, and TestSalomeSDS1::tmp.
Referenced by BuildCommandToLaunchLocalContainer(), GetMPIZeroNode(), and GiveContainer().
|
static |
References TestKernelHelpers::command.
Referenced by CreateDataScope(), and LaunchContainer().
|
staticprotected |
removes the generated temporary file in case of a remote launch.
This method is thread safe
References TestKernelHelpers::command, Kernel_Utils::GetDirByPath(), Kernel_Utils::IsEmptyDir(), and SystemThreadSafe().
Referenced by GetMPIZeroNode(), and LaunchContainer().
|
override |
References _code_to_exe_on_startup.
|
override |
References _delta_time_ns_lookup_in_ms.
|
override |
References _override_env.
|
override |
References _time_out_in_second.
void SALOME_ContainerManager::Shutdown | ( | ) |
shutdown all the containers, then the ContainerManager servant
CORBA method:
References _ContainerManagerNameInNS, _NS, _poa, SALOME_NamingService_Container_Abstract::Destroy_Name(), MESSAGE, and ShutdownContainers().
Referenced by SALOME_Launcher::Shutdown().
|
override |
Loop on all the containers listed in naming service, ask shutdown on each.
CORBA Method:
References _NS, SALOME_NamingService_Abstract::Change_Directory(), INFOS, SALOME_NamingService_Abstract::list_directory_recurs(), MESSAGE, KERNEL_PY.batchmode_salome::obj, SALOME_NamingService_Container_Abstract::Resolve(), SCRUTE, and runSalomeOld::session.
Referenced by Shutdown().
|
static |
Referenced by CreateDataScope().
|
protected |
References INFOS, and TestKernelHelpers::ret.
Referenced by LaunchContainer().
|
static |
References _systemMutex, TestKernelHelpers::command, and SALOMEDS::lock().
Referenced by BuildTempFileToLaunchRemoteContainer(), CreateDataScope(), GetMPIZeroNode(), LaunchContainer(), RmTmpFile(), and ~SALOME_ContainerManager().
|
static |
References _systemMutex, pythfilter::args, TestKernelHelpers::command, and SALOMEDS::lock().
Referenced by SALOME_ExternalServerLauncher::launchServer().
|
private |
Referenced by GiveContainer(), and SetCodeOnContainerStartUp().
|
static |
|
private |
|
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 specifies the launch mode.
Referenced by BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), getCommandToRunRemoteProcessCommon(), GetCppBinaryOfKernelContainer(), and GetRunRemoteExecutableScript().
|
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_Container.SALOME_Container_i::__init__(), SALOME_ContainerPy.SALOME_ContainerPy_Gen_i::__init__(), SALOME_ContainerPy.SALOME_ContainerPy_i::__init__(), SALOME_ComponentPy.SALOME_ComponentPy_Gen_i::__init__(), SALOME_NamingServicePy.SALOME_NamingServicePy_i::__init__(), BuildCommandToLaunchLocalContainer(), BuildCommandToLaunchRemoteContainer(), SALOME_ContainerPy.SALOME_ContainerPy_Gen_i::create_component_instance(), SALOME_Container.SALOME_Container_i::create_component_instance(), SALOME_Container.SALOME_Container_i::create_pynode(), SALOME_Container.SALOME_Container_i::create_pyscriptnode(), getCommandToRunRemoteProcessCommon(), SALOME_Embedded_NamingService_ClientPy.SALOME_Embedded_NamingService_ClientPy::Register(), SALOME_Embedded_NamingService_ClientPy.SALOME_Embedded_NamingService_ClientPy::Resolve(), SALOME_ContainerManager(), and SALOME_ContainerPy.SALOME_ContainerPy_Gen_i::Shutdown().
|
private |
Referenced by GetOverrideEnvForContainers(), GiveContainer(), and SetOverrideEnvForContainers().
|
protected |
Referenced by SALOME_ContainerManager(), and ~SALOME_ContainerManager().
|
protected |
Referenced by SALOME_Container.SALOME_Container_i::__init__(), SALOME_ContainerPy.SALOME_ContainerPy_Gen_i::__init__(), SALOME_ComponentPy.SALOME_ComponentPy_Gen_i::__init__(), SALOME_ContainerPy.SALOME_ContainerPy_Gen_i::create_component_instance(), SALOME_Container.SALOME_Container_i::create_component_instance(), SALOME_Container.SALOME_Container_i::create_pynode(), SALOME_Container.SALOME_Container_i::create_pyscriptnode(), SALOME_ComponentPy.SALOME_ComponentPy_Gen_i::destroy(), SALOME_ContainerManager(), and Shutdown().
|
protected |
|
staticprivate |
Referenced by SystemThreadSafe(), and SystemWithPIDThreadSafe().
|
private |
|
staticprivate |
|
staticprivate |
Referenced by GetTimeOutToLoaunchServer().