C++ implementation of Engines::Container interface for parallel container implemented with PaCO++. More...
#include <SALOME_ParallelContainer_i.hxx>
Public Member Functions | |
Engines_Parallel_Container_i (CORBA::ORB_ptr orb, char *ior, int rank, PortableServer::POA_ptr poa, std::string containerName, bool isServantAloneInProcess=true) | |
Construtor. More... | |
virtual | ~Engines_Parallel_Container_i () |
Destructor. More... | |
virtual bool | load_component_Library (const char *componentName, CORBA::String_out reason) |
load a new component class More... | |
virtual Engines::EngineComponent_ptr | create_component_instance (const char *componentName, CORBA::Long studyId) |
Create a new component instance. 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. 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... | |
Engines::EngineComponent_ptr | load_impl (const char *nameToRegister, const char *componentName) |
Find or create a new component instance. More... | |
void | create_paco_component_node_instance (const char *componentName, const char *proxy_containerName, CORBA::Long studyId) |
void | updateInstanceNumber () |
void | remove_impl (Engines::EngineComponent_ptr component_i) |
Remove the component instance from container. More... | |
void | finalize_removal () |
Unload component libraries from the container. 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... | |
virtual void | Shutdown () |
Shutdown the container. More... | |
char * | getHostName () |
Get container host name. More... | |
CORBA::Long | getPID () |
Get container PID. More... | |
bool | Kill_impl () |
Kill current container. More... | |
Engines::EngineComponent_ptr | find_or_create_instance (std::string genericRegisterName) |
Finds an already existing component instance or create a new instance. More... | |
Engines::EngineComponent_ptr | createCPPInstance (std::string genericRegisterName, void *handle, int studyId) |
Create a new CPP component instance. More... | |
Engines::EngineComponent_ptr | createPythonInstance (std::string genericRegisterName, int studyId) |
Create a new Python component instance. More... | |
void | set_id (PortableServer::ObjectId *id) |
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 () |
CORBA method: More... | |
virtual Engines::Salome_file_ptr | createSalome_file (const char *origFileName) |
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) |
Engines::PyScriptNode_ptr | createPyScriptNode (const char *nodeName, const char *code) |
Engines::PyScriptNode_ptr | getDefaultPyScriptNode (const char *nodeName) |
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 Types | |
typedef std::map< std::string, Engines::EngineComponent_var > | _listInstances_map_t |
typedef std::map< std::string, Engines::fileRef_var > | _fileRef_map_t |
typedef std::map< std::string, Engines::Salome_file_var > | _Salome_file_map_t |
typedef PortableServer::ObjectId *(* | FACTORY_FUNCTION )(CORBA::ORB_ptr, char *, int, PortableServer::POA_ptr, PortableServer::ObjectId *, const char *, const char *) |
Protected Attributes | |
SALOME_NamingService * | _NS |
std::string | _hostname |
std::string | _library_path |
std::string | _containerName |
std::string | _logfilename |
CORBA::ORB_var | _orb |
PortableServer::POA_var | _poa |
PortableServer::ObjectId * | _id |
int | _numInstance |
CORBA::Long | _pid |
bool | _isServantAloneInProcess |
Engines::fileTransfer_var | _fileTransfer |
_listInstances_map_t | _listInstances_map |
_fileRef_map_t | _fileRef_map |
_Salome_file_map_t | _Salome_file_map |
std::map< std::string, PortableServer::ObjectId * > | _par_obj_inst_map |
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 |
C++ implementation of Engines::Container interface for parallel container implemented with PaCO++.
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
|
virtual |
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 create_component_instance_env().
Referenced by find_or_create_instance().
|
virtual |
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 |
env | dict of environment variables |
References ParallelGlobalProcessVar_i::_library_map, _numInstance, ParallelGlobalProcessVar_i::_numInstanceMutex, createCPPInstance(), createPythonInstance(), INFOS, and MESSAGE.
Referenced by create_component_instance().
void Engines_Parallel_Container_i::create_paco_component_node_instance | ( | const char * | componentName, |
const char * | proxy_containerName, | ||
CORBA::Long | studyId | ||
) |
References _containerName, _id, ParallelGlobalProcessVar_i::_library_map, _NS, _numInstance, ParallelGlobalProcessVar_i::_numInstanceMutex, _orb, _par_obj_inst_map, _poa, INFOS, SALOME::INTERNAL_ERROR, MESSAGE, SALOME_NamingService::Register(), SALOME_NamingService::Resolve(), SALOME::ExceptionStruct::text, and SALOME::ExceptionStruct::type.
|
virtual |
Engines::EngineComponent_ptr Engines_Parallel_Container_i::createCPPInstance | ( | std::string | genericRegisterName, |
void * | handle, | ||
int | studyId | ||
) |
Create a new CPP component instance.
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 |
example with names: aGenRegisterName = COMPONENT (= first argument) _containerName = /Containers/cli76ce/FactoryServer factoryName = COMPONENTEngine_factory component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT instanceName = COMPONENT_inst_1 component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
References ParallelGlobalProcessVar_i::_cntInstances_map, _containerName, _id, _listInstances_map, _NS, _numInstance, _orb, _poa, ASSERT, INFOS, MESSAGE, SALOME_NamingService::Register(), and Engines_Component_i::setStudyId().
Referenced by create_component_instance_env().
Engines::fileRef_ptr Engines_Parallel_Container_i::createFileRef | ( | const char * | origFileName | ) |
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 _fileRef_map, _id, ParallelGlobalProcessVar_i::_numInstanceMutex, _poa, ASSERT, and INFOS.
Engines::PyNode_ptr Engines_Parallel_Container_i::createPyNode | ( | const char * | nodeName, |
const char * | code | ||
) |
create a PyNode object to execute remote python code
nodeName | the name of the node |
code | the python code to load |
References INFOS.
Engines::PyScriptNode_ptr Engines_Parallel_Container_i::createPyScriptNode | ( | const char * | nodeName, |
const char * | code | ||
) |
References INFOS.
Engines::EngineComponent_ptr Engines_Parallel_Container_i::createPythonInstance | ( | std::string | genericRegisterName, |
int | studyId | ||
) |
Create a new Python component instance.
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 |
example with names: aGenRegisterName = COMPONENT (= first argument) _containerName = /Containers/cli76ce/FactoryServer factoryName = COMPONENTEngine_factory component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT instanceName = COMPONENT_inst_1 component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
References _containerName, _listInstances_map, _numInstance, _orb, Py_ACQUIRE_NEW_THREAD, and Py_RELEASE_NEW_THREAD.
Referenced by create_component_instance_env().
|
virtual |
|
static |
Decrement component instance reference count.
References ParallelGlobalProcessVar_i::_cntInstances_map, ParallelGlobalProcessVar_i::_library_map, ParallelGlobalProcessVar_i::_numInstanceMutex, ParallelGlobalProcessVar_i::_toRemove_map, ASSERT, Engines_Component_i::GetDynLibraryName(), MESSAGE, and SCRUTE.
Referenced by Engines_Parallel_Component_i::~Engines_Parallel_Component_i().
void Engines_Parallel_Container_i::finalize_removal | ( | ) |
Unload component libraries from the container.
CORBA method: Discharges unused libraries from the container.
References ParallelGlobalProcessVar_i::_numInstanceMutex, ParallelGlobalProcessVar_i::_toRemove_map, and MESSAGE.
Engines::EngineComponent_ptr Engines_Parallel_Container_i::find_component_instance | ( | const char * | registeredName, |
CORBA::Long | studyId | ||
) |
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 _listInstances_map, and SCRUTE.
Engines::EngineComponent_ptr Engines_Parallel_Container_i::find_or_create_instance | ( | std::string | genericRegisterName | ) |
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") |
example with names: aGenRegisterName = COMPONENT (= first argument) impl_name = libCOMPONENTEngine.so (= second argument) _containerName = /Containers/cli76ce/FactoryServer factoryName = COMPONENTEngine_factory component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
instanceName = COMPONENT_inst_1 component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
References _containerName, _NS, _poa, ASSERT, create_component_instance(), Engines_Component_i::getStudyId(), INFOS, and SALOME_NamingService::ResolveFirst().
Referenced by load_impl().
Engines::PyNode_ptr Engines_Parallel_Container_i::getDefaultPyNode | ( | const char * | nodeName | ) |
References INFOS.
Engines::PyScriptNode_ptr Engines_Parallel_Container_i::getDefaultPyScriptNode | ( | const char * | nodeName | ) |
References INFOS.
Engines::fileTransfer_ptr Engines_Parallel_Container_i::getFileTransfer | ( | ) |
char * Engines_Parallel_Container_i::getHostName | ( | ) |
CORBA::Long Engines_Parallel_Container_i::getPID | ( | ) |
Indicate if container is a python one.
Retrieves only with container naming convention if it is a python container
bool Engines_Parallel_Container_i::Kill_impl | ( | ) |
|
virtual |
load a new component class
CORBA method: load a new component class (Python or C++ implementation)
componentName | like COMPONENT try to make a Python import of COMPONENT, then a lib open of libCOMPONENTEngine.so |
References ParallelGlobalProcessVar_i::_library_map, ParallelGlobalProcessVar_i::_numInstanceMutex, ParallelGlobalProcessVar_i::_toRemove_map, MESSAGE, Py_ACQUIRE_NEW_THREAD, and Py_RELEASE_NEW_THREAD.
Referenced by load_impl().
Engines::EngineComponent_ptr Engines_Parallel_Container_i::load_impl | ( | const char * | genericRegisterName, |
const char * | componentName | ||
) |
Find or create a new component instance.
CORBA method: find or create an instance of the component (servant), load a new component class (dynamic library) if required, -— FOR COMPATIBILITY WITH 2.2 -— -— USE ONLY FOR MULTISTUDY INSTANCES ! -----— The servant registers itself to naming service and Registry.
genericRegisterName | Name of the component to register in Registry & Name Service |
componentName | Name of the constructed library of the component |
References find_or_create_instance(), and load_component_Library().
char * Engines_Parallel_Container_i::logfilename | ( | ) |
void Engines_Parallel_Container_i::logfilename | ( | const char * | name | ) |
Set container log file name.
References _logfilename, and name().
char * Engines_Parallel_Container_i::name | ( | ) |
Get container name.
CORBA attribute: Container name (see constructor)
References _containerName.
Referenced by logfilename().
|
virtual |
void Engines_Parallel_Container_i::remove_impl | ( | Engines::EngineComponent_ptr | component_i | ) |
Remove the component instance from container.
CORBA method: Stops the component servant, and deletes all related objects
component_i | Component to be removed |
References _listInstances_map, _NS, ParallelGlobalProcessVar_i::_numInstanceMutex, ASSERT, SALOME_NamingService::Destroy_Name(), and MESSAGE.
void Engines_Parallel_Container_i::set_id | ( | PortableServer::ObjectId * | id | ) |
|
virtual |
Shutdown the container.
CORBA method, oneway: Server shutdown.
References _containerName, _isServantAloneInProcess, _listInstances_map, _NS, _orb, _par_obj_inst_map, _poa, SALOME_NamingService::Destroy_FullDirectory(), SALOME_NamingService::Destroy_Name(), and MESSAGE.
void Engines_Parallel_Container_i::updateInstanceNumber | ( | ) |
References _numInstance, and ParallelGlobalProcessVar_i::_numInstanceMutex.
char * Engines_Parallel_Container_i::workingdir | ( | ) |
Get container working directory.
CORBA attribute: Container working directory
|
staticprotectedinherited |
|
protected |
|
protected |
Referenced by createFileRef().
|
protected |
Referenced by Engines_Parallel_Container_i(), and getFileTransfer().
|
protected |
Referenced by Engines_Parallel_Container_i(), getHostName(), and Kill_impl().
|
protected |
|
protected |
Referenced by Shutdown().
|
staticprotectedinherited |
|
protected |
|
protected |
Referenced by createCPPInstance(), createPythonInstance(), find_component_instance(), remove_impl(), and Shutdown().
|
protected |
Referenced by logfilename().
|
protected |
|
protected |
|
staticprotectedinherited |
Referenced by Container_proxy_impl_final::create_component_instance_env(), create_component_instance_env(), create_paco_component_node_instance(), createFileRef(), createSalome_file(), decInstanceCnt(), finalize_removal(), Container_proxy_impl_final::load_component_Library(), load_component_Library(), remove_impl(), and updateInstanceNumber().
|
protected |
|
protected |
Referenced by create_paco_component_node_instance(), and Shutdown().
|
protected |
Referenced by Engines_Parallel_Container_i(), getPID(), Kill_impl(), and ping().
|
protected |
|
protected |
Referenced by createSalome_file().
|
staticprotectedinherited |
Referenced by decInstanceCnt(), finalize_removal(), and load_component_Library().