From d641b164ecdfeb5c78643ac5d3d54abb2a88e8e5 Mon Sep 17 00:00:00 2001 From: rahuel Date: Mon, 1 Mar 2004 09:40:22 +0000 Subject: [PATCH] Use of ContainersManager and ResourcesManager --- Makefile.in | 2 + bin/runSalome | 3 +- bin/runSalome.py | 65 ++- src/Container/Container_i.cxx | 137 ++--- src/Container/SALOME_ContainerPy.py | 21 +- src/Container/SALOME_Container_i.hxx | 7 +- src/ContainersManager/ContainersManager_i.cxx | 519 ++++++++---------- src/ContainersManager/ContainersManager_i.hxx | 39 +- .../TestContainersManager.py | 169 +++--- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 41 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 11 +- src/OCCViewer/Makefile.in | 3 +- src/Plot2d/Makefile.in | 3 +- .../ResourcesManager_Impl.cxx | 43 +- .../ResourcesManager_Impl.hxx | 4 +- src/SALOMEDS/Makefile.in | 4 +- src/SALOMEGUI/Makefile.in | 3 +- src/SALOME_PY/Makefile.in | 4 +- src/SALOME_PYQT/Makefile.in | 4 +- src/SUPERVGraph/Makefile.in | 3 +- src/Session/Makefile.in | 2 +- src/TOOLSGUI/Makefile.in | 4 +- src/VTKViewer/Makefile.in | 3 +- 23 files changed, 555 insertions(+), 539 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2aeee3a55..ece129801 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,6 +22,7 @@ cascade.png \ CatalogDataType.xml \ KERNELCatalog.xml \ CatalogRessources.xml \ +ResourcesCatalog.xml \ close.png \ config \ default.png \ @@ -90,6 +91,7 @@ runIDLparser \ VERSION \ orbmodule.py \ runSalome.py \ +startContainer.py \ killSalome.py \ runSalome \ runNS.sh diff --git a/bin/runSalome b/bin/runSalome index 3a3d0e2d2..a2bbfff48 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -1,6 +1,7 @@ #!/bin/sh -python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=cpp,python --killall +python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,VISU,SUPERV --xterm --containers=cpp,python --killall +#python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=cpp,python --killall #python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --logger --xterm #python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --modules=GEOM,SMESH,VISU,SUPERV,MED #python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --help diff --git a/bin/runSalome.py b/bin/runSalome.py index b9ccbd48a..1f267ed6f 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -10,6 +10,7 @@ usage="""USAGE: runSalome.py [options] --modules=module1,module2,... : où modulen est le nom d'un module Salome à charger dans le catalogue --containers=cpp,python,superv: lancement des containers cpp, python et de supervision --killall : arrêt des serveurs de salome +--startcontainer=ContainerName,ContainerCpp,NSHostName,NSHostPort : demarrage d'un container La variable d'environnement _ROOT_DIR doit etre préalablement positionnée (modulen doit etre en majuscule). @@ -44,7 +45,7 @@ def message(code, msg=''): import sys,os,string,glob,time,signal,pickle,getopt init_time=os.times() -opts, args=getopt.getopt(sys.argv[1:], 'hmglxck:', ['help','modules=','gui','logger','xterm','containers=','killall']) +opts, args=getopt.getopt(sys.argv[1:], 'hmglxcks:', ['help','modules=','gui','logger','xterm','containers=','killall']) modules_root_dir={} process_id={} liste_modules={} @@ -103,6 +104,7 @@ try: killSalome() process_id={} os.remove(filedict) + except getopt.error, msg: print usage @@ -179,14 +181,24 @@ class SalomeDSServer(Server): class RegistryServer(Server): CMD=['SALOME_Registry_Server', '--salome_session','theSession'] -class ContainerCPPServer(Server): - CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost'] +class ResourcesServer(Server): + CMD=['ResourcesManager_Server','-common',os.getenv('KERNEL_ROOT_DIR')+'/share/salome/resources/ResourcesCatalog.xml','-ORBInitRef','NameService=corbaname::localhost'] -class ContainerPYServer(Server): - CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost'] +class ContainersServer(Server): + CMD=['ContainersManager_Server','-ORBInitRef','NameService=corbaname::localhost'] -class ContainerSUPERVServer(Server): - CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost'] +class ContainerServer( Server) : + def Params( self , ContainerName , ContainerType ) : + self.CMD=['startContainer.py',str(with_xterm),'localhost',ContainerName,ContainerType,'localhost','0'] + +#class ContainerCPPServer(Server): + #CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost'] + +#class ContainerPYServer(Server): + #CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost'] + +#class ContainerSUPERVServer(Server): + #CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost'] class LoggerServer(Server): CMD=['SALOME_Logger_Server', 'logger.log'] @@ -397,11 +409,40 @@ def startSalome(): computerSplitName = theComputer.split('.') theComputer = computerSplitName[0] + # + # Lancement Resources Server + # + + ResourcesServer().run() + + # + # Attente de la disponibilité du ResourcesServer dans le Naming Service + # + + import Resources + session=clt.waitNS("/Kernel/ResourcesManager",Resources.Manager) + + # + # Lancement Containers Server + # + + ContainersServer().run() + + # + # Attente de la disponibilité du ContainersManager dans le Naming Service + # + + import Containers + import Engines + MyContainersMgr = clt.waitNS("/Kernel/ContainersManager",Containers.Manager) + # # Lancement Container C++ local # if with_container_cpp: - ContainerCPPServer().run() + FactoryServer = ContainerServer() + FactoryServer.Params( 'FactoryServer' , 'Engines.Cpp' ) + FactoryServer.run() # # Attente de la disponibilité du Container C++ local dans le Naming Service @@ -414,7 +455,9 @@ def startSalome(): # if with_container_python: - ContainerPYServer().run() + FactoryServerPy = ContainerServer() + FactoryServerPy.Params( 'FactoryServerPy' , 'Engines.Python' ) + FactoryServerPy.run() # # Attente de la disponibilité du Container Python local dans le Naming Service @@ -428,7 +471,9 @@ def startSalome(): # Lancement Container Supervision local # - ContainerSUPERVServer().run() + SuperVisionContainer = ContainerServer() + SuperVisionContainer.Params( 'SuperVisionContainer' , 'Engines.Cpp' ) + SuperVisionContainer.run() # # Attente de la disponibilité du Container Supervision local dans le Naming Service diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 05f7c84f8..786d1f982 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -164,6 +164,12 @@ void Engines_Container_i::ping() MESSAGE("Engines_Container_i::ping() pid "<< getpid()); } +Engines::ContainerType Engines_Container_i::type() +{ + MESSAGE( "Engines_Container_i::type() "<< Engines::Cpp ); + return Engines::Cpp ; +} + bool Engines_Container_i::Kill_impl() { MESSAGE("Engines_Container_i::Kill() pid "<< getpid() << " containerName " << _containerName.c_str() << " machineName " @@ -171,8 +177,8 @@ bool Engines_Container_i::Kill_impl() { exit( 0 ) ; } -Engines::Container_ptr Engines_Container_i::start_impl( - const char* ContainerName ) { +Engines::Container_ptr Engines_Container_i::start_impl( const char* ContainerName , + const Engines::ContainerType aContainerType ) { MESSAGE("start_impl argc " << _argc << " ContainerName " << ContainerName << hex << this << dec) ; _numInstanceMutex.lock() ; // lock on the instance number @@ -209,87 +215,64 @@ Engines::Container_ptr Engines_Container_i::start_impl( MESSAGE(" argv" << i << " " << _argv[ i ]) ; i++ ; } -// string shstr( "rsh -n " ) ; -// shstr += machineName() ; -// shstr += " " ; -// shstr += _argv[ 0 ] ; -// string shstr( _argv[ 0 ] ) ; - string shstr( "./runSession SALOME_Container " ) ; - shstr += ContainerName ; - if ( _argc == 4 ) { - shstr += " " ; - shstr += _argv[ 2 ] ; - shstr += " " ; - shstr += _argv[ 3 ] ; - } - shstr += " > /tmp/" ; - shstr += ContainerName ; - shstr += ".log 2>&1 &" ; - MESSAGE("system(" << shstr << ")") ; - int status = system( shstr.c_str() ) ; - if (status == -1) { - INFOS("Engines_Container_i::start_impl runSession(SALOME_Container) failed (system command status -1)") ; - } - else if (status == 217) { - INFOS("Engines_Container_i::start_impl runSession(SALOME_Container) failed (system command status 217)") ; - } - INFOS(machineName() << " Engines_Container_i::start_impl runSession(SALOME_Container) done"); -#if 0 - pid_t pid = fork() ; - if ( pid == 0 ) { - string anExe( _argv[ 0 ] ) ; - anExe += "runSession" ; - char * args[ 6 ] ; - args[ 0 ] = "runSession" ; - args[ 1 ] = "SALOME_Container" ; - args[ 2 ] = strdup( ContainerName ) ; - args[ 3 ] = strdup( _argv[ 2 ] ) ; - args[ 4 ] = strdup( _argv[ 3 ] ) ; - args[ 5 ] = NULL ; - MESSAGE("execl(" << anExe.c_str() << " , " << args[ 0 ] << " , " - << args[ 1 ] << " , " << args[ 2 ] << " , " << args[ 3 ] - << " , " << args[ 4 ] << ")") ; - int status = execv( anExe.c_str() , args ) ; + string shstr ; + if ( aContainerType != Engines::Undefined ) { + if ( aContainerType == Engines::Cpp ) { + shstr = "SALOME_Container " ; + } + else if ( aContainerType == Engines::Python ) { + shstr = "SALOME_ContainerPy.py " ; + } + shstr += ContainerName ; + if ( _argc == 4 ) { + shstr += " " ; + shstr += _argv[ 2 ] ; + shstr += " " ; + shstr += _argv[ 3 ] ; + } + shstr += " > /tmp/" ; + shstr += ContainerName ; + shstr += ".log 2>&1 &" ; + MESSAGE("system(" << shstr << ")") ; + int status = system( shstr.c_str() ) ; if (status == -1) { - INFOS("Engines_Container_i::start_impl execl failed (system command status -1)") ; - perror( "Engines_Container_i::start_impl execl error ") ; + INFOS("Engines_Container_i::start_impl runSession(SALOME_Container) failed (system command status -1)") ; } - else { - INFOS(machineName() << " Engines_Container_i::start_impl execl done"); + else if (status == 217) { + INFOS("Engines_Container_i::start_impl runSession(SALOME_Container) failed (system command status 217)") ; } - exit(0) ; - } -#endif - - obj = Engines::Container::_nil() ; - try { - string cont("/Containers/"); - cont += machineName() ; - cont += "/" ; - cont += ContainerName; - nilvar = true ; - int count = 20 ; - while ( nilvar && count >= 0) { - sleep( 1 ) ; - obj = _NS->Resolve(cont.c_str()); - nilvar = CORBA::is_nil( obj ) ; - if ( nilvar ) { - INFOS(count << ". " << machineName() - << " start_impl unknown container " << cont.c_str()); - count -= 1 ; + INFOS(machineName() << " Engines_Container_i::start_impl runSession(SALOME_Container) done"); + + obj = Engines::Container::_nil() ; + try { + string cont("/Containers/"); + cont += machineName() ; + cont += "/" ; + cont += ContainerName; + nilvar = true ; + int count = 20 ; + while ( nilvar && count >= 0) { + sleep( 1 ) ; + obj = _NS->Resolve(cont.c_str()); + nilvar = CORBA::is_nil( obj ) ; + if ( nilvar ) { + INFOS(count << ". " << machineName() + << " start_impl unknown container " << cont.c_str()); + count -= 1 ; + } } + _numInstanceMutex.unlock() ; + if ( !nilvar ) { + MESSAGE("start_impl container found after runSession(SALOME_Container)") ; + } + return Engines::Container::_narrow(obj); } - _numInstanceMutex.unlock() ; - if ( !nilvar ) { - MESSAGE("start_impl container found after runSession(SALOME_Container)") ; + catch (ServiceUnreachable&) { + INFOS(machineName() << "Caught exception: Naming Service Unreachable"); + } + catch (...) { + INFOS(machineName() << "Caught unknown exception."); } - return Engines::Container::_narrow(obj); - } - catch (ServiceUnreachable&) { - INFOS(machineName() << "Caught exception: Naming Service Unreachable"); - } - catch (...) { - INFOS(machineName() << "Caught unknown exception."); } _numInstanceMutex.unlock() ; MESSAGE("start_impl container not found after runSession(SALOME_Container)") ; diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 6444ef148..42ade5739 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -59,15 +59,17 @@ class SALOME_ContainerPy_i (Engines__POA.Container): self._containerName = containerName myMachine=string.split(os.getenv( "HOSTNAME" ),'.') + self._machineName = myMachine[0] naming_service = SALOME_NamingServicePy_i(self._orb) self._naming_service = naming_service Container_path = "/Containers/" + myMachine[0] + "/" + self._containerName + self._Name = Container_path MESSAGE( str(Container_path) ) naming_service.Register(self._this(), Container_path) #------------------------------------------------------------------------- - def start_impl(self, ContainerName): + def start_impl( self , ContainerName , ContainerType ) : MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) ) myMachine=string.split(os.getenv( "HOSTNAME" ),'.') theContainer = "/Containers/" + myMachine[0] + "/" + ContainerName @@ -83,11 +85,12 @@ class SALOME_ContainerPy_i (Engines__POA.Container): if container is None: MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(containerName) + ".object exists but is not a Container" ) else : - MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found without runSession" ) + MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found" ) return container - #shstr = os.getenv( "PWD" ) + "/" - #shstr += "runSession ./SALOME_ContainerPy.py " - shstr = "runSession SALOME_ContainerPy.py " + if ContainerType == Engines.Cpp : + shstr = "SALOME_Container " + else : + shstr = "SALOME_ContainerPy.py " shstr += ContainerName # mpv: fix for SAL4731 - allways create new file to write log of server @@ -161,14 +164,20 @@ class SALOME_ContainerPy_i (Engines__POA.Container): #------------------------------------------------------------------------- + def type(self): + MESSAGE( "SALOME_ContainerPy_i::type" ) + return Engines.Python + + #------------------------------------------------------------------------- + def _get_name(self): MESSAGE( "SALOME_ContainerPy_i::_get_name" ) + return self._Name #------------------------------------------------------------------------- def _get_machineName(self): MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" ) - self._machineName = "localhost" return self._machineName #============================================================================= diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index ee6e460d5..9ddbcc8c0 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -59,16 +59,17 @@ public: virtual ~Engines_Container_i(); - Engines::Container_ptr start_impl(const char* ContainerName); + Engines::Container_ptr start_impl( const char* ContainerName , const Engines::ContainerType ) ; - Engines::Component_ptr load_impl(const char* nameToRegister, - const char* componentName); + Engines::Component_ptr load_impl( const char* nameToRegister , + const char* componentName ) ; void remove_impl(Engines::Component_ptr component_i); void finalize_removal(); char* name(); char* machineName(); void ping(); + Engines::ContainerType type(); bool Kill_impl() ; protected: diff --git a/src/ContainersManager/ContainersManager_i.cxx b/src/ContainersManager/ContainersManager_i.cxx index c441c2a8b..168118ea2 100644 --- a/src/ContainersManager/ContainersManager_i.cxx +++ b/src/ContainersManager/ContainersManager_i.cxx @@ -94,6 +94,10 @@ Manager_i::Manager_i( CORBA::ORB_ptr orb , pthread_mutex_init( &_MutexManager , NULL ) ; + _ListOfComputers = new Resources::ListOfComputers() ; + _ListOfContainers = new Engines::ListOfContainers() ; + _ListOfComponents = new Engines::ListOfComponents() ; + } Manager_i::~Manager_i() { @@ -121,285 +125,199 @@ bool Manager_i::ping() { return true ; } -Engines::Container_ptr Manager_i::FindContainer( const Containers::MachineParameters & MyParams ) { - MESSAGE( "Manager_i::FindContainer starting" ) ; - CORBA::Object_var ContainerObject = CORBA::Object::_nil() ; - _EnginesContainer = Engines::Container::_nil() ; - string _ContainerName = string( "/Containers/" ) ; - Containers::MachineParameters & myParams = (Containers::MachineParameters & ) MyParams ; +Engines::Container_ptr Manager_i::FindContainer( const Containers::MachineParameters & myParams ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { - myParams.HostName = GetHostname().c_str() ; - } - _ContainerName += myParams.HostName ; - if ( strlen( MyParams.ContainerName ) == 0 ) { - MESSAGE( "Manager_i::FindContainer ContainerName " << _ContainerName.c_str() ) ; - if ( _NamingService->Change_Directory( _ContainerName.c_str() ) ) { - vector aListOfContainers = _NamingService->list_directory() ; - if ( aListOfContainers.size() ) { - _ContainerName += "/" ; - _ContainerName += aListOfContainers[ 0 ] ; - MESSAGE( "Manager_i::FindContainer ContainerName " << _ContainerName.c_str() ) ; - } - } - } - else { - _ContainerName += "/" ; - _ContainerName += MyParams.ContainerName ; - MESSAGE( "Manager_i::FindContainer ContainerName " << _ContainerName.c_str() ) ; - } - try { - MESSAGE( "Manager_i::FindContainer ContainerName " << _ContainerName.c_str() ) ; - ContainerObject = _NamingService->Resolve( _ContainerName.c_str() ) ; - if ( !CORBA::is_nil( ContainerObject ) ) { - _EnginesContainer = Engines::Container::_narrow( ContainerObject ) ; - MESSAGE( "Manager_i::FindContainer Container " << _ContainerName.c_str() << " is known ==> ping" ) ; - _EnginesContainer->ping() ; - } - else { - MESSAGE( "Manager_i::FindContainer Container " << _ContainerName.c_str() << " unknown" ) ; - } + MyParams.HostName = GetHostname().c_str() ; } - catch (ServiceUnreachable&) { - MESSAGE( "Caught exception: Naming Service Unreachable" ); + MESSAGE( "Manager_i::FindContainer " << MyParams.HostName << " " << MyParams.ContainerName ) ; + _ListOfContainers = FindContainers( MyParams ) ; + _EnginesContainer = Engines::Container::_nil() ; + if ( _ListOfContainers->length() ) { + _EnginesContainer = _ListOfContainers[ 0 ] ; + MESSAGE( "Manager_i::FindContainer --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() ) ; } - catch (...) { - MESSAGE( "Caught unknown exception." ); + else { + MESSAGE( "Manager_i::FindContainer --> Engines::Container::_nil" ) ; } - MESSAGE( "Manager_i::FindContainer ended" ) ; return Engines::Container::_duplicate( _EnginesContainer ) ; } -Engines::ListOfContainers * Manager_i::Containers( const Containers::MachineParameters & MyParams ) { - MESSAGE("Manager_i::Containers()") ; - Engines::ListOfContainers_var aListOfContainers = new Engines::ListOfContainers() ; - CORBA::Object_var ContainerObject = CORBA::Object::_nil() ; - anEnginesContainer = Engines::Container::_nil() ; - string aContainerName = string( "/Containers/" ) ; +Engines::ListOfContainers * Manager_i::FindContainers( const Containers::MachineParameters & myParams ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { - myParams.HostName = GetHostname().c_str() ; - } - if ( strlen( MyParams.HostName ) ) { // HostName - aContainerName += MyParams.HostName ; - if ( strlen( MyParams.ContainerName ) ) { // ContainerName - aContainerName += "/" ; - aContainerName += MyParams.ContainerName ; - ContainerObject = _NamingService->Resolve( aContainerName.c_str() ) ; - if ( !CORBA::is_nil( ContainerObject ) ) { - anEnginesContainer = Engines::Container::_narrow( ContainerObject ) ; - int size = aListOfContainers.length() ; - aListOfContainers.length( size + 1 ) ; - aListOfContainers[ size ] = anEnginesContainer ; + MyParams.HostName = GetHostname().c_str() ; + } + if ( MyParams.ContainerType == Engines::Undefined ) { + MyParams.ContainerType = Engines::Cpp ; + } + _ListOfComputers = _ResourcesManager->GetComputers( MyParams ) ; + MESSAGE( "Manager_i::FindContainers " << MyParams.HostName << " " << MyParams.ContainerName << " " + << _ListOfComputers->length() << " computers found" ) ; + _ListOfContainers = new Engines::ListOfContainers() ; + _ListOfContainers->length( 0 ) ; + int i ; + for ( i = 0 ; i < _ListOfComputers->length() ; i++ ) { + _FullHostName = string( "/Containers/" ) ; + _ResourcesComputer = _ListOfComputers[ i ] ; + _ComputerParameters = _ResourcesComputer->Parameters() ; + _FullHostName += _ComputerParameters->Alias ; + if ( strlen( MyParams.ContainerName ) ) { + _FullContainerName = _FullHostName + "/" + string( (char * ) MyParams.ContainerName ) ; + _ContainerObject = _NamingService->Resolve( _FullContainerName.c_str() ) ; + MESSAGE( "Manager_i::FindContainers NamingService->Resolve( " << _FullContainerName << ")" ) ; + if ( !CORBA::is_nil( _ContainerObject ) ) { + _EnginesContainer = Engines::Container::_narrow( _ContainerObject ) ; + if ( _EnginesContainer->type() == MyParams.ContainerType ) { + int size = _ListOfContainers->length() ; + _ListOfContainers->length( size + 1 ) ; + _ListOfContainers[ size ] = _EnginesContainer ; + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() ) ; + } + else { + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() << " # " + << MyParams.ContainerType ) ; + } + } + else { + MESSAGE( "Manager_i::FindContainers " << _FullContainerName << " unknown" ) ; } } - else { // Pas de ContainerName - if ( _NamingService->Change_Directory( _ContainerName.c_str() ) ) { + else { + if ( _NamingService->Change_Directory( _FullHostName.c_str() ) ) { vector theListOfContainers = _NamingService->list_directory() ; - int i ; - for ( i = 0 ; i < theListOfContainers->length() ; i++ ) { - string ContainersNames = aContainerName + "/" + theListOfContainers[ i ] ; - ContainerObject = _NamingService->Resolve( ContainersNames.c_str() ) ; - if ( !CORBA::is_nil( ContainerObject ) ) { - anEnginesContainer = Engines::Container::_narrow( ContainerObject ) ; - int size = aListOfContainers.length() ; - aListOfContainers.length( size + 1 ) ; - aListOfContainers[ size ] = anEnginesContainer ; + MESSAGE( "Manager_i::FindContainers " << theListOfContainers.size() << " containers found." ) ; + int j ; + for ( j = 0 ; j < theListOfContainers.size() ; j++ ) { + _FullContainerName = _FullHostName + "/" + theListOfContainers[ j ] ; + MESSAGE( "Manager_i::FindContainers " << j << " " << _FullContainerName ) ; + _ContainerObject = _NamingService->Resolve( _FullContainerName.c_str() ) ; + if ( !CORBA::is_nil( _ContainerObject ) ) { + _EnginesContainer = Engines::Container::_narrow( _ContainerObject ) ; + if ( _EnginesContainer->type() == MyParams.ContainerType ) { + int size = _ListOfContainers->length() ; + _ListOfContainers->length( size + 1 ) ; + _ListOfContainers[ size ] = _EnginesContainer ; + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() ) ; + } + else { + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() << " # " + << MyParams.ContainerType ) ; + _EnginesContainer = Engines::Container::_nil() ; + } + } + else { + MESSAGE( "Manager_i::FindContainers " << _FullContainerName << " unknown" ) ; } } } + } } - else { // Pas de HostName - if ( _NamingService->Change_Directory( _ContainerName.c_str() ) ) { - vector aListOfHosts = _NamingService->list_directory() ; - int j ; - for ( j = 0 ; j < aListOfHosts.size() ; j++ ) { - string HostsNames = aContainerName + aListOfHosts[ j ] ; - if ( strlen( MyParams.ContainerName ) ) { // ContainerName - HostsNames = HostsNames + "/" + MyParams.ContainerName ; - ContainerObject = _NamingService->Resolve( HostsNames.c_str() ) ; - if ( !CORBA::is_nil( ContainerObject ) ) { - anEnginesContainer = Engines::Container::_narrow( ContainerObject ) ; - int size = aListOfContainers.length() ; - aListOfContainers.length( size + 1 ) ; - aListOfContainers[ size ] = anEnginesContainer ; - } - } - else { // Pas de ContainerName - if ( _NamingService->Change_Directory( HostsNames.c_str() ) ) { - vector theListOfContainers = _NamingService->list_directory() ; - int k ; - for ( k = 0 ; k < aListOfContainers.size() ; k++ ) { - string ContainersNames = HostsNames + theListOfContainers[ k ] ; - ContainerObject = _NamingService->Resolve( HostsNames.c_str() ) ; - if ( !CORBA::is_nil( ContainerObject ) ) { - anEnginesContainer = Engines::Container::_narrow( ContainerObject ) ; - int size = aListOfContainers.length() ; - aListOfContainers.length( size + 1 ) ; - aListOfContainers[ size ] = anEnginesContainer ; - } - } - } - } - } - } - } - - aListOfContainers._retn() ; + return _ListOfContainers._retn() ; } -Engines::Container_ptr Manager_i::FindOrStartContainer( const Containers::MachineParameters & MyParams ) { +Engines::Container_ptr Manager_i::FindOrStartContainer( const Containers::MachineParameters & myParams ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } Engines::Container_var aContainer = Engines::Container::_nil() ; + MESSAGE( "Manager_i::FindOrStartContainer " << MyParams.HostName << " " << MyParams.ContainerName + << " " << MyParams.ContainerType << " " << MyParams.Os << " " << MyParams.Memory << " " + << MyParams.CpuClock << " " << MyParams.NbProc << " " << MyParams.NbNode << " " + << MyParams.NsHostName << " " << MyParams.NsPort ) ; MESSAGE( "MutexManager pthread_mutex_lock :" ) ; if ( pthread_mutex_lock( &_MutexManager ) ) { perror("MutexManager pthread_mutex_lock ") ; exit( 0 ) ; } MESSAGE( "MutexManager pthread_mutex_locked" ) ; - Containers::MachineParameters & myParams = (Containers::MachineParameters & ) MyParams ; - aContainer = FindOrStartContainerLocked( myParams , "" ) ; + _StartContainer = true ; + _EnginesContainer = FindOrStartContainerLocked( MyParams , "" ) ; if ( pthread_mutex_unlock( &_MutexManager ) ) { perror("MutexManager pthread_nriContainmutex_unlock ") ; exit( 0 ) ; } MESSAGE( "MutexManager pthread_mutex_unlocked" ) ; - return Engines::Container::_duplicate( aContainer ) ; + return Engines::Container::_duplicate( _EnginesContainer ) ; } Engines::Container_ptr Manager_i::FindOrStartContainerLocked( Containers::MachineParameters & myParams , - const char * ComponentName ) { - Engines::Container_var aContainer = Engines::Container::_nil() ; - Containers::MachineParameters SearchParams = myParams ; - if ( strcmp( myParams.HostName , "localhost" ) == 0 ) { - myParams.HostName = GetHostname().c_str() ; - } - if ( myParams.ContainerType == Engines::Undefined ) { - myParams.ContainerType = Engines::Cpp ; - } - if ( myParams.ContainerType == Engines::Cpp || myParams.ContainerType == Engines::Python ) { - if ( ( strlen( myParams.HostName ) || strcmp( myParams.HostName ,"localhost" ) == 0 ) && - strlen( myParams.ContainerName ) ) { - aContainer = FindContainer( myParams ) ; - if ( CORBA::is_nil( aContainer ) ) { - aContainer = StartContainer( myParams ) ; - if ( CORBA::is_nil( aContainer ) ) { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked failed" ) ; + const char * aComponentName ) { + _EnginesContainer = Engines::Container::_nil() ; + _EnginesComponent = Engines::Component::_nil() ; + _ListOfComponents = new Engines::ListOfComponents() ; + _ListOfComponents->length( 0 ) ; + _ListOfContainers = FindContainers( myParams ) ; + _ComponentName = aComponentName ; + MESSAGE( "MutexManager FindOrStartContainerLocked " << _ListOfContainers->length() << " containers found" ) ; + if ( _ListOfContainers->length() ) { + if ( strlen( _ComponentName.c_str() ) ) { + int i ; + for ( i = 0 ; i < _ListOfContainers->length() && CORBA::is_nil( _EnginesContainer ) ; i++ ) { + _FullHostName = "/Containers/" ; + _HostName += _ListOfContainers[ i ]->machineName() ; + _FullHostName += _HostName ; + _ContainerName = _ListOfContainers[ i ]->name() ; + _FullContainerName = _FullHostName + "/" + _ContainerName ; + _FullComponentName = _FullContainerName + "/" + _ComponentName ; + _ComponentObject = _NamingService->Resolve( _FullComponentName.c_str() ) ; + if ( !CORBA::is_nil( _ComponentObject ) ) { + _EnginesContainer = _ListOfContainers[ i ] ; + MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() ) ; + _EnginesComponent = Engines::Component::_narrow( _ComponentObject ) ; + int size = _ListOfComponents->length() ; + _ListOfComponents->length( size + 1 ) ; + _ListOfComponents[ size ] = _EnginesComponent ; } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked " << aContainer->name() - << " successed" ) ; - } - } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked " << aContainer->name() - << " successed" ) ; } } else { - Resources::ListOfComputers_var aListOfComputers ; - Resources::Computer_var aComputer ; - if ( strlen( myParams.HostName ) == 0 || strcmp( myParams.HostName ,"localhost" ) == 0 ) { - if ( strcmp( myParams.HostName ,"localhost" ) == 0 ) { - myParams.HostName = CORBA::string_dup( _NamingServiceHostName.c_str() ) ; - } - } -// appel au ResourcesManager ---> liste de machines ... - aListOfComputers = _ResourcesManager->GetComputers( myParams ) ; - if ( aListOfComputers->length() == 0 ) { - MESSAGE( "Manager_i::FindOrStartContainer NO computer found in ResourcesManager" ) ; - } - else if ( strlen( myParams.ContainerName ) ) { -// Boucle de recherche du container dans la liste de machines - int i ; - for ( i = 0 ; i < aListOfComputers->length() && CORBA::is_nil( aContainer ) ; i++ ) { - SearchParams.HostName = aListOfComputers[ i ]->Alias() ; - aContainer = FindContainer( SearchParams ) ; - if ( CORBA::is_nil( aContainer ) ) { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked not found on " - << SearchParams.HostName ) ; - } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked " << aContainer->name() - << " found on " << SearchParams.HostName ) ; - } - } - if ( CORBA::is_nil( aContainer ) ) { - myParams.HostName = aListOfComputers[ 0 ]->Alias() ; - aContainer = StartContainer( myParams ) ; - if ( CORBA::is_nil( aContainer ) ) { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked not started with " - << myParams.HostName ) ; - } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked started with " - << myParams.HostName << " for " << aContainer->name() ) ; - } - } - } - else { -// Rechercher dans tous les containers de toutes les machines le composant - if ( strlen( ComponentName ) ) { - - } - else { - aComputer = _ResourcesManager->GetComputer( aListOfComputers ) ; - if ( CORBA::is_nil( aComputer ) ) { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked GetComputer failed" ) ; - } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked GetComputer successed : " - << aComputer->Alias() ) ; - myParams.HostName = aComputer->Alias() ; - } - } -// Si on ne le trouve pas, prendre les par-defauts - if ( CORBA::is_nil( aContainer ) ) { - if ( myParams.ContainerType == Engines::Cpp ) { - myParams.ContainerName = CORBA::string_dup( Containers::DefaultContainerCpp ) ; - } - else if ( myParams.ContainerType == Engines::Python ) { - myParams.ContainerName = CORBA::string_dup( Containers::DefaultContainerPython ) ; - } - aContainer = FindContainer( myParams ) ; - if ( CORBA::is_nil( aContainer ) ) { - aContainer = StartContainer( myParams ) ; - if ( CORBA::is_nil( aContainer ) ) { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked failed" ) ; - } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked " << aContainer->name() - << " successed" ) ; - } - } - else { - MESSAGE( "Manager_i::FindOrStartContainer FindOrStartContainerLocked " << aContainer->name() - << " successed" ) ; - } - } - } + _EnginesContainer = _ListOfContainers[ 0 ] ; + MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() ) ; } } - if ( !CORBA::is_nil( aContainer ) ) { - MESSAGE( "Manager_i::FindOrStartContainer Container " << aContainer->name() << " is known ==> ping" ) ; - aContainer->ping() ; - } - else { - MESSAGE( "Manager_i::FindOrStartContainer Container " << _ContainerName << " unknown" ) ; + if ( CORBA::is_nil( _EnginesContainer ) && _StartContainer ) { + StartContainer( myParams ) ; } - _EnginesContainer = aContainer ; - return Engines::Container::_duplicate( aContainer ) ; + return Engines::Container::_duplicate( _EnginesContainer ) ; } -Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters & myParams ) { - Engines::Container_var aContainer = Engines::Container::_nil() ; - Engines::Container_var aStartContainer = Engines::Container::_nil() ; - string theContainerName = (char * ) myParams.ContainerName ; - myParams.ContainerName = "" ; - aStartContainer = FindContainer( myParams ) ; - if ( CORBA::is_nil( aStartContainer ) ) { - MESSAGE( "Manager_i::StartContainer NO Container on " << myParams.HostName ) ; - myParams.ContainerName = CORBA::string_dup( theContainerName.c_str() ) ; +Engines::Container_ptr Manager_i::StartContainer( const Containers::MachineParameters & myParams ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; + if ( _ListOfContainers->length() ) { + MyParams.HostName = _ListOfContainers[ 0 ]->machineName() ; + MyParams.ContainerName = _ListOfContainers[ 0 ]->name() ; + } + else if ( _ListOfComputers->length() ) { + MyParams.HostName = _ListOfComputers[ 0 ]->Alias() ; + if ( strlen( MyParams.ContainerName ) == 0 ) { + if ( MyParams.ContainerType == Engines::Cpp ) { + MyParams.ContainerName = "FactoryServer" ; + } + else { + MyParams.ContainerName = "FactoryServerPy" ; + } + } + } + MESSAGE( "Manager_i::StartContainer " << MyParams.HostName << " " << MyParams.ContainerName + << " " << MyParams.ContainerType << " " << MyParams.Os << " " << MyParams.Memory << " " + << MyParams.CpuClock << " " << MyParams.NbProc << " " << MyParams.NbNode << " " + << MyParams.NsHostName << " " << MyParams.NsPort << " " << _ListOfContainers->length() + << " computers" ) ; + _ResourcesComputer = _ResourcesManager->SearchComputer( MyParams.HostName ) ; + if ( CORBA::is_nil( _EnginesContainer ) && !CORBA::is_nil( _ResourcesComputer ) ) { + Resources::ComputerEnvironment * aComputerEnvironment = _ResourcesComputer->Environment() ; string rsh( "" ) ; - char * HostName = myParams.HostName ; + char * HostName = MyParams.HostName ; if ( strcmp( HostName , GetHostname().c_str() ) ) { if ( _ResourcesManager->SshAccess( HostName ) ) { rsh += "ssh " ; @@ -407,9 +325,8 @@ Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters else { rsh += "rsh -n " ; } - rsh += myParams.HostName ; + rsh += MyParams.HostName ; rsh += " sh -c \"'" ; - Resources::ComputerEnvironment * aComputerEnvironment = _ResourcesManager->SearchComputer( myParams.HostName )->Environment() ; int size = aComputerEnvironment->Module_Root_Dir_Names.length() ; int i ; bool GeomModule = false ; @@ -417,18 +334,19 @@ Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters if ( i > 0 ) { rsh += " ; " ; } - rsh += "export " ; rsh += aComputerEnvironment->Module_Root_Dir_Names[ i ] ; if ( strcmp( aComputerEnvironment->Module_Root_Dir_Names[ i ] , "GEOM_ROOT_DIR" ) == 0 ) { GeomModule = true ; } rsh += "=" ; rsh += aComputerEnvironment->Module_Root_Dir_Values[ i ] ; + rsh += " ; export " ; + rsh += aComputerEnvironment->Module_Root_Dir_Names[ i ] ; } if ( size > 0 ) { rsh += " ; " ; } - rsh += "export PATH=" ; + rsh += "PATH=" ; int j ; string Path = (char * ) aComputerEnvironment->Path ; for ( j = 0 ; j < Path.size() ; j++ ) { @@ -437,7 +355,8 @@ Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters } rsh += Path[ j ] ; } - rsh += " ; export LD_LIBRARY_PATH=" ; + rsh += " ; export PATH" ; + rsh += " ; LD_LIBRARY_PATH=" ; string Ld_Library_Path = (char * ) aComputerEnvironment->Ld_Library_Path ; for ( j = 0 ; j < Ld_Library_Path.size() ; j++ ) { if ( Ld_Library_Path[ j ] == '$' ) { @@ -445,7 +364,8 @@ Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters } rsh += Ld_Library_Path[ j ] ; } - rsh += " ; export PYTHONPATH=" ; + rsh += " ; export LD_LIBRARY_PATH" ; + rsh += " ; PYTHONPATH=" ; string PythonPath = (char * ) aComputerEnvironment->PythonPath ; for ( j = 0 ; j < PythonPath.size() ; j++ ) { if ( PythonPath[ j ] == '$' ) { @@ -453,45 +373,50 @@ Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters } rsh += PythonPath[ j ] ; } - rsh += " ; export CASROOT=" ; + rsh += " ; export PYTHONPATH" ; + rsh += " ; CASROOT=" ; rsh += aComputerEnvironment->CasRoot ; - rsh += " ; export CSF_PluginDefaults=" ; + rsh += " ; export CASROOT" ; + rsh += " ; CSF_PluginDefaults=" ; rsh += "\\" ; rsh += "${KERNEL_ROOT_DIR}/share/salome/resources" ; - rsh += " ; export CSF_SALOMEDS_ResourcesDefaults=" ; + rsh += " ; export CSF_PluginDefaults" ; + rsh += " ; CSF_SALOMEDS_ResourcesDefaults=" ; rsh += "\\" ; rsh += "${KERNEL_ROOT_DIR}/share/salome/resources" ; + rsh += " ; export CSF_SALOMEDS_ResourcesDefaults" ; if ( GeomModule ) { - rsh += " ; export CSF_GEOMDS_ResourcesDefaults=" ; + rsh += " ; CSF_GEOMDS_ResourcesDefaults=" ; rsh += "\\" ; rsh += "${GEOM_ROOT_DIR}/share/salome/resources" ; + rsh += " ; export CSF_GEOMDS_ResourcesDefaults" ; } rsh += " ; " ; } - if ( myParams.ContainerType == Engines::Cpp ) { + if ( MyParams.ContainerType == Engines::Cpp ) { rsh += "SALOME_Container " ; } - else if ( myParams.ContainerType == Engines::Python ) { + else if ( MyParams.ContainerType == Engines::Python ) { rsh += "SALOME_ContainerPy.py " ; } - rsh += myParams.ContainerName ; + rsh += MyParams.ContainerName ; rsh += " -ORBInitRef NameService=corbaname::" ; - rsh += myParams.NsHostName ; - if ( myParams.NsPort != 0 ) { + rsh += MyParams.NsHostName ; + if ( MyParams.NsPort != 0 ) { rsh += ":" ; ostringstream astr ; - astr << myParams.NsPort ; + astr << MyParams.NsPort ; rsh += astr.str().c_str() ; } rsh += " > /tmp/" ; - rsh += myParams.ContainerName ; - if ( myParams.ContainerType == Engines::Cpp ) { + rsh += MyParams.ContainerName ; + if ( MyParams.ContainerType == Engines::Cpp || MyParams.ContainerType == Engines::Undefined ) { rsh += "_Cpp_" ; } - else if ( myParams.ContainerType == Engines::Python ) { + else if ( MyParams.ContainerType == Engines::Python ) { rsh += "_Py_" ; } - rsh += myParams.HostName ; + rsh += MyParams.HostName ; rsh += ".log 2>&1 " ; if ( strcmp( HostName , GetHostname().c_str() ) ) { rsh += "'\"" ; @@ -507,66 +432,58 @@ Engines::Container_ptr Manager_i::StartContainer( Containers::MachineParameters } else { int count = 21 ; - while ( CORBA::is_nil( aContainer ) && count ) { + while ( CORBA::is_nil( _EnginesContainer ) && count ) { sleep( 1 ) ; count-- ; if ( count != 21 ) { - MESSAGE( "StartContainer" << count << ". Waiting for " << myParams.ContainerName << " on " - << myParams.HostName ) ; + MESSAGE( "StartContainer" << count << ". Waiting for " << MyParams.ContainerName << " on " + << MyParams.HostName ) ; } - aContainer = FindContainer( myParams ) ; + _EnginesContainer = FindContainer( MyParams ) ; } - if ( CORBA::is_nil( aContainer ) ) { + if ( CORBA::is_nil( _EnginesContainer ) ) { INFOS("StartContainer rsh/ssh failed " ) ; } } } else { - MESSAGE( "Manager_i::StartContainer -> Container start_impl( " << aStartContainer->name() << ") for " - << theContainerName.c_str() ) ; - aContainer = aStartContainer->start_impl( theContainerName.c_str() , myParams.ContainerType ) ; + MESSAGE( "Manager_i::StartContainer -> Container start_impl( " << _EnginesContainer->name() << ") for " + << MyParams.ContainerName ) ; + _EnginesContainer = _EnginesContainer->start_impl( MyParams.ContainerName , MyParams.ContainerType ) ; } - return Engines::Container::_duplicate( aContainer ) ; + return Engines::Container::_duplicate( _EnginesContainer ) ; } -Engines::Component_ptr Manager_i::FindComponent( const Containers::MachineParameters & MyParams , +Engines::Component_ptr Manager_i::FindComponent( const Containers::MachineParameters & myParams , const char * ComponentName ) { - CORBA::Object_var ComponentObject = CORBA::Object::_nil() ; - Engines::Component_var EnginesComponent = Engines::Component::_nil() ; - Engines::Container_var aContainer = FindContainer( MyParams ) ; - if ( !CORBA::is_nil( aContainer ) ) { - _ComponentName = _ContainerName ; - _ComponentName += "/" ; - _ComponentName += ComponentName ; - try { - ComponentObject = _NamingService->Resolve( _ComponentName.c_str() ) ; - if ( !CORBA::is_nil( ComponentObject ) ) { - MESSAGE( "Component found !" << _ComponentName ) ; - Engines::Component_var EnginesComponent = Engines::Component::_narrow( ComponentObject ) ; - if ( !CORBA::is_nil( EnginesComponent ) ) { - try { - EnginesComponent->ping() ; - } - catch ( CORBA::COMM_FAILURE& ) { - INFOS("Caught CORBA::SystemException CommFailure. Engine " << _ComponentName << "does not respond" ) ; - EnginesComponent = Engines::Component::_nil() ; - } - } - } - } - catch ( ServiceUnreachable& ) { - INFOS("Caught exception: Naming Service Unreachable") ; - } - catch (...) { - INFOS("Caught unknown exception.") ; - } + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; } - return Engines::Component::_duplicate( EnginesComponent ) ; + _StartContainer = false ; + FindOrStartContainerLocked( (Containers::MachineParameters & ) MyParams , ComponentName ) ; + return Engines::Component::_duplicate( _EnginesComponent ) ; +} + +Engines::ListOfComponents * Manager_i::FindComponents( const Containers::MachineParameters & myParams , + const char * ComponentName ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } + _StartContainer = false ; + _EnginesContainer = FindOrStartContainerLocked( (Containers::MachineParameters & ) MyParams , ComponentName ) ; + _ListOfComponents._retn() ; } -Engines::Component_ptr Manager_i::FindOrLoad_ComponentPath( const Containers::MachineParameters & MyParams , + +Engines::Component_ptr Manager_i::FindOrLoad_ComponentPath( const Containers::MachineParameters & myParams , const char * ComponentName , const char * ImplementationPath ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } BEGIN_OF("FindOrLoad_Component( const Containers::MachineParameters & MyParams , const char * ComponentName , const char * ImplementationPath 1)"); MESSAGE( "MutexManager pthread_mutex_lock :" ) ; if ( pthread_mutex_lock( &_MutexManager ) ) { @@ -577,6 +494,7 @@ Engines::Component_ptr Manager_i::FindOrLoad_ComponentPath( const Containers::Ma Engines::Container_var aContainer = Engines::Container::_nil() ; Engines::Component_var EnginesComponent = FindComponent( MyParams , ComponentName ) ; if ( CORBA::is_nil( EnginesComponent ) ) { + _StartContainer = true ; aContainer = FindOrStartContainerLocked( (Containers::MachineParameters & ) MyParams , ComponentName ) ; } else { @@ -607,8 +525,12 @@ Engines::Component_ptr Manager_i::FindOrLoad_ComponentPath( const Containers::Ma return Engines::Component::_duplicate( EnginesComponent ) ; } -Engines::Component_ptr Manager_i::FindOrLoad_Component( const Containers::MachineParameters & MyParams , +Engines::Component_ptr Manager_i::FindOrLoad_Component( const Containers::MachineParameters & myParams , const char * ComponentName ) { + Containers::MachineParameters MyParams = (Containers::MachineParameters & ) myParams ; + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } BEGIN_OF("FindOrLoad_Component( const Containers::MachineParameters & MyParams , const char * ComponentName )"); MESSAGE( "MutexManager pthread_mutex_lock :" ) ; if ( pthread_mutex_lock( &_MutexManager ) ) { @@ -619,6 +541,7 @@ Engines::Component_ptr Manager_i::FindOrLoad_Component( const Containers::Machin Engines::Container_var aContainer = Engines::Container::_nil() ; Engines::Component_var EnginesComponent = FindComponent( MyParams , ComponentName ) ; if ( CORBA::is_nil( EnginesComponent ) ) { + _StartContainer = true ; aContainer = FindOrStartContainerLocked( (Containers::MachineParameters & ) MyParams , ComponentName ) ; } else { diff --git a/src/ContainersManager/ContainersManager_i.hxx b/src/ContainersManager/ContainersManager_i.hxx index 7ed1381aa..d8f34f4d9 100644 --- a/src/ContainersManager/ContainersManager_i.hxx +++ b/src/ContainersManager/ContainersManager_i.hxx @@ -56,17 +56,31 @@ class Manager_i : public POA_Containers::Manager , public PortableServer::RefCountServantBase { private: - CORBA::ORB_ptr _Orb ; - SALOME_NamingService * _NamingService ; - Resources::Manager_var _ResourcesManager ; - string _NamingServiceHostName ; - long _NamingServicePort ; - pthread_mutex_t _MutexManager ; - string _ContainerName ; - string _ComponentName ; - Engines::Container_var _EnginesContainer ; - - Engines::Container_ptr StartContainer( Containers::MachineParameters & myParams ) ; + CORBA::ORB_ptr _Orb ; + SALOME_NamingService * _NamingService ; + Resources::Manager_var _ResourcesManager ; + string _NamingServiceHostName ; + long _NamingServicePort ; + pthread_mutex_t _MutexManager ; + bool _StartContainer ; + string _HostName ; + string _FullHostName ; + string _ContainerName ; + string _FullContainerName ; + Engines::ContainerType _ContainerType ; + string _ComponentName ; + string _FullComponentName ; + Resources::ListOfComputers_var _ListOfComputers ; + Resources::Computer_var _ResourcesComputer ; + Resources::ComputerParameters_var _ComputerParameters ; + Engines::ListOfContainers_var _ListOfContainers ; + CORBA::Object_var _ContainerObject ; + Engines::Container_var _EnginesContainer ; + Engines::ListOfComponents_var _ListOfComponents ; + CORBA::Object_var _ComponentObject ; + Engines::Component_var _EnginesComponent ; + + Engines::Container_ptr StartContainer( const Containers::MachineParameters & myParams ) ; Engines::Container_ptr FindOrStartContainerLocked( Containers::MachineParameters & MyParams , const char * ComponentName ) ; @@ -95,6 +109,9 @@ class Manager_i : public POA_Containers::Manager , virtual Engines::Component_ptr FindComponent( const Containers::MachineParameters & MyParams , const char * ComponentName ) ; + virtual Engines::ListOfComponents * FindComponents( const Containers::MachineParameters & MyParams , + const char * ComponentName ) ; + virtual Engines::Component_ptr FindOrLoad_ComponentPath( const Containers::MachineParameters & MyParams , const char * ComponentName , const char * ImplementationPath ) ; diff --git a/src/ContainersManager/TestContainersManager.py b/src/ContainersManager/TestContainersManager.py index d16783e0c..4451dc7f0 100644 --- a/src/ContainersManager/TestContainersManager.py +++ b/src/ContainersManager/TestContainersManager.py @@ -5,23 +5,56 @@ import Engines import Containers +def ContainerParameters( Params ) : + print "ContainerParameters :" + print "Os :",Params.Os + print "Memory :",Params.Memory + print "CpuClock :",Params.CpuClock + print "NbProc :",Params.NbProc + print "NbNode :",Params.NbNode + print "HostName :",Params.HostName + print "ContainerName :",Params.ContainerName + print "ContainerType :",Params.ContainerType + print "NsHostName :",Params.NsHostName + print "NsPort :",Params.NsPort + +def ComputerParameters( Params ) : + print "ComputerParameters :" + print "FullName :",Params.FullName + print "Alias :",Params.Alias + print "SshAccess :",Params.SshAccess + print "Interactive :",Params.Interactive + print "Batch :",Params.Batch + print "UserName :",Params.UserName + print "Os :",Params.Os + print "Memory :",Params.Memory + print "Swap :",Params.Swap + print "CpuClock :",Params.CpuClock + print "NbProc :",Params.NbProc + print "NbNode :",Params.NbNode + + +def ComputerEnvironement( env ) : + rootNames = env.Module_Root_Dir_Names + rootValues = env.Module_Root_Dir_Values + j = 0 + while j < len( rootNames ) : + print rootNames[ j ],rootValues[ j ] + j = j + 1 + print 'Path ',env.Path + print 'Ld_Library_Path',env.Ld_Library_Path + print 'PythonPath ',env.PythonPath + print 'CasRoot ',env.CasRoot + + + MyContainersMgr = clt.waitNS("/Kernel/ContainersManager",Containers.Manager) MyContainersMgr.ping() DefaultParams = MyContainersMgr.Parameters() -print "DefaultParameters :" -print "Os :",DefaultParams.Os -print "Memory :",DefaultParams.Memory -print "CpuClock :",DefaultParams.CpuClock -print "NbProc :",DefaultParams.NbProc -print "NbNode :",DefaultParams.NbNode -print "HostName :",DefaultParams.HostName -print "ContainerName :",DefaultParams.ContainerName -print "ContainerType :",DefaultParams.ContainerType -print "NsHostName :",DefaultParams.NsHostName -print "NsPort :",DefaultParams.NsPort +ContainerParameters( DefaultParams ) FactoryServer = MyContainersMgr.FindOrStartContainer( DefaultParams ) @@ -61,30 +94,8 @@ print 'AllComputers',len( AllComputers ),'computers found' i = 0 while i < len( AllComputers ) : print '' - params = AllComputers[i].Parameters() - print 'FullName ',params.FullName - print 'Alias ',params.Alias - print 'SshAccess ',params.SshAccess - print 'Interactive',params.Interactive - print 'Batch ',params.Batch - print 'UserName ',params.UserName - print 'Os ',params.Os - print 'Memory ',params.Memory - print 'Swap ',params.Swap - print 'CpuClock ',params.CpuClock - print 'NbProc ',params.NbProc - print 'NbNode ',params.NbNode - env = AllComputers[i].Environment() - rootNames = env.Module_Root_Dir_Names - rootValues = env.Module_Root_Dir_Values - j = 0 - while j < len( rootNames ) : - print rootNames[ j ],rootValues[ j ] - j = j + 1 - print 'Path ',env.Path - print 'Ld_Library_Path',env.Ld_Library_Path - print 'PythonPath ',env.PythonPath - print 'CasRoot ',env.CasRoot + ComputerParameters( AllComputers[i].Parameters() ) + ComputerEnvironement( AllComputers[i].Environment() ) i = i + 1 ListOfComputers = MyResourcesMgr.GetComputers( DefaultParams ) @@ -93,30 +104,8 @@ print 'ListOfComputers',len( ListOfComputers ),'computers found' i = 0 while i < len( ListOfComputers ) : print '' - params = ListOfComputers[i].Parameters() - print 'FullName ',params.FullName - print 'Alias ',params.Alias - print 'SshAccess ',params.SshAccess - print 'Interactive',params.Interactive - print 'Batch ',params.Batch - print 'UserName ',params.UserName - print 'Os ',params.Os - print 'Memory ',params.Memory - print 'Swap ',params.Swap - print 'CpuClock ',params.CpuClock - print 'NbProc ',params.NbProc - print 'NbNode ',params.NbNode - env = ListOfComputers[i].Environment() - rootNames = env.Module_Root_Dir_Names - rootValues = env.Module_Root_Dir_Values - j = 0 - while j < len( rootNames ) : - print rootNames[ j ],rootValues[ j ] - j = j + 1 - print 'Path ',env.Path - print 'Ld_Library_Path',env.Ld_Library_Path - print 'PythonPath ',env.PythonPath - print 'CasRoot ',env.CasRoot + ComputerParameters( ListOfComputers[i].Parameters() ) + ComputerEnvironement( ListOfComputers[i].Environment() ) i = i + 1 aComputer = MyResourcesMgr.SelectComputer( DefaultParams ) @@ -131,6 +120,9 @@ aComputer.Parameters().FullName aComputer = MyResourcesMgr.SearchComputer("bojolex") aComputer.Parameters().FullName +aComputer = MyResourcesMgr.SearchComputer("xmen.saclay.opencascade.com") +aComputer.Parameters().FullName + aComputer = MyResourcesMgr.SearchComputer("unknown") if aComputer is None : print "unknown is None Ok" @@ -146,30 +138,8 @@ print 'ListOfComputers',len( ListOfComputers ),'computers found' i = 0 while i < len( ListOfComputers ) : print '' - params = ListOfComputers[i].Parameters() - print 'FullName ',params.FullName - print 'Alias ',params.Alias - print 'SshAccess ',params.SshAccess - print 'Interactive',params.Interactive - print 'Batch ',params.Batch - print 'UserName ',params.UserName - print 'Os ',params.Os - print 'Memory ',params.Memory - print 'Swap ',params.Swap - print 'CpuClock ',params.CpuClock - print 'NbProc ',params.NbProc - print 'NbNode ',params.NbNode - env = ListOfComputers[i].Environment() - rootNames = env.Module_Root_Dir_Names - rootValues = env.Module_Root_Dir_Values - j = 0 - while j < len( rootNames ) : - print rootNames[ j ],rootValues[ j ] - j = j + 1 - print 'Path ',env.Path - print 'Ld_Library_Path',env.Ld_Library_Path - print 'PythonPath ',env.PythonPath - print 'CasRoot ',env.CasRoot + ComputerParameters( ListOfComputers[i].Parameters() ) + ComputerEnvironement( ListOfComputers[i].Environment() ) i = i + 1 aComputer = MyResourcesMgr.SelectComputer( DefaultParams ) @@ -185,33 +155,12 @@ print '' print 'ListOfComputers',len( ListOfComputers ),'computers found' if len( ListOfComputers ) > 0 : print "Error",len( ListOfComputers ),"Computers found" + i = 0 while i < len( ListOfComputers ) : print '' - params = ListOfComputers[i].Parameters() - print 'FullName ',params.FullName - print 'Alias ',params.Alias - print 'SshAccess ',params.SshAccess - print 'Interactive',params.Interactive - print 'Batch ',params.Batch - print 'UserName ',params.UserName - print 'Os ',params.Os - print 'Memory ',params.Memory - print 'Swap ',params.Swap - print 'CpuClock ',params.CpuClock - print 'NbProc ',params.NbProc - print 'NbNode ',params.NbNode - env = ListOfComputers[i].Environment() - rootNames = env.Module_Root_Dir_Names - rootValues = env.Module_Root_Dir_Values - j = 0 - while j < len( rootNames ) : - print rootNames[ j ],rootValues[ j ] - j = j + 1 - print 'Path ',env.Path - print 'Ld_Library_Path',env.Ld_Library_Path - print 'PythonPath ',env.PythonPath - print 'CasRoot ',env.CasRoot + ComputerParameters( ListOfComputers[i].Parameters() ) + ComputerEnvironement( ListOfComputers[i].Environment() ) i = i + 1 aComputer = MyResourcesMgr.SelectComputer( DefaultParams ) @@ -236,3 +185,9 @@ xmenServer.ping() component = MyContainersMgr.FindOrLoadComponent( DefaultParams , "AddComponent" ) +Containers = MyContainersMgr.FindContainers( DefaultParams ) + +DefaultParams.ContainerName = '' + +Containers = MyContainersMgr.FindContainers( DefaultParams ) + diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index f759a0387..d2f8e2453 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -88,6 +88,9 @@ string SALOME_LifeCycleCORBA::ContainerName( const char * aComputerContainer , theComputerContainer += "/" ; theComputerContainer += *theContainer ; } + if ( strlen( theContainer->c_str() ) == 0 ) { + theContainer = new string( "FactoryServer" ) ; + } return theComputerContainer ; } @@ -124,7 +127,10 @@ Engines::Container_var SALOME_LifeCycleCORBA::FindContainer( const char * contai return FindContainer( *MyParams ) ; } -Engines::Container_var SALOME_LifeCycleCORBA::FindContainer( const Containers::MachineParameters & MyParams ) { +Engines::Container_var SALOME_LifeCycleCORBA::FindContainer( Containers::MachineParameters & MyParams ) { + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } return _MyContainersMgr->FindContainer( MyParams ) ; } // ASSERT(_NamingService != NULL); @@ -273,6 +279,29 @@ Engines::Container_var SALOME_LifeCycleCORBA::FindContainer( const Containers::M // return Engines::Container::_nil(); //} +Engines::ListOfContainers_var SALOME_LifeCycleCORBA::FindContainers( Containers::MachineParameters & MyParams ) { + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } + return _MyContainersMgr->FindContainers( MyParams ) ; +} + +Engines::Component_var SALOME_LifeCycleCORBA::FindComponent( Containers::MachineParameters & MyParams , + const char * ComponentName ) { + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } + return _MyContainersMgr->FindComponent( MyParams , ComponentName ) ; +} + +Engines::ListOfComponents_var SALOME_LifeCycleCORBA::FindComponents( Containers::MachineParameters & MyParams , + const char * ComponentName ) { + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } + return _MyContainersMgr->FindComponents( MyParams , ComponentName ) ; +} + Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( const char *containerName , const char *componentName , const char *implementation ) { @@ -291,10 +320,13 @@ Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( const char * } return FindOrLoad_Component( *MyParams , componentName , implementation ) ; } -Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( const Containers::MachineParameters & MyParams , +Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( Containers::MachineParameters & MyParams , const char * componentName , const char * implementation ) { + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } return _MyContainersMgr->FindOrLoad_ComponentPath( MyParams , componentName , implementation ) ; } //{ @@ -371,8 +403,11 @@ Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( const char * } return FindOrLoad_Component( *MyParams , componentName ) ; } -Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( const Containers::MachineParameters & MyParams , +Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component( Containers::MachineParameters & MyParams , const char * componentName ) { + if ( strcmp( MyParams.HostName ,"localhost" ) == 0 ) { + MyParams.HostName = GetHostname().c_str() ; + } return _MyContainersMgr->FindOrLoad_Component( MyParams , componentName ) ; } // BEGIN_OF("FindOrLoad_Component(2)"); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 79061af6a..48296f222 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -48,16 +48,21 @@ public: virtual ~SALOME_LifeCycleCORBA(); Engines::Container_var FindContainer( const char *containerName ) ; - Engines::Container_var FindContainer( const Containers::MachineParameters & MyParams ) ; + Engines::Container_var FindContainer( Containers::MachineParameters & MyParams ) ; + Engines::ListOfContainers_var FindContainers( Containers::MachineParameters & MyParams ) ; + Engines::Component_var FindComponent( Containers::MachineParameters & MyParams , + const char * ComponentName ) ; + Engines::ListOfComponents_var FindComponents( Containers::MachineParameters & MyParams , + const char * ComponentName ) ; Engines::Component_var FindOrLoad_Component( const char *containerName , const char *componentName , const char *implementationPath ) ; - Engines::Component_var FindOrLoad_Component( const Containers::MachineParameters & MyParams , + Engines::Component_var FindOrLoad_Component( Containers::MachineParameters & MyParams , const char *componentName , const char *implementationPath ) ; Engines::Component_var FindOrLoad_Component( const char *containerName , const char *componentName ) ; - Engines::Component_var FindOrLoad_Component( const Containers::MachineParameters & MyParams , + Engines::Component_var FindOrLoad_Component( Containers::MachineParameters & MyParams , const char *componentName ) ; protected: Containers::Manager_var _MyContainersMgr ; diff --git a/src/OCCViewer/Makefile.in b/src/OCCViewer/Makefile.in index 5f466d4af..fcd5aec1f 100644 --- a/src/OCCViewer/Makefile.in +++ b/src/OCCViewer/Makefile.in @@ -40,7 +40,8 @@ LIB_MOC = \ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) diff --git a/src/Plot2d/Makefile.in b/src/Plot2d/Makefile.in index 580beb445..fa9a998e3 100644 --- a/src/Plot2d/Makefile.in +++ b/src/Plot2d/Makefile.in @@ -41,7 +41,8 @@ LIB_MOC = \ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomeGUI diff --git a/src/ResourcesManager/ResourcesManager_Impl.cxx b/src/ResourcesManager/ResourcesManager_Impl.cxx index a2b8111ed..569d08ce6 100755 --- a/src/ResourcesManager/ResourcesManager_Impl.cxx +++ b/src/ResourcesManager/ResourcesManager_Impl.cxx @@ -66,12 +66,20 @@ Manager_Impl::Manager_Impl( CORBA::ORB_ptr orb , _ComputersList[ i ] = Resources::Computer::_duplicate( iobject ) ; Resources::ComputerParameters * aComputerParameters = aComputer->Parameters() ; const char * anAlias = aComputerParameters->Alias ; - if ( _MapOfComputers[ anAlias ] > 0 ) { + if ( _MapOfAliasComputers[ anAlias ] > 0 ) { MESSAGE("Duplicate computer " << aComputerParameters->FullName << " " << anAlias ) ; } else { MESSAGE("Computer " << aComputerParameters->FullName << " " << anAlias ) ; - _MapOfComputers[ anAlias ] = i + 1 ; + _MapOfAliasComputers[ anAlias ] = i + 1 ; + } + const char * aFullName = aComputerParameters->FullName ; + if ( _MapOfFullNameComputers[ aFullName ] > 0 ) { + MESSAGE("Duplicate computer " << aComputerParameters->FullName << " " << aFullName ) ; + } + else { + MESSAGE("Computer " << aComputerParameters->FullName << " " << aFullName ) ; + _MapOfFullNameComputers[ aFullName ] = i + 1 ; } } MESSAGE(_ComputersList->length() << " computers") ; @@ -135,19 +143,27 @@ Resources::ListOfComputers * Manager_Impl::AllComputers() { } Resources::ListOfComputers * Manager_Impl::GetComputers( const Containers::MachineParameters & aMachineParameters ) { - MESSAGE("Manager_Impl::GetComputers()") ; + MESSAGE("Manager_Impl::GetComputers() " << aMachineParameters.HostName << " in list of " + << _ComputersList->length() << " computers" ) ; Resources::ListOfComputers_var aListOfComputers = new Resources::ListOfComputers() ; int i ; if ( strlen( (char * ) ((CORBA::String_member ) aMachineParameters.HostName) ) ) { for ( i = 0 ; i < _ComputersList->length() ; i++ ) { Resources::Computer_var aComputer = _ComputersList[ i ] ; - if ( aComputer->Parameters()->FullName == aMachineParameters.HostName || - aComputer->Parameters()->Alias == aMachineParameters.HostName ) { + if ( strcmp( aComputer->Parameters()->FullName , aMachineParameters.HostName ) == 0 || + strcmp( aComputer->Parameters()->Alias , aMachineParameters.HostName ) == 0 ) { aListOfComputers->length( 1 ) ; aListOfComputers[ 0 ] = Resources::Computer::_duplicate( aComputer ) ; - MESSAGE("Manager_Impl::GetComputers() " << aComputer->FullName() << " selected" ) ; + MESSAGE("Manager_Impl::GetComputers() " << aComputer->Parameters()->FullName << " " + << aComputer->Parameters()->Alias << " selected" ) ; break ; } + else { + MESSAGE("Manager_Impl::GetComputers() " << aComputer->Parameters()->FullName << " " + << strcmp( aComputer->Parameters()->FullName , aMachineParameters.HostName ) << " " + << aComputer->Parameters()->Alias << " " + << strcmp( aComputer->Parameters()->Alias , aMachineParameters.HostName ) << " skipped" ) ; + } } } else { @@ -190,11 +206,22 @@ Resources::Computer_ptr Manager_Impl::GetComputer( const Resources::ListOfComput Resources::Computer_ptr Manager_Impl::SearchComputer( const char * aComputerName ) { MESSAGE("Manager_Impl::SearchComputer()") ; Resources::Computer_var aComputer = Resources::Computer::_nil() ; - int i = _MapOfComputers[ aComputerName ] ; + int i = _MapOfAliasComputers[ aComputerName ] ; if ( i ) { aComputer = _ComputersList[ i - 1 ] ; + MESSAGE("Manager_Impl::SearchComputer " << aComputerName << " found in MapOfAliasComputers") ; + } + else { + MESSAGE("Manager_Impl::SearchComputer " << aComputerName << " NOT found in MapOfAliasComputers") ; + } + i = _MapOfFullNameComputers[ aComputerName ] ; + if ( i ) { + aComputer = _ComputersList[ i - 1 ] ; + MESSAGE("Manager_Impl::SearchComputer " << aComputerName << " found in MapOfFullNameComputers") ; + } + else { + MESSAGE("Manager_Impl::SearchComputer " << aComputerName << " NOT found in MapOfFullNameComputers") ; } - MESSAGE("Manager_Impl::SearchComputer()") ; return Resources::Computer::_duplicate( aComputer ) ; } diff --git a/src/ResourcesManager/ResourcesManager_Impl.hxx b/src/ResourcesManager/ResourcesManager_Impl.hxx index d31476422..bbbe564b0 100755 --- a/src/ResourcesManager/ResourcesManager_Impl.hxx +++ b/src/ResourcesManager/ResourcesManager_Impl.hxx @@ -57,7 +57,9 @@ class Manager_Impl : public POA_Resources::Manager , vector< Computer_Impl * > _ComputersVector ; Resources::ListOfComputers_var _ComputersList ; - map< string , int > _MapOfComputers ; + + map< string , int > _MapOfFullNameComputers ; + map< string , int > _MapOfAliasComputers ; // virtual Resources::ListOfComputers_var ParseXmlFile( const char * xmlfile ) ; virtual void ParseXmlFile( const char * xmlfile ) ; diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index 84cb2949f..a18a3bdc3 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -105,8 +105,8 @@ LIB_SRC = \ # Executables targets BIN = SALOMEDS_Server SALOMEDS_Client BIN_SRC = -LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl -BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl +LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_Component.idl ContainersManager.idl +BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl ContainersManager.idl BIN_CLIENT_IDL = CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) diff --git a/src/SALOMEGUI/Makefile.in b/src/SALOMEGUI/Makefile.in index 08d0682d3..6cf16aaeb 100644 --- a/src/SALOMEGUI/Makefile.in +++ b/src/SALOMEGUI/Makefile.in @@ -215,7 +215,8 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOMEDS_Attributes.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject diff --git a/src/SALOME_PY/Makefile.in b/src/SALOME_PY/Makefile.in index f99d2e4ed..c0883e71f 100644 --- a/src/SALOME_PY/Makefile.in +++ b/src/SALOME_PY/Makefile.in @@ -41,7 +41,9 @@ LIB_SRC = SalomePy.cxx LIB_CLIENT_IDL = SALOMEDS.idl \ SALOMEDS_Attributes.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + SALOME_Component.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) -DHAVE_CONFIG_H LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeGUI -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython -lVTKViewer diff --git a/src/SALOME_PYQT/Makefile.in b/src/SALOME_PYQT/Makefile.in index 146f123c1..0dabee81e 100644 --- a/src/SALOME_PYQT/Makefile.in +++ b/src/SALOME_PYQT/Makefile.in @@ -46,7 +46,9 @@ LIB_SRC += SalomePyQt.cxx SALOME_PYQT_GUI.cxx $(SIP_SRC) $(MOC_SRC) EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py -LIB_CLIENT_IDL = SALOME_Exception.idl +LIB_CLIENT_IDL = SALOME_Exception.idl \ + SALOME_Component.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS) diff --git a/src/SUPERVGraph/Makefile.in b/src/SUPERVGraph/Makefile.in index 3edb511e4..e658192cb 100644 --- a/src/SUPERVGraph/Makefile.in +++ b/src/SUPERVGraph/Makefile.in @@ -22,7 +22,8 @@ LIB_MOC = SUPERVGraph_moc.cxx \ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) diff --git a/src/Session/Makefile.in b/src/Session/Makefile.in index 36ba65dde..a9f12811c 100644 --- a/src/Session/Makefile.in +++ b/src/Session/Makefile.in @@ -47,7 +47,7 @@ LIB_SRC=\ BIN = SALOME_Session_Server BIN_SRC = BIN_SERVER_IDL = SALOME_Session.idl -BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl +BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl ContainersManager.idl CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) diff --git a/src/TOOLSGUI/Makefile.in b/src/TOOLSGUI/Makefile.in index 03a986861..d80f0adfe 100644 --- a/src/TOOLSGUI/Makefile.in +++ b/src/TOOLSGUI/Makefile.in @@ -51,7 +51,9 @@ LIB_SRC = ToolsGUI.cxx \ LIB_MOC = ToolsGUI_moc.cxx \ ToolsGUI_CatalogGeneratorDlg_moc.cxx -LIB_CLIENT_IDL = SALOME_Exception.idl +LIB_CLIENT_IDL = SALOME_Exception.idl \ + SALOME_Component.idl \ + ContainersManager.idl # additionnal information to compil and link file diff --git a/src/VTKViewer/Makefile.in b/src/VTKViewer/Makefile.in index 0733c58b9..4a848a672 100644 --- a/src/VTKViewer/Makefile.in +++ b/src/VTKViewer/Makefile.in @@ -60,7 +60,8 @@ LIB_MOC = \ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + ContainersManager.idl CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) CXXFLAGS+= -- 2.39.2