#include <MPIContainer_i.hxx>
Public Member Functions | |
Engines_MPIContainer_i (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, char *containerName, int argc, char *argv[]) | |
Engines_MPIContainer_i () | |
~Engines_MPIContainer_i () | |
void | Shutdown () |
Shutdown the container. More... | |
bool | load_component_Library (const char *componentName, CORBA::String_out reason) |
load a component implementation More... | |
virtual Engines::EngineComponent_ptr | create_component_instance_env (const char *componentName, CORBA::Long studyId, const Engines::FieldsDict &env, CORBA::String_out reason) |
Create a new component instance with environment variables specified. More... | |
Engines::EngineComponent_ptr | load_impl (const char *nameToRegister, const char *componentName) |
void | remove_impl (Engines::EngineComponent_ptr component_i) |
void | finalize_removal () |
virtual Engines::EngineComponent_ptr | create_component_instance (const char *componentName, CORBA::Long studyId) |
Create a new component instance. More... | |
virtual char * | create_python_service_instance (const char *CompName, CORBA::String_out reason) |
Engines::EngineComponent_ptr | find_component_instance (const char *registeredName, CORBA::Long studyId) |
Find an existing (in the container) component instance. More... | |
virtual void | ping () |
Ping the servant to check it is still alive. More... | |
char * | name () |
Get container name. More... | |
char * | workingdir () |
Get container working directory. More... | |
char * | logfilename () |
Get container log file name. More... | |
void | logfilename (const char *name) |
Set container log file name. More... | |
char * | getHostName () |
Get container host name. More... | |
CORBA::Long | getPID () |
Get container PID. More... | |
bool | Kill_impl () |
Kill current container. More... | |
Engines::fileRef_ptr | createFileRef (const char *origFileName) |
Get or create a file reference object associated to a local file (to transfer it) More... | |
Engines::fileTransfer_ptr | getFileTransfer () |
Get a fileTransfer reference. More... | |
virtual Engines::Salome_file_ptr | createSalome_file (const char *origFileName) |
Create a Salome file. More... | |
void | copyFile (Engines::Container_ptr container, const char *remoteFile, const char *localFile) |
copy a file from a remote host (container) to the local host More... | |
Engines::PyNode_ptr | createPyNode (const char *nodeName, const char *code) |
create a PyNode object to execute remote python code More... | |
Engines::PyNode_ptr | getDefaultPyNode (const char *nodeName) |
Retrieves the last created PyNode instance with createPyNode. More... | |
Engines::PyScriptNode_ptr | createPyScriptNode (const char *nodeName, const char *code) |
create a PyScriptNode object to execute remote python code More... | |
Engines::PyScriptNode_ptr | getDefaultPyScriptNode (const char *nodeName) |
Retrieves the last created PyScriptNode instance with createPyScriptNode. More... | |
Engines::EngineComponent_ptr | find_or_create_instance (std::string genericRegisterName, std::string componentLibraryName) |
Finds an already existing component instance or create a new instance. More... | |
bool | load_component_CppImplementation (const char *componentName, std::string &reason) |
try to load a C++ component implementation More... | |
bool | load_component_PythonImplementation (const char *componentName, std::string &reason) |
try to load a Python component implementation More... | |
bool | load_component_ExecutableImplementation (const char *componentName, std::string &reason) |
try to load a Executable component implementation More... | |
Engines::EngineComponent_ptr | createPythonInstance (std::string CompName, int studyId, std::string &error) |
Create a new component instance (Python implementation) More... | |
Engines::EngineComponent_ptr | createExecutableInstance (std::string CompName, int studyId, const Engines::FieldsDict &env, std::string &error) |
Create a new component instance (Executable implementation) More... | |
Engines::EngineComponent_ptr | createInstance (std::string genericRegisterName, void *handle, int studyId, std::string &error) |
Create a new component instance (C++ implementation) More... | |
int | getArgc () |
char ** | getArgv () |
void | registerTemporaryFile (const std::string &fileName) |
void | unregisterTemporaryFile (const std::string &fileName) |
void | clearTemporaryFiles () |
Engines::IORTab * | tior () |
void | tior (const Engines::IORTab &ior) |
Static Public Member Functions | |
static bool | isPythonContainer (const char *ContainerName) |
Indicate if container is a python one. More... | |
static void | decInstanceCnt (std::string genericRegisterName) |
Decrement component instance reference count. More... | |
Protected Member Functions | |
void | BCastIOR (CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, bool amiCont) |
Protected Attributes | |
bool | _isSupervContainer |
SALOME_NamingService * | _NS |
std::string | _library_path |
std::string | _containerName |
std::string | _logfilename |
CORBA::ORB_var | _orb |
PortableServer::POA_var | _poa |
PortableServer::ObjectId * | _id |
int | _numInstance |
std::map< std::string, Engines::EngineComponent_var > | _listInstances_map |
std::map< std::string, Engines::fileRef_var > | _fileRef_map |
std::map< std::string, Engines::Salome_file_var > | _Salome_file_map |
std::map< std::string, Engines::PyScriptNode_var > | _dftPyScriptNode |
std::map< std::string, Engines::PyNode_var > | _dftPyNode |
Utils_Mutex | _mutexForDftPy |
std::list< std::string > | _tmp_files |
Engines::fileTransfer_var | _fileTransfer |
int | _argc |
char ** | _argv |
long | _pid |
bool | _isServantAloneInProcess |
int | _numproc |
int | _nbproc |
Engines::IORTab * | _tior |
std::map< std::string, MPI_Comm > | _gcom |
Static Protected Attributes | |
static std::map< std::string, int > | _cntInstances_map |
static std::map< std::string, void * > | _library_map |
static std::map< std::string, void * > | _toRemove_map |
static omni_mutex | _numInstanceMutex |
Private Member Functions | |
bool | Lload_component_Library (const char *componentName) |
Engines::EngineComponent_ptr | Lcreate_component_instance (const char *componentName, CORBA::Long studyId) |
Engines::EngineComponent_ptr | Lload_impl (const char *nameToRegister, const char *componentName) |
Engines::EngineComponent_ptr | createMPIInstance (std::string genericRegisterName, void *handle, int studyId) |
Engines_MPIContainer_i::Engines_MPIContainer_i | ( | CORBA::ORB_ptr | orb, |
PortableServer::POA_ptr | poa, | ||
char * | containerName, | ||
int | argc, | ||
char * | argv[] | ||
) |
References Engines_Container_i::_containerName, Engines_Container_i::_id, Engines_Container_i::_NS, MPIObject_i::_numproc, Engines_Container_i::_orb, Engines_Container_i::_poa, MPIObject_i::BCastIOR(), SALOME_NamingService::BuildContainerNameForNS(), Kernel_Utils::GetHostname(), SALOME_NamingService::init_orb(), SALOME_NamingService::Register(), and SCRUTE.
Engines_MPIContainer_i::Engines_MPIContainer_i | ( | ) |
Engines_MPIContainer_i::~Engines_MPIContainer_i | ( | void | ) |
References MPIObject_i::_numproc, and MESSAGE.
|
protectedinherited |
References MPIObject_i::_nbproc, MPIObject_i::_numproc, and MPIObject_i::tior().
Referenced by createMPIInstance(), Engines_MPIContainer_i(), Lcreate_component_instance(), and Lload_impl().
|
inherited |
References Engines_Container_i::_tmp_files.
Referenced by Engines_Container_i::Shutdown().
|
virtualinherited |
Create a new component instance.
CORBA method: Creates a new servant instance of a component. The servant registers itself to naming service and Registry.
genericRegisterName | Name of the component instance to register in Registry & Name Service (without _inst_n suffix) |
studyId | 0 for multiStudy instance, study Id (>0) otherwise |
References Engines_Container_i::create_component_instance_env().
|
virtual |
Create a new component instance with environment variables specified.
CORBA method: Creates a new servant instance of a component. The servant registers itself to naming service and Registry.
genericRegisterName | Name of the component instance to register in Registry & Name Service (without _inst_n suffix) |
studyId | 0 for multiStudy instance, study Id (>0) otherwise |
env | dict of env variables |
reason | explains error when create_component_instance_env fails |
Reimplemented from Engines_Container_i.
References MPIObject_i::_nbproc, MPIObject_i::_numproc, MPIObject_i::_tior, thread_st::compoName, thread_st::ip, Lcreate_component_instance(), thread_st::studyId, th_createcomponentinstance(), and thread_st::tior.
|
inherited |
Create a new component instance (Executable implementation)
CompName | Name of the component instance |
studyId | 0 for multiStudy instance, study Id (>0) otherwise |
env | dict of env variables |
reason | explains error when creation fails |
This component is implemented in an executable with name genericRegisterName.exe It must register itself in Naming Service. The container waits some time (10 s max) it's registration.
References Engines_Container_i::_containerName, Engines_Container_i::_listInstances_map, Engines_Container_i::_NS, Engines_Container_i::_numInstance, Engines_Container_i::_numInstanceMutex, Engines_Container_i::_orb, SALOME_NamingService::Destroy_Name(), INFOS, MESSAGE, and SALOME_NamingService::Resolve().
Referenced by Engines_Container_i::create_component_instance_env().
|
inherited |
Get or create a file reference object associated to a local file (to transfer it)
CORBA method: get or create a fileRef object associated to a local file (a file on the computer on which runs the container server), which stores a list of (machine, localFileName) corresponding to copies already done.
origFileName | absolute path for a local file to copy on other computers |
References Engines_Container_i::_fileRef_map, Engines_Container_i::_id, Engines_Container_i::_numInstanceMutex, Engines_Container_i::_poa, ASSERT, and INFOS.
|
inherited |
Create a new component instance (C++ implementation)
C++ method: create a servant instance of a component.
genericRegisterName | Name of the component instance to register in Registry & Name Service, (without _inst_n suffix, like "COMPONENT") |
handle | loaded library handle |
studyId | 0 for multiStudy instance, study Id (>0) otherwise |
reason | explains error when creation fails |
example with names:
References Engines_Container_i::_cntInstances_map, Engines_Container_i::_containerName, Engines_Container_i::_id, Engines_Container_i::_listInstances_map, Engines_Container_i::_NS, Engines_Container_i::_numInstance, Engines_Container_i::_numInstanceMutex, Engines_Container_i::_orb, Engines_Container_i::_poa, ASSERT, INFOS, MESSAGE, SALOME_NamingService::Register(), SCRUTE, and Engines_Component_i::setStudyId().
Referenced by Engines_Container_i::create_component_instance_env(), and Engines_Container_i::find_or_create_instance().
|
private |
References Engines_Container_i::_cntInstances_map, Engines_Container_i::_containerName, Engines_Container_i::_id, Engines_Container_i::_listInstances_map, Engines_Container_i::_NS, Engines_Container_i::_numInstance, Engines_Container_i::_numInstanceMutex, MPIObject_i::_numproc, Engines_Container_i::_orb, Engines_Container_i::_poa, ASSERT, MPIObject_i::BCastIOR(), INFOS, MESSAGE, SALOME_NamingService::Register(), SCRUTE, and Engines_Component_i::setStudyId().
Referenced by Lcreate_component_instance().
|
inherited |
create a PyNode object to execute remote python code
nodeName | the name of the node |
code | the python code to load |
References Engines_Container_i::_dftPyNode, Engines_Container_i::_mutexForDftPy, Engines_Container_i::_orb, _pyCont, SALOME::INTERNAL_ERROR, SALOME::ExceptionStruct::text, and SALOME::ExceptionStruct::type.
|
inherited |
create a PyScriptNode object to execute remote python code
nodeName | the name of the node |
code | the python code to load |
References Engines_Container_i::_dftPyScriptNode, Engines_Container_i::_mutexForDftPy, Engines_Container_i::_orb, _pyCont, SALOME::INTERNAL_ERROR, SALOME::ExceptionStruct::text, and SALOME::ExceptionStruct::type.
|
inherited |
Create a new component instance (Python implementation)
CompName | Name of the component instance |
studyId | 0 for multiStudy instance, study Id (>0) otherwise |
reason | explains error when creation fails |
References Engines_Container_i::_containerName, Engines_Container_i::_listInstances_map, Engines_Container_i::_numInstance, Engines_Container_i::_numInstanceMutex, Engines_Container_i::_orb, and _pyCont.
Referenced by Engines_Container_i::create_component_instance_env().
|
virtualinherited |
Create a Salome file.
References Engines_Container_i::_numInstanceMutex, Engines_Container_i::_Salome_file_map, ASSERT, Salome_file_i::recvFiles(), Salome_file_i::setContainer(), and Salome_file_i::setLocalFile().
|
staticinherited |
Decrement component instance reference count.
References Engines_Container_i::_cntInstances_map, Engines_Container_i::_library_map, Engines_Container_i::_numInstanceMutex, Engines_Container_i::_toRemove_map, ASSERT, Engines_Component_i::GetDynLibraryName(), MESSAGE, and SCRUTE.
Referenced by Engines_Component_i::~Engines_Component_i().
void Engines_MPIContainer_i::finalize_removal | ( | ) |
|
inherited |
Find an existing (in the container) component instance.
CORBA method: Finds a servant instance of a component
registeredName | Name of the component in Registry or Name Service, without instance suffix number |
studyId | 0 if instance is not associated to a study, >0 otherwise (== study id) |
References Engines_Container_i::_listInstances_map, and SCRUTE.
|
inherited |
Finds an already existing component instance or create a new instance.
C++ method: Finds an already existing servant instance of a component, or create an instance. -— USE ONLY FOR MULTISTUDY INSTANCES ! -----—
genericRegisterName | Name of the component instance to register in Registry & Name Service, (without _inst_n suffix, like "COMPONENT") |
componentLibraryName | like "libCOMPONENTEngine.so" |
example with names:
References Engines_Container_i::_containerName, Engines_Container_i::_library_map, Engines_Container_i::_NS, Engines_Container_i::_poa, ASSERT, Engines_Container_i::createInstance(), Engines_Component_i::getStudyId(), INFOS, MESSAGE, and SALOME_NamingService::ResolveFirst().
Referenced by Engines_Container_i::load_impl().
|
inherited |
|
inherited |
|
inherited |
Retrieves the last created PyNode instance with createPyNode.
References Engines_Container_i::_dftPyNode, and Engines_Container_i::_mutexForDftPy.
|
inherited |
Retrieves the last created PyScriptNode instance with createPyScriptNode.
References Engines_Container_i::_dftPyScriptNode, and Engines_Container_i::_mutexForDftPy.
|
inherited |
Get a fileTransfer reference.
CORBA method:
References Engines_Container_i::_fileTransfer.
|
inherited |
Get container host name.
CORBA method: Get the hostName of the Container (without domain extensions)
References Kernel_Utils::GetHostname().
|
inherited |
Get container PID.
CORBA method: Get the PID (process identification) of the Container
Indicate if container is a python one.
Retrieves only with container naming convention if it is a python container
|
inherited |
Kill current container.
Kill the container.
CORBA method: Kill the container process with exit(0). To remove : never returns !
References Engines_Container_i::_containerName, ASSERT, Kernel_Utils::GetHostname(), INFOS, and MESSAGE.
|
private |
References Engines_Container_i::_containerName, Engines_Container_i::_isSupervContainer, Engines_Container_i::_library_map, Engines_Container_i::_NS, Engines_Container_i::_numInstance, Engines_Container_i::_numInstanceMutex, MPIObject_i::_numproc, Engines_Container_i::_orb, MPIObject_i::BCastIOR(), createMPIInstance(), INFOS, Py_ACQUIRE_NEW_THREAD, Py_RELEASE_NEW_THREAD, SALOME_NamingService::Register(), and SCRUTE.
Referenced by create_component_instance_env().
|
private |
References Engines_Container_i::_containerName, Engines_Container_i::_id, Engines_Container_i::_NS, Engines_Container_i::_numInstance, Engines_Container_i::_numInstanceMutex, MPIObject_i::_numproc, Engines_Container_i::_orb, Engines_Container_i::_poa, MPIObject_i::BCastIOR(), BEGIN_OF, END_OF, INFOS, Engines_Container_i::load_impl(), MESSAGE, and SALOME_NamingService::Register().
Referenced by load_impl().
|
inherited |
try to load a C++ component implementation
C++ method:
componentName | the name of the component (COMPONENT, for example) |
reason | explains error when load fails |
References Engines_Container_i::_library_map, Engines_Container_i::_numInstanceMutex, Engines_Container_i::_toRemove_map, ENGINESO, findpathof(), LIB, MESSAGE, SCRUTE, and SEP.
Referenced by Engines_Container_i::load_component_Library().
|
inherited |
try to load a Executable component implementation
C++ method:
componentName | name of the component |
reason | explains error when load fails |
References Engines_Container_i::_library_map, Engines_Container_i::_numInstanceMutex, checkifexecutable(), findpathof(), and MESSAGE.
Referenced by Engines_Container_i::load_component_Library().
|
virtual |
load a component implementation
CORBA method
componentName | component name |
reason | explains error when load fails |
Reimplemented from Engines_Container_i.
References MPIObject_i::_nbproc, MPIObject_i::_numproc, MPIObject_i::_tior, thread_st::compoName, thread_st::ip, Lload_component_Library(), th_loadcomponentlibrary(), and thread_st::tior.
|
inherited |
try to load a Python component implementation
C++ method:
componentName | name of the component |
reason | explains error when load fails |
References Engines_Container_i::_library_map, Engines_Container_i::_numInstanceMutex, _pyCont, MESSAGE, and SCRUTE.
Referenced by Engines_Container_i::load_component_Library().
|
inherited |
Get container log file name.
CORBA attribute: Container log file name
References Engines_Container_i::_logfilename.
|
inherited |
Set container log file name.
References Engines_Container_i::_logfilename, and Engines_Container_i::name().
|
inherited |
Get container name.
CORBA attribute: Container name (see constructor)
References Engines_Container_i::_containerName.
Referenced by Engines_Container_i::logfilename().
|
virtualinherited |
Ping the servant to check it is still alive.
CORBA method: check if servant is still alive
References MESSAGE.
|
inherited |
References Engines_Container_i::_tmp_files.
void Engines_MPIContainer_i::remove_impl | ( | Engines::EngineComponent_ptr | component_i | ) |
References Engines_Container_i::_listInstances_map, MPIObject_i::_nbproc, Engines_Container_i::_NS, Engines_Container_i::_numInstanceMutex, MPIObject_i::_numproc, MPIObject_i::_tior, ASSERT, thread_st::cptr, SALOME_NamingService::Destroy_Name(), thread_st::ip, MESSAGE, th_removeimpl(), and thread_st::tior.
|
virtual |
Shutdown the container.
CORBA method, oneway: Server shutdown.
Reimplemented from Engines_Container_i.
References Engines_Container_i::_containerName, Engines_Container_i::_listInstances_map, MPIObject_i::_nbproc, Engines_Container_i::_NS, MPIObject_i::_numproc, Engines_Container_i::_orb, MPIObject_i::_tior, SALOME_NamingService::Destroy_FullDirectory(), SALOME_NamingService::Destroy_Name(), and MESSAGE.
|
inherited |
References MPIObject_i::_tior.
Referenced by MPIObject_i::BCastIOR().
|
inherited |
References MPIObject_i::_tior.
|
inherited |
References Engines_Container_i::_tmp_files.
|
inherited |
Get container working directory.
CORBA attribute: Container working directory
|
protectedinherited |
Referenced by Engines_Container_i::Engines_Container_i().
|
protectedinherited |
Referenced by Engines_Container_i::Engines_Container_i().
|
staticprotectedinherited |
|
protectedinherited |
Referenced by Engines_Container_i::create_python_service_instance(), Engines_Container_i::createExecutableInstance(), Engines_Container_i::createInstance(), createMPIInstance(), Engines_Container_i::createPythonInstance(), Engines_Container_i::Engines_Container_i(), Engines_MPIContainer_i(), Engines_Container_i::find_or_create_instance(), Engines_Container_i::Kill_impl(), Lcreate_component_instance(), Lload_impl(), Engines_Container_i::name(), Shutdown(), and Engines_Container_i::Shutdown().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Referenced by Engines_Container_i::createFileRef().
|
protectedinherited |
Referenced by Engines_Container_i::Engines_Container_i(), and Engines_Container_i::getFileTransfer().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Referenced by Engines_Container_i::Shutdown().
|
protectedinherited |
|
staticprotectedinherited |
Referenced by Engines_Container_i::create_component_instance_env(), Engines_Container_i::decInstanceCnt(), Engines_Container_i::find_or_create_instance(), Lcreate_component_instance(), Lload_component_Library(), Engines_Container_i::load_component_CppImplementation(), Engines_Container_i::load_component_ExecutableImplementation(), and Engines_Container_i::load_component_PythonImplementation().
|
protectedinherited |
|
protectedinherited |
Referenced by Engines_Container_i::createExecutableInstance(), Engines_Container_i::createInstance(), createMPIInstance(), Engines_Container_i::createPythonInstance(), Engines_Container_i::find_component_instance(), remove_impl(), Engines_Container_i::remove_impl(), Shutdown(), and Engines_Container_i::Shutdown().
|
protectedinherited |
Referenced by Engines_Container_i::logfilename().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Referenced by Engines_Container_i::createExecutableInstance(), Engines_Container_i::createInstance(), createMPIInstance(), Engines_Container_i::Engines_Container_i(), Engines_MPIContainer_i(), Engines_Container_i::find_or_create_instance(), Lcreate_component_instance(), Lload_impl(), remove_impl(), Engines_Container_i::remove_impl(), Shutdown(), Engines_Container_i::Shutdown(), and Engines_Container_i::~Engines_Container_i().
|
protectedinherited |
|
staticprotectedinherited |
Referenced by Engines_Container_i::create_python_service_instance(), Engines_Container_i::createExecutableInstance(), Engines_Container_i::createFileRef(), Engines_Container_i::createInstance(), createMPIInstance(), Engines_Container_i::createPythonInstance(), Engines_Container_i::createSalome_file(), Engines_Container_i::decInstanceCnt(), finalize_removal(), Engines_Container_i::finalize_removal(), Lcreate_component_instance(), Lload_component_Library(), Lload_impl(), Engines_Container_i::load_component_CppImplementation(), Engines_Container_i::load_component_ExecutableImplementation(), Engines_Container_i::load_component_PythonImplementation(), remove_impl(), and Engines_Container_i::remove_impl().
|
protectedinherited |
Referenced by MPIObject_i::BCastIOR(), TestMPIComponentEngine::Coucou(), create_component_instance_env(), createMPIInstance(), Engines_MPIContainer_i(), finalize_removal(), Lcreate_component_instance(), Lload_component_Library(), Lload_impl(), load_component_Library(), load_impl(), MPIObject_i::MPIObject_i(), remove_impl(), Shutdown(), TestMPIComponentEngine::SPCoucou(), and ~Engines_MPIContainer_i().
|
protectedinherited |
Referenced by Engines_Container_i::createExecutableInstance(), Engines_Container_i::createInstance(), createMPIInstance(), Engines_Container_i::createPyNode(), Engines_Container_i::createPyScriptNode(), Engines_Container_i::createPythonInstance(), Engines_Container_i::Engines_Container_i(), Engines_MPIContainer_i(), Lcreate_component_instance(), Lload_impl(), Shutdown(), and Engines_Container_i::Shutdown().
|
protectedinherited |
Referenced by Engines_Container_i::Engines_Container_i().
|
protectedinherited |
|
protectedinherited |
Referenced by Engines_Container_i::createSalome_file().
|
protectedinherited |
|
protectedinherited |
|
staticprotectedinherited |