From 9455e7a4d7fa9e1056ea0b13866cbcde6e4b36fa Mon Sep 17 00:00:00 2001 From: prascle Date: Tue, 20 Sep 2005 14:36:03 +0000 Subject: [PATCH] PR: LifeCycleCORBA and Container Manager Corrections --- bin/appliskel/runAppli | 7 +- bin/appliskel/runSession | 3 + idl/SALOME_Component.idl | 20 +- idl/SALOME_ContainerManager.idl | 19 +- src/Container/Component_i.cxx | 35 ++- src/Container/Container_i.cxx | 17 +- src/Container/Makefile.in | 2 +- src/Container/SALOME_ComponentPy.py | 4 +- src/Container/SALOME_Component_i.hxx | 54 ++-- src/Container/SALOME_Container.py | 1 + src/Container/SALOME_ContainerManager.cxx | 163 +++++++--- src/Container/SALOME_ContainerManager.hxx | 33 +- src/Container/SALOME_ContainerPy.py | 39 +-- src/Container/SALOME_Container_i.hxx | 20 +- src/DataTypeCatalog/Makefile.in | 2 +- src/LifeCycleCORBA/Makefile.in | 2 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 296 +++++++++++++----- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 33 +- src/LifeCycleCORBA_SWIG/Makefile.in | 2 +- src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py | 6 +- src/ModuleCatalog/Makefile.in | 2 +- src/NamingService/Makefile.in | 1 + src/NamingService/SALOME_NamingService.cxx | 2 + src/Registry/Makefile.in | 2 +- src/ResourcesManager/Makefile.in | 2 +- .../SALOME_LoadRateManager.cxx | 3 + .../SALOME_ResourcesManager.cxx | 52 +-- src/RessourcesCatalog/Makefile.in | 2 +- src/TestContainer/Makefile.in | 2 +- 29 files changed, 567 insertions(+), 259 deletions(-) diff --git a/bin/appliskel/runAppli b/bin/appliskel/runAppli index 3e703bc64..05b0287d1 100755 --- a/bin/appliskel/runAppli +++ b/bin/appliskel/runAppli @@ -33,10 +33,13 @@ searchFreePort() { if [ -z "$aRes" ]; then echo ${NSPORT} - Ok local myhost=`hostname` - export OMNIORB_CONFIG=${HOME}/$APPLI//.omniORB_${myhost}_${NSPORT}.cfg + export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg export NSPORT local initref="NameService=corbaname::"`hostname`":$NSPORT" echo "ORBInitRef $initref" > $OMNIORB_CONFIG + LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + rm ${LAST_RUNNING_CONFIG} + ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} break fi echo -n "${NSPORT} " @@ -61,3 +64,5 @@ if [ $# -ne 0 ] ; then else ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py fi + +rm ${OMNIORB_CONFIG} diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession index d94bfff6c..a2c9d4b45 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -25,6 +25,9 @@ export APPLI . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} +myhost=`hostname` +export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + # --- invoque shell with or without args if [ $# -ne 0 ] ; then diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 3d305ab77..bb0990030 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -33,8 +33,8 @@ component in %SALOME application. module Engines { /*! - A byte stream which is used for binary data transfer between different components - + A byte stream which is used for binary data transfer between different + components */ typedef sequence TMPFile; @@ -71,8 +71,8 @@ module Engines /*! Creates a new servant instance of a component. Component library must be loaded. - \param comoponentName Name of the component which will be registered - in Registry and Name Service, + \param componentName Name of the component which will be registered + in Registry and Name Service, (instance number suffix added to the registered name) \param studyId 0 if instance is not associated to a study, >0 otherwise (== study id) @@ -239,9 +239,8 @@ module Engines /*! This method is used by the %SUPERVISOR component. It sets the names of the graph and of the node. - \param aGraphName - Name of graph - \param aNodeName Name of node + \param aGraphName Name of graph + \param aNodeName Name of node */ void Names( in string aGraphName , in string aNodeName ) ; @@ -273,9 +272,12 @@ module Engines long CpuUsed_impl() ; /*! - Returns a python script, which is being played back reproduces the data model of component + Returns a python script, which is being played back reproduces + the data model of component */ - TMPFile DumpPython(in Object theStudy, in boolean isPublished, out boolean isValidScript); + TMPFile DumpPython(in Object theStudy, + in boolean isPublished, + out boolean isValidScript); } ; } ; diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 7ee221913..7d4e96c24 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -1,6 +1,7 @@ #ifndef _SALOME_CONTAINERMANAGER_IDL_ #define _SALOME_CONTAINERMANAGER_IDL_ +#include "SALOME_Exception.idl" #include "SALOME_Component.idl" module Engines @@ -26,17 +27,29 @@ struct MachineParameters */ typedef sequence MachineList; +/*! + exception thrown if a computer is not found in the catalog +*/ + exception NotFound {}; + + /*! \brief Interface of the %containerManager - This interface is used for interaction with the unique instance of ContainerManager + This interface is used for interaction with the unique instance + of ContainerManager */ interface ContainerManager { - Container FindOrStartContainer( in MachineParameters params, in MachineList possibleComputers); + Container FindOrStartContainer( in MachineParameters params, + in MachineList possibleComputers); + string FindBest(in MachineList possibleComputers); MachineList GetFittingResources( in MachineParameters params, - in string componentName ); + in string componentName ) + raises (SALOME::SALOME_Exception); + void Shutdown(); + void ShutdownContainers(); } ; }; diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index e40508347..258a7acf7 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -250,14 +250,21 @@ void Engines_Component_i::destroy() Engines::Container_ptr Engines_Component_i::GetContainerRef() { + MESSAGE("Engines_Component_i::GetContainerRef"); CORBA::Object_ptr o = _poa->id_to_reference(*_contId) ; return Engines::Container::_narrow(o); } -Engines_Container_i *Engines_Component_i::GetContainerPtr() -{ - return dynamic_cast(_poa->id_to_servant(*_contId)) ; -} +//============================================================================= +/*! + * CORBA method: + * Gives a sequence of (key=string,value=any) to the component. + * Base class component stores the sequence in a map. + * The map is cleared before. + * This map is for use by derived classes. + * \param dico sequence of (key=string,value=any) + */ +//============================================================================= void Engines_Component_i::setProperties(const Engines::FieldsDict& dico) { @@ -502,13 +509,26 @@ CORBA::Long Engines_Component_i::CpuUsed_impl() return cpu ; } + +//============================================================================= +/*! + * C++ method: return Container Servant + */ +//============================================================================= + +Engines_Container_i *Engines_Component_i::GetContainerPtr() +{ + return dynamic_cast(_poa->id_to_servant(*_contId)) ; +} + //============================================================================= /*! * C++ method: set study Id * \param studyId 0 if instance is not associated to a study, * >0 otherwise (== study id) * \return true if the set of study Id is OK - * must be set once by Container, and cannot be changed after. + * must be set once by Container, at instance creation, + * and cannot be changed after. */ //============================================================================= @@ -516,7 +536,7 @@ CORBA::Boolean Engines_Component_i::setStudyId(CORBA::Long studyId) { ASSERT( studyId >= 0); CORBA::Boolean ret = false; - if (_studyId < 0) + if (_studyId < 0) // --- not yet initialized { _studyId = studyId; ret = true; @@ -760,7 +780,7 @@ void Engines_Component_i::sendMessage(const char *event_type, //============================================================================= /*! - * C++ method: + * C++ method: return standard library name built on component name */ //============================================================================= @@ -791,4 +811,3 @@ Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy, isValidScript = true; return aStreamFile._retn(); } - diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 3357c8fdc..2f1327fc6 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -152,9 +152,12 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, Engines::Container_var pCont = Engines::Container::_narrow(obj); - _containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str()); + _containerName = _NS->BuildContainerNameForNS(containerName, + hostname.c_str()); SCRUTE(_containerName); _NS->Register(pCont, _containerName.c_str()); + MESSAGE("Engines_Container_i::Engines_Container_i : Container name " + << _containerName); // Python: // import SALOME_Container @@ -171,8 +174,10 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, { Py_ACQUIRE_NEW_THREAD; #ifdef WNT -Sleep(2000); // mpv: this is temporary solution: there is a unregular crash if not - PyRun_SimpleString("import sys\n"); // first element is the path to Registry.dll, but it's wrong + // mpv: this is temporary solution: there is a unregular crash if not + Sleep(2000); + PyRun_SimpleString("import sys\n"); + // first element is the path to Registry.dll, but it's wrong PyRun_SimpleString("sys.path = sys.path[1:]\n"); #endif PyRun_SimpleString("import SALOME_Container\n"); @@ -802,8 +807,10 @@ void ActSigIntHandler() SigIntAct.sa_flags = SA_SIGINFO ; #endif -// DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals (SIGINT | SIGUSR1) : -// it must be only one signal ===> one call for SIGINT and an other one for SIGUSR1 +// DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals +// (SIGINT | SIGUSR1) : +// it must be only one signal ===> one call for SIGINT +// and an other one for SIGUSR1 #ifndef WNT if ( sigaction( SIGINT , &SigIntAct, NULL ) ) { perror("SALOME_Container main ") ; diff --git a/src/Container/Makefile.in b/src/Container/Makefile.in index 5ccebde83..9a355a682 100644 --- a/src/Container/Makefile.in +++ b/src/Container/Makefile.in @@ -52,7 +52,7 @@ LIB_SRC = Component_i.cxx \ SALOME_ContainerManager.cxx \ Container_init_python.cxx -LIB_SERVER_IDL = SALOME_Registry.idl SALOME_Component.idl SALOME_ContainerManager.idl +LIB_SERVER_IDL = SALOME_Registry.idl SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Exception.idl LIB_CLIENT_IDL = # Executables targets diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 6ae1812b4..642c76e5a 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -59,7 +59,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): #------------------------------------------------------------------------- def __init__ (self, orb, poa, contID, containerName, - instanceName, interfaceName, notif): + instanceName, interfaceName, notif=0): # Notif for notification services # NOT YET IMPLEMENTED MESSAGE( "SALOME_ComponentPy_i::__init__" + " " + str (containerName) + " " + str(instanceName) + " " + str(interfaceName) ) @@ -80,7 +80,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): naming_service = SALOME_NamingServicePy_i(self._orb) myMachine=getShortHostName() - Component_path = "/Containers/" + myMachine + "/" + self._containerName + "/" + self._interfaceName + Component_path = self._containerName + "/" + self._instanceName MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) ) naming_service.Register(self._this(), Component_path) diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index f20b5a141..c8de1f1aa 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -59,8 +59,9 @@ class Engines_Container_i; #endif #endif -class CONTAINER_EXPORT Engines_Component_i: public virtual POA_Engines::Component, - public virtual PortableServer::RefCountServantBase +class CONTAINER_EXPORT Engines_Component_i: + public virtual POA_Engines::Component, + public virtual PortableServer::RefCountServantBase { public: Engines_Component_i(); @@ -81,51 +82,59 @@ public: virtual ~Engines_Component_i(); + // --- CORBA methods + char* instanceName(); char* interfaceName(); - void destroy(); void ping(); + void destroy(); + CORBA::Long getStudyId(); Engines::Container_ptr GetContainerRef(); - Engines_Container_i *GetContainerPtr(); - PortableServer::ObjectId * getId(); void setProperties(const Engines::FieldsDict& dico); Engines::FieldsDict* getProperties(); - void beginService(const char *serviceName); - void endService(const char *serviceName); - void sendMessage(const char *event_type, const char *message); - void Names( const char * graphName , const char * nodeName ) ; - char * graphName() ; - char * nodeName() ; - bool Killer( pthread_t ThreadId , int signum ); bool Kill_impl(); bool Stop_impl(); bool Suspend_impl(); bool Resume_impl(); - void SetCurCpu() ; - long CpuUsed() ; CORBA::Long CpuUsed_impl() ; - CORBA::Long getStudyId(); - virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, CORBA::Boolean& isValidScript); + virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript); + + + // --- local C++ methods + + PortableServer::ObjectId * getId(); + Engines_Container_i *GetContainerPtr(); bool setStudyId(CORBA::Long studyId); static bool isMultiStudy(); static bool isMultiInstance(); static std::string GetDynLibraryName(const char *componentName); + + void beginService(const char *serviceName); + void endService(const char *serviceName); + void sendMessage(const char *event_type, const char *message); + char * graphName() ; + char * nodeName() ; + bool Killer( pthread_t ThreadId , int signum ); + void SetCurCpu() ; + long CpuUsed() ; + protected: + int _studyId; // -1: not initialised; 0: multiStudy; >0: study static bool _isMultiStudy; static bool _isMultiInstance; + std::string _instanceName ; std::string _interfaceName ; - std::string _serviceName ; - std::string _graphName ; - std::string _nodeName ; - int _studyId; // -1: not initialised; 0: multiStudy; >0: study + CORBA::ORB_ptr _orb; PortableServer::POA_ptr _poa; PortableServer::ObjectId * _id; @@ -135,6 +144,10 @@ protected: NOTIFICATION_Supplier* _notifSupplier; std::map_fieldsDict; + std::string _serviceName ; + std::string _graphName ; + std::string _nodeName ; + private: #ifndef WNT pthread_t _ThreadId ; @@ -147,4 +160,3 @@ private: }; #endif - diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index befd9a173..4dab6de0d 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -61,6 +61,7 @@ class SALOME_Container_i: self._orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) self._poa = self._orb.resolve_initial_references("RootPOA") self._containerName = containerName + print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName #self._naming_service = SALOME_NamingServicePy_i(self._orb) self._container = self._orb.string_to_object(containerIORStr) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 759dea955..ddfcb3776 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -6,30 +6,38 @@ #include #endif #include +#include "Utils_CorbaException.hxx" #define TIME_OUT_TO_LAUNCH_CONT 21 using namespace std; -const char *SALOME_ContainerManager::_ContainerManagerNameInNS="/ContainerManager"; +const char *SALOME_ContainerManager::_ContainerManagerNameInNS = + "/ContainerManager"; SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb) { MESSAGE("constructor"); - _NS=new SALOME_NamingService(orb); - _ResManager=new SALOME_ResourcesManager(orb); - PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa(); + _NS = new SALOME_NamingService(orb); + _ResManager = new SALOME_ResourcesManager(orb); + PortableServer::POA_var root_poa = PortableServer::POA::_the_root_poa(); PortableServer::POAManager_var pman = root_poa->the_POAManager(); PortableServer::POA_var my_poa; + CORBA::PolicyList policies; policies.length(1); - PortableServer::ThreadPolicy_var threadPol=root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL); - policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); - my_poa=root_poa->create_POA("SThreadPOA",pman,policies); + PortableServer::ThreadPolicy_var threadPol = + root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL); + policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol); + + my_poa = + root_poa->create_POA("SThreadPOA",pman,policies); threadPol->destroy(); - PortableServer::ObjectId_var id=my_poa->activate_object(this); - CORBA::Object_var obj=my_poa->id_to_reference(id); - Engines::ContainerManager_var refContMan = Engines::ContainerManager::_narrow(obj); + PortableServer::ObjectId_var id = my_poa->activate_object(this); + CORBA::Object_var obj = my_poa->id_to_reference(id); + Engines::ContainerManager_var refContMan = + Engines::ContainerManager::_narrow(obj); + _NS->Register(refContMan,_ContainerManagerNameInNS); MESSAGE("constructor end"); } @@ -55,8 +63,8 @@ void SALOME_ContainerManager::ShutdownContainers() { MESSAGE("ShutdownContainers"); _NS->Change_Directory("/Containers"); - vector vec=_NS->list_directory_recurs(); - for(vector::iterator iter=vec.begin();iter!=vec.end();iter++) + vector vec = _NS->list_directory_recurs(); + for(vector::iterator iter = vec.begin();iter!=vec.end();iter++) { SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); @@ -66,56 +74,97 @@ void SALOME_ContainerManager::ShutdownContainers() } } -Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputers) +Engines::Container_ptr +SALOME_ContainerManager:: +FindOrStartContainer(const Engines::MachineParameters& params, + const Engines::MachineList& possibleComputers) { - Engines::Container_ptr ret=FindContainer(params,possibleComputers); + Engines::Container_ptr ret = FindContainer(params,possibleComputers); if(!CORBA::is_nil(ret)) return ret; MESSAGE("Container doesn't exist try to launch it ..."); - vector vector; + MESSAGE("SALOME_ContainerManager::FindOrStartContainer " << + possibleComputers.length()); + //vector vector; string theMachine=_ResManager->FindBest(possibleComputers); + MESSAGE("try to launch it on " << theMachine); + string command; - if(theMachine==GetHostname()) - command=_ResManager->BuildCommandToLaunchLocalContainer(params); + if(theMachine=="") + { + MESSAGE("SALOME_ContainerManager::FindOrStartContainer : " << + "no possible computer"); + return Engines::Container::_nil(); + } + else if(theMachine==GetHostname()) + { + command=_ResManager->BuildCommandToLaunchLocalContainer(params); + } else - command=_ResManager->BuildTempFileToLaunchRemoteContainer(theMachine,params); + command = + _ResManager->BuildTempFileToLaunchRemoteContainer(theMachine,params); + _ResManager->RmTmpFile(); int status=system(command.c_str()); - if (status == -1) { - MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)"); - return Engines::Container::_nil(); - } - else if (status == 217) { - MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status 217)"); - return Engines::Container::_nil(); - } - else { - int count=TIME_OUT_TO_LAUNCH_CONT; - while ( CORBA::is_nil(ret) && count ) { + if (status == -1) + { + MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << + "(system command status -1)"); + return Engines::Container::_nil(); + } + else if (status == 217) + { + MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << + "(system command status 217)"); + return Engines::Container::_nil(); + } + else + { + int count=TIME_OUT_TO_LAUNCH_CONT; + while ( CORBA::is_nil(ret) && count ) + { #ifndef WNT - sleep( 1 ) ; + sleep( 1 ) ; #else Sleep(1000); #endif - count-- ; - if ( count != 10 ) - MESSAGE( count << ". Waiting for FactoryServer on " << theMachine); - string containerNameInNS=_NS->BuildContainerNameForNS(params,theMachine.c_str()); - SCRUTE(containerNameInNS); - CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); - ret=Engines::Container::_narrow(obj); - } - if ( CORBA::is_nil(ret) ) { - MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed"); + count-- ; + if ( count != 10 ) + MESSAGE( count << ". Waiting for FactoryServer on " << theMachine); + string containerNameInNS = + _NS->BuildContainerNameForNS(params,theMachine.c_str()); + SCRUTE(containerNameInNS); + CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); + ret=Engines::Container::_narrow(obj); + } + if ( CORBA::is_nil(ret) ) + { + MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed"); + } + return ret; } - return ret; - } } -Engines::MachineList *SALOME_ContainerManager::GetFittingResources(const Engines::MachineParameters& params, const char *componentName) +Engines::MachineList * +SALOME_ContainerManager:: +GetFittingResources(const Engines::MachineParameters& params, + const char *componentName) { - vector vec=_ResManager->GetFittingResources(params,componentName); + MESSAGE("SALOME_ContainerManager::GetFittingResources"); Engines::MachineList *ret=new Engines::MachineList; + vector vec; + try + { + vec = _ResManager->GetFittingResources(params,componentName); + } + catch(const SALOME_Exception &ex) + { + INFOS("Caught exception."); + cerr << ex.what() <length(vec.size()); for(unsigned int i=0;iFindBest(possibleComputers); - return CORBA::string_dup(theMachine.c_str()); - } +char* +SALOME_ContainerManager:: +FindBest(const Engines::MachineList& possibleComputers) +{ + string theMachine=_ResManager->FindBest(possibleComputers); + return CORBA::string_dup(theMachine.c_str()); +} -Engines::Container_ptr SALOME_ContainerManager::FindContainer(const Engines::MachineParameters& params,const char *theMachine) +Engines::Container_ptr +SALOME_ContainerManager:: +FindContainer(const Engines::MachineParameters& params, + const char *theMachine) { string containerNameInNS(_NS->BuildContainerNameForNS(params,theMachine)); CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); @@ -141,14 +195,19 @@ Engines::Container_ptr SALOME_ContainerManager::FindContainer(const Engines::Mac return Engines::Container::_nil(); } -Engines::Container_ptr SALOME_ContainerManager::FindContainer(const Engines::MachineParameters& params,const Engines::MachineList& possibleComputers) +Engines::Container_ptr +SALOME_ContainerManager:: +FindContainer(const Engines::MachineParameters& params, + const Engines::MachineList& possibleComputers) { MESSAGE("FindContainer "< _cntInstances_map; static std::map _library_map; // library names, loaded @@ -131,7 +132,7 @@ protected: bool _isSupervContainer; - SALOME_NamingService *_NS ; + SALOME_NamingService *_NS ; std::string _library_path; std::string _containerName; CORBA::ORB_var _orb; @@ -150,4 +151,3 @@ protected: #endif - diff --git a/src/DataTypeCatalog/Makefile.in b/src/DataTypeCatalog/Makefile.in index d71544c64..ee33b9223 100644 --- a/src/DataTypeCatalog/Makefile.in +++ b/src/DataTypeCatalog/Makefile.in @@ -50,7 +50,7 @@ LIB_SRC = \ # in fact client is a test ! So it may go away BIN ! BIN = SALOME_DataTypeCatalog_Server SALOME_DataTypeCatalog_Client BIN_SRC = -BIN_SERVER_IDL = SALOME_DataTypeCatalog.idl +BIN_SERVER_IDL = SALOME_DataTypeCatalog.idl SALOME_Exception.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= diff --git a/src/LifeCycleCORBA/Makefile.in b/src/LifeCycleCORBA/Makefile.in index b23e0d50a..786299949 100644 --- a/src/LifeCycleCORBA/Makefile.in +++ b/src/LifeCycleCORBA/Makefile.in @@ -43,7 +43,7 @@ EXPORT_PYSCRIPTS = Launchers.py LIB = libSalomeLifeCycleCORBA.la LIB_SRC = SALOME_LifeCycleCORBA.cxx Launchers.cxx LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \ - SALOME_ModuleCatalog.idl SALOME_ContainerManager.idl + SALOME_ModuleCatalog.idl SALOME_ContainerManager.idl SALOME_Exception.idl # Executables targets BIN = TestLifeCycleCORBA diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 0efb425e5..e378550ad 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -2,7 +2,7 @@ // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either @@ -48,13 +48,14 @@ #include "SALOME_NamingService.hxx" using namespace std; -IncompatibleComponent::IncompatibleComponent( void ): SALOME_Exception( "IncompatibleComponent" ) +IncompatibleComponent::IncompatibleComponent( void ): + SALOME_Exception( "IncompatibleComponent" ) { - ; } -IncompatibleComponent::IncompatibleComponent( const IncompatibleComponent &ex ): SALOME_Exception( ex ) + +IncompatibleComponent::IncompatibleComponent(const IncompatibleComponent &ex): + SALOME_Exception( ex ) { - ; } //============================================================================= @@ -97,19 +98,103 @@ SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA() { } +//============================================================================= +/*! Public - + * Find and aready existing and registered component instance. + * \param params machine parameters like type or name... + * \param componentName the name of component class + * \param studyId default = 0 : multistudy instance + * \return a CORBA reference of the component instance, or _nil if not found + */ +//============================================================================= + Engines::Component_ptr -SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& params, - const char *componentName, - int studyId) +SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId) { - if (! isKnownComponentClass(componentName)) return Engines::Component::_nil(); + if (! isKnownComponentClass(componentName)) + return Engines::Component::_nil(); - Engines::MachineList_var listOfMachine=_ContManager->GetFittingResources(params,componentName); - Engines::Component_ptr ret=FindComponent(params,componentName,listOfMachine); - if(CORBA::is_nil(ret)) - return LoadComponent(params,componentName,listOfMachine); - else - return ret; + Engines::MachineList_var listOfMachines = + _ContManager->GetFittingResources(params, componentName); + + Engines::Component_var compo = _FindComponent(params, + componentName, + studyId, + listOfMachines); + + return compo._retn(); +} + +//============================================================================= +/*! Public - + * Load a component instance on a container defined by machine parameters + * \param params machine parameters like type or name... + * \param componentName the name of component class + * \param studyId default = 0 : multistudy instance + * \return a CORBA reference of the component instance, or _nil if problem + */ +//============================================================================= + +Engines::Component_ptr +SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId) +{ + // --- Check if Component Name is known in ModuleCatalog + + if (! isKnownComponentClass(componentName)) + return Engines::Component::_nil(); + + Engines::MachineList_var listOfMachines = + _ContManager->GetFittingResources(params, componentName); + + Engines::Component_var compo = _LoadComponent(params, + componentName, + studyId, + listOfMachines); + + return compo._retn(); +} + +//============================================================================= +/*! Public - + * Find and aready existing and registered component instance or load a new + * component instance on a container defined by machine parameters. + * \param params machine parameters like type or name... + * \param componentName the name of component class + * \param studyId default = 0 : multistudy instance + * \return a CORBA reference of the component instance, or _nil if problem + */ +//============================================================================= + +Engines::Component_ptr +SALOME_LifeCycleCORBA:: +FindOrLoad_Component(const Engines::MachineParameters& params, + const char *componentName, + int studyId) +{ + // --- Check if Component Name is known in ModuleCatalog + + if (! isKnownComponentClass(componentName)) + return Engines::Component::_nil(); + + Engines::MachineList_var listOfMachines = + _ContManager->GetFittingResources(params,componentName); + + Engines::Component_var compo = _FindComponent(params, + componentName, + studyId, + listOfMachines); + + if(CORBA::is_nil(compo)) + compo = _LoadComponent(params, + componentName, + studyId, + listOfMachines); + + return compo._retn(); } //============================================================================= @@ -117,11 +202,8 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& pa * Find and aready existing and registered component instance or load a new * component instance on a container defined by name * \param containerName the name of container, under one of the forms - * - 1 localhost/aContainer - * - 2 aContainer - * - 3 /machine/aContainer - * (not the same rules as FindContainer() method based on protected method - * ContainerName() -- MUST BE CORRECTED --) + * - 1 aContainer (local container) + * - 2 /machine/aContainer (container on hostnme = machine) * \param componentName the name of component class * \return a CORBA reference of the component instance, or _nil if problem */ @@ -131,25 +213,39 @@ Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, const char *componentName) { - // Check if Component Name is known - if (! isKnownComponentClass(componentName)) return Engines::Component::_nil(); + // --- Check if Component Name is known in ModuleCatalog + + if (! isKnownComponentClass(componentName)) + return Engines::Component::_nil(); + + // --- Check if containerName contains machine name (if yes: rg>0) - // Chack if containerName contains machine name (if yes: rg>0) char *stContainer=strdup(containerName); string st2Container(stContainer); int rg=st2Container.find("/"); Engines::MachineParameters_var params=new Engines::MachineParameters; - if(rg<0) { - params->container_name=CORBA::string_dup(stContainer); - params->hostname=CORBA::string_dup(GetHostname().c_str()); - } - else { - stContainer[rg]='\0'; - params->container_name=CORBA::string_dup(stContainer+rg+1); - params->hostname=CORBA::string_dup(stContainer); - } + if (rg<0) + { + //containerName doesn't contain "/" => Local container + params->container_name=CORBA::string_dup(stContainer); + params->hostname=CORBA::string_dup(GetHostname().c_str()); + } + else + { + stContainer[rg]='\0'; + params->container_name=CORBA::string_dup(stContainer+rg+1); + params->hostname=CORBA::string_dup(stContainer); + } params->isMPI = false; + SCRUTE(params->container_name); + SCRUTE(params->hostname); + SCRUTE(params->OS); + SCRUTE(params->mem_mb); + SCRUTE(params->cpu_clock); + SCRUTE(params->nb_proc_per_node); + SCRUTE(params->nb_node); + SCRUTE(params->isMPI); free(stContainer); return FindOrLoad_Component(params,componentName); @@ -191,29 +287,28 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName) return false; } -bool SALOME_LifeCycleCORBA::isMpiContainer(const Engines::MachineParameters& params) throw(IncompatibleComponent) +//============================================================================= +/*! Public - + * Not so complex... useful ? + */ +//============================================================================= + +bool +SALOME_LifeCycleCORBA::isMpiContainer(const Engines::MachineParameters& params) + throw(IncompatibleComponent) { -// MESSAGE(params.container_name) -// if( strstr(params.container_name,"MPI") ){ -// if( !params.isMPI ){ -// cerr << "IncompatibleComponent" << endl; -// throw IncompatibleComponent(); -// } -// return true; -// } -// else{ -// if( params.isMPI ){ -// cerr << "IncompatibleComponent" << endl; -// throw IncompatibleComponent(); -// } -// return false; -// } if( params.isMPI ) return true; else return false; } +//============================================================================= +/*! Public - + * \return a number of processors not 0, only for MPI containers + */ +//============================================================================= + int SALOME_LifeCycleCORBA::NbProc(const Engines::MachineParameters& params) { if( !isMpiContainer(params) ) @@ -228,52 +323,103 @@ int SALOME_LifeCycleCORBA::NbProc(const Engines::MachineParameters& params) return params.nb_node * params.nb_proc_per_node; } +//============================================================================= +/*! Protected - + * Find and aready existing and registered component instance. + * \param params machine parameters like type or name... + * \param componentName the name of component class + * \param studyId default = 0 : multistudy instance + * \param listOfMachines list of machine address + * \return a CORBA reference of the component instance, or _nil if not found + * - build a list of machines on which an instance of the component is running, + * - find the best machine among the list + */ +//============================================================================= + Engines::Component_ptr -SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, - const char *componentName, - const Engines::MachineList& listOfMachines) +SALOME_LifeCycleCORBA:: +_FindComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId, + const Engines::MachineList& listOfMachines) { + // --- build the list of machines on which the component is already running + const char *containerName = params.container_name; int nbproc = NbProc(params); + MESSAGE("_FindComponent, required " << containerName << + " " << componentName << " " << nbproc); - if (! isKnownComponentClass(componentName)) return Engines::Component::_nil(); + Engines::MachineList_var machinesOK = new Engines::MachineList; - // find list of machines which have component - Engines::MachineList_var machinesOK=new Engines::MachineList; - unsigned int lghtOfmachinesOK=0; + unsigned int lghtOfmachinesOK = 0; machinesOK->length(listOfMachines.length()); - for(unsigned int i=0;iResolveComponent(currentMachine,containerName,componentName,nbproc); - if(!CORBA::is_nil(obj)) - machinesOK[lghtOfmachinesOK++]=CORBA::string_dup(currentMachine); - } - - // find the best machine among the list which have component - if(lghtOfmachinesOK!=0) { - machinesOK->length(lghtOfmachinesOK); - CORBA::String_var bestMachine=_ContManager->FindBest(machinesOK); - CORBA::Object_var obj = _NS->ResolveComponent(bestMachine,containerName,componentName,nbproc); - return Engines::Component::_narrow(obj); - } + + for(unsigned int i=0; iResolveComponent(currentMachine, + containerName, + componentName, + nbproc); + if (!CORBA::is_nil(obj)) + machinesOK[lghtOfmachinesOK++] = CORBA::string_dup(currentMachine); + } + + // --- find the best machine among the list + + if(lghtOfmachinesOK != 0) + { + machinesOK->length(lghtOfmachinesOK); + CORBA::String_var bestMachine = _ContManager->FindBest(machinesOK); + CORBA::Object_var obj = _NS->ResolveComponent(bestMachine, + containerName, + componentName, + nbproc); + return Engines::Component::_narrow(obj); + } else return Engines::Component::_nil(); } +//============================================================================= +/*! Protected - + * Load a component instance. + * \param params machine parameters like type or name... + * \param componentName the name of component class + * \param studyId default = 0 : multistudy instance + * \param listOfMachines list of machine address + * \return a CORBA reference of the component instance, or _nil if problem + * - Finds a container in the list of machine or start one. + * - Try to load the component library in the container, + * - then create an instance of the component. + */ +//============================================================================= + Engines::Component_ptr -SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, - const char *componentName, - const Engines::MachineList& listOfMachines) +SALOME_LifeCycleCORBA:: +_LoadComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId, + const Engines::MachineList& listOfMachines) { - Engines::Container_var cont=_ContManager->FindOrStartContainer(params,listOfMachines); + const char *containerName = params.container_name; + int nbproc = NbProc(params); + + MESSAGE("_LoadComponent, required " << containerName << + " " << componentName << " " << nbproc); + + Engines::Container_var cont = + _ContManager->FindOrStartContainer(params, + listOfMachines); if (CORBA::is_nil(cont)) return Engines::Component::_nil(); bool isLoadable = cont->load_component_Library(componentName); if (!isLoadable) return Engines::Component::_nil(); Engines::Component_var myInstance = - cont->create_component_instance(componentName, 0); + cont->create_component_instance(componentName, studyId); return myInstance._retn(); } diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index f5d55912b..8ed343c3c 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -60,9 +60,9 @@ class SALOME_NamingService; class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception { public : - IncompatibleComponent( void ); - IncompatibleComponent( const IncompatibleComponent &ex ); -} ; + IncompatibleComponent(void); + IncompatibleComponent(const IncompatibleComponent &ex); +}; class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA { @@ -72,13 +72,13 @@ public: Engines::Component_ptr FindComponent(const Engines::MachineParameters& params, - const char *componentName, - const Engines::MachineList& listOfMachines); + const char *componentName, + int studyId=0); - Engines::Component_ptr - LoadComponent(const Engines::MachineParameters& params, - const char *componentName, - const Engines::MachineList& listOfMachines); + Engines::Component_ptr + LoadComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId=0); Engines::Component_ptr FindOrLoad_Component(const Engines::MachineParameters& params, @@ -90,10 +90,11 @@ public: const char *componentName); // for compatibility bool isKnownComponentClass(const char *componentName); - bool isMpiContainer(const Engines::MachineParameters& params) throw(IncompatibleComponent); + + bool isMpiContainer(const Engines::MachineParameters& params) + throw(IncompatibleComponent); + int NbProc(const Engines::MachineParameters& params); - //! Establish if a component called "componentName" in a container called "containerName" exists among the list of resources - //! in "listOfMachines". This method uses Naming Service to find the component. protected: @@ -102,15 +103,16 @@ protected: * exists among the list of resources in "listOfMachines". * This method uses Naming Service to find the component. */ - Engines::Component_ptr - _FindComponent(const char *containerName, + _FindComponent(const Engines::MachineParameters& params, const char *componentName, + int studyId, const Engines::MachineList& listOfMachines); Engines::Component_ptr - _LoadComponent(const char *containerName, + _LoadComponent(const Engines::MachineParameters& params, const char *componentName, + int studyId, const Engines::MachineList& listOfMachines); SALOME_NamingService *_NS; @@ -119,4 +121,3 @@ protected: } ; #endif - diff --git a/src/LifeCycleCORBA_SWIG/Makefile.in b/src/LifeCycleCORBA_SWIG/Makefile.in index 48fa79e78..20b6d6459 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.in +++ b/src/LifeCycleCORBA_SWIG/Makefile.in @@ -37,7 +37,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl LIB = libSALOME_LifeCycleCORBAcmodule.la LIB_SRC = -LIB_CLIENT_IDL = SALOME_Component.idl SALOME_ContainerManager.idl +LIB_CLIENT_IDL = SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Exception.idl SWIG_DEF = libSALOME_LifeCycleCORBA.i diff --git a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py index 479bc930a..147e072d4 100644 --- a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py @@ -9,10 +9,10 @@ lcc = LifeCycleCORBA.LifeCycleCORBA() #comp.Coucou(1) param={} -param['hostname']='cli76ce' +param['hostname']='cli76cc' param['container_name']='myContainer' -smesh=lcc.FindOrLoad_Component(param,'SMESH') +smesh=lcc.FindOrLoad_Component(param,'PYHELLO') container=lcc.FindContainer('myContainer') -engine=lcc.FindComponent(param,'SMESH') +engine=lcc.FindComponent(param,'HELLO') geom=lcc.LoadComponent(param,'GEOM') diff --git a/src/ModuleCatalog/Makefile.in b/src/ModuleCatalog/Makefile.in index 91d31f1d2..0fd517465 100644 --- a/src/ModuleCatalog/Makefile.in +++ b/src/ModuleCatalog/Makefile.in @@ -58,7 +58,7 @@ CXXFLAGS+=-ftemplate-depth-32 # in fact client is a test ! So it may go away BIN ! BIN = SALOME_ModuleCatalog_Server SALOME_ModuleCatalog_Client BIN_SRC = -BIN_SERVER_IDL = SALOME_ModuleCatalog.idl +BIN_SERVER_IDL = SALOME_ModuleCatalog.idl SALOME_Exception.idl CPPFLAGS+= $(QT_MT_INCLUDES) LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lSALOMELocalTrace -lSALOMETraceCollector -lOpUtil diff --git a/src/NamingService/Makefile.in b/src/NamingService/Makefile.in index 2951501b1..13281780c 100644 --- a/src/NamingService/Makefile.in +++ b/src/NamingService/Makefile.in @@ -48,6 +48,7 @@ LIB_SRC = \ SALOME_NamingService.cxx \ ServiceUnreachable.cxx \ NamingService_WaitForServerReadiness.cxx +LIB_SERVER_IDL = SALOME_Exception.idl LDFLAGS+= -lOpUtil diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index b84b8daf0..0692af495 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -438,6 +438,8 @@ CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path) CORBA::Object_ptr SALOME_NamingService::ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc) { + MESSAGE("ResolveComponent"); + Utils_Locker lock(&_myMutex); string name="/Containers/"; name += hostname; diff --git a/src/Registry/Makefile.in b/src/Registry/Makefile.in index 789b2ddf9..05c7defa5 100644 --- a/src/Registry/Makefile.in +++ b/src/Registry/Makefile.in @@ -46,7 +46,7 @@ LIB = libRegistry.la LIB_SRC = \ RegistryConnexion.cxx \ RegistryService.cxx -LIB_CLIENT_IDL = SALOME_Registry.idl +LIB_CLIENT_IDL = SALOME_Registry.idl SALOME_Exception.idl # Executables targets BIN = SALOME_Registry_Server diff --git a/src/ResourcesManager/Makefile.in b/src/ResourcesManager/Makefile.in index ac30999d7..750e933a6 100755 --- a/src/ResourcesManager/Makefile.in +++ b/src/ResourcesManager/Makefile.in @@ -53,7 +53,7 @@ LIB_SRC = \ # in fact client is a test ! So it may go away BIN ! #BIN = test_rc2 #SALOME_RessourcesCatalog_Server SALOME_RessourcesCatalog_Client test -LIB_CLIENT_IDL = SALOME_ContainerManager.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_ContainerManager.idl SALOME_Component.idl SALOME_Exception.idl BIN_SRC = BIN_SERVER_IDL = SALOME_ContainerManager.idl diff --git a/src/ResourcesManager/SALOME_LoadRateManager.cxx b/src/ResourcesManager/SALOME_LoadRateManager.cxx index ab5aa4d88..be27ac8e7 100644 --- a/src/ResourcesManager/SALOME_LoadRateManager.cxx +++ b/src/ResourcesManager/SALOME_LoadRateManager.cxx @@ -1,9 +1,12 @@ #include "SALOME_LoadRateManager.hxx" +#include using namespace std; string SALOME_LoadRateManager::FindBest(const Engines::MachineList& hosts) { // for the moment then "maui" will be used for dynamic selection ... + cout << "SALOME_LoadRateManager::FindBest" << endl; + if(hosts.length() == 0)return string(""); return string(hosts[0]); } diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index d63c122c7..7f01d24d8 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -52,16 +52,24 @@ vector SALOME_ResourcesManager::GetFittingResources(const Engines::Machi //To be sure that we search in a correct list. ParseXmlFile(); const char *hostname=(const char *)params.hostname; + MESSAGE("ResourcesManager::GetFittingResources" << hostname << GetHostname().c_str()); if(hostname[0]!='\0') { - if( strcmp(hostname,"localhost") == 0 || strcmp(hostname,GetHostname().c_str()) == 0 ) + MESSAGE("ResourcesManager::GetFittingResources : hostname specified" ); + cout << "hostname specified" << endl; + if( strcmp(hostname,"localhost") == 0 || strcmp(hostname,GetHostname().c_str()) == 0 ){ + MESSAGE("ResourcesManager::GetFittingResources : localhost" ); ret.push_back(GetHostname().c_str()); - else if(_resourcesList.find(hostname)!=_resourcesList.end()) + MESSAGE("ResourcesManager::GetFittingResources : " << ret.size()); + } + else if(_resourcesList.find(hostname)!=_resourcesList.end()){ // params.hostame is in the list of resources so return it. ret.push_back(hostname); - else + } else{ //user specified an unknown hostame so notify to him. + MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception"); throw SALOME_Exception("unknown host"); + } } else // Search for available resources sorted by priority @@ -82,6 +90,7 @@ vector SALOME_ResourcesManager::GetFittingResources(const Engines::Machi for(list::iterator iter2=li.begin();iter2!=li.end();iter2++) ret[i++]=(*iter2)._hostName; } + MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size()); return ret; } @@ -401,21 +410,28 @@ void SALOME_ResourcesManager::KeepOnlyResourcesWithModule(vector& hosts, void SALOME_ResourcesManager::AddOmninamesParams(string& command) const { - string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ; - ifstream omniORBfile( omniORBcfg.c_str() ) ; - char ORBInitRef[11] ; - char egal[3] ; - char nameservice[132] ; - omniORBfile >> ORBInitRef ; - command += "ORBInitRef " ; - omniORBfile >> egal ; - omniORBfile >> nameservice ; - omniORBfile.close() ; - char * bsn = strchr( nameservice , '\n' ) ; - if ( bsn ) { - bsn[ 0 ] = '\0' ; - } - command += nameservice ; + // If env variable OMNIORB_CONFIG is not defined or the file is more complex than one line + // does not work + // Even if we use it we have to check if env variable exists + //string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ; + //ifstream omniORBfile( omniORBcfg.c_str() ) ; + //char ORBInitRef[11] ; + //char egal[3] ; + //char nameservice[132] ; + //omniORBfile >> ORBInitRef ; + //command += "ORBInitRef " ; + //omniORBfile >> egal ; + //omniORBfile >> nameservice ; + //omniORBfile.close() ; + //char * bsn = strchr( nameservice , '\n' ) ; + //if ( bsn ) { + //bsn[ 0 ] = '\0' ; + //} + //command += nameservice ; + + char *iorstr = _NS->getIORaddr(); + command += "ORBInitRef NameService="; + command += iorstr; } void SALOME_ResourcesManager::AddOmninamesParams(ofstream& fileStream) const diff --git a/src/RessourcesCatalog/Makefile.in b/src/RessourcesCatalog/Makefile.in index 74e66a135..0122db2a2 100644 --- a/src/RessourcesCatalog/Makefile.in +++ b/src/RessourcesCatalog/Makefile.in @@ -50,7 +50,7 @@ LIB_SRC = \ # in fact client is a test ! So it may go away BIN ! BIN = SALOME_RessourcesCatalog_Server SALOME_RessourcesCatalog_Client BIN_SRC = -BIN_SERVER_IDL = SALOME_RessourcesCatalog.idl +BIN_SERVER_IDL = SALOME_RessourcesCatalog.idl SALOME_Exception.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= diff --git a/src/TestContainer/Makefile.in b/src/TestContainer/Makefile.in index a1183af7a..39c69251b 100644 --- a/src/TestContainer/Makefile.in +++ b/src/TestContainer/Makefile.in @@ -39,7 +39,7 @@ EXPORT_PYSCRIPTS = SALOME_TestComponentPy.py TestComponentPy.py LIB = libSalomeTestComponentEngine.la LIB_SRC = SALOME_TestComponent_i.cxx -LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl +LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl SALOME_Exception.idl # Executables targets BIN = TestContainer TestLogger -- 2.39.2