From: rahuel Date: Wed, 3 Mar 2004 08:47:04 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c28b29c660465ec92d6280c3fd5e75d78b209c1d;p=modules%2Fkernel.git *** empty log message *** --- diff --git a/bin/startContainer.py b/bin/startContainer.py new file mode 100755 index 000000000..7404838df --- /dev/null +++ b/bin/startContainer.py @@ -0,0 +1,78 @@ +#! /usr/bin/env python +# +# SALOME startContainer : implementation of container and engine for Kernel +# +# 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 +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : startContainer.py +# Author : Jean Rahuel, CEA +# Module : SALOME +# $Header: + +import os +import sys +import string +from omniORB import CORBA, PortableServer +import Containers +import Engines +from SALOME_NamingServicePy import * + +if sys.argv[1] == '--help' : + print 'USAGE : startContainer.py with_xterm HostName ContainerName ContainerType NSHostName NSHostPort' + print ' ContainerType : Engines.Cpp or Engines.Python' + sys.exit(0) + +orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) + +naming_service = SALOME_NamingServicePy_i(orb) + +MyContainersMgr = naming_service.Resolve("/Kernel/ContainersManager") +DefaultParams = MyContainersMgr.Parameters() +DefaultParams.with_xterm = int( sys.argv[1] ) +DefaultParams.HostName = sys.argv[2] +DefaultParams.ContainerName = sys.argv[3] +if sys.argv[4] == 'Engines.Cpp' : + DefaultParams.ContainerType = Engines.Cpp +elif sys.argv[4] == 'Engines.Python' : + DefaultParams.ContainerType = Engines.Python +else : + DefaultParams.ContainerType = Engines.Undefined +DefaultParams.NsHostName = sys.argv[5] +DefaultParams.NsPort = int( sys.argv[6] ) + +print "DefaultParameters :" +print "with_xterm :",DefaultParams.with_xterm +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 + +aContainer = MyContainersMgr.FindOrStartContainer( DefaultParams ) + +aContainer.ping() + diff --git a/resources/ResourcesCatalog.xml b/resources/ResourcesCatalog.xml index 1e45e8a2e..a48cf65d1 100644 --- a/resources/ResourcesCatalog.xml +++ b/resources/ResourcesCatalog.xml @@ -37,7 +37,7 @@ xmen.saclay.opencascade.com xmen - 1 + 0 1 1 @@ -73,10 +73,10 @@ bojolex.saclay.opencascade.com bojolex - 0 + 1 1 1 - + jr Linux 400 400 diff --git a/src/ContainersManager/ContainersManager_i.cxx b/src/ContainersManager/ContainersManager_i.cxx index 1502f1388..f8017c0f9 100644 --- a/src/ContainersManager/ContainersManager_i.cxx +++ b/src/ContainersManager/ContainersManager_i.cxx @@ -392,7 +392,7 @@ Engines::Container_ptr Manager_i::StartContainer( const Containers::MachineParam } if ( !CORBA::is_nil( _ResourcesComputer ) ) { string aUserName = _ResourcesManager->UserName( HostName ) ; - if ( strlen( aUserName ) ) { + if ( aUserName.length() ) { rsh += "-l " ; rsh += aUserName ; rsh += " " ; diff --git a/src/ContainersManager/TestContainersManager.py b/src/ContainersManager/TestContainersManager.py index 16569773a..45da74dd2 100644 --- a/src/ContainersManager/TestContainersManager.py +++ b/src/ContainersManager/TestContainersManager.py @@ -204,13 +204,13 @@ while i < len( Containers ) : i = i + 1 aContainer = MyContainersMgr.FindContainer( DefaultParams ) -print "Container running on",aContainer._get_machineName(),"with name",aContainer._get_name(),"and type",aContainers.type() +print "Container running on",aContainer._get_machineName(),"with name",aContainer._get_name(),"and type",aContainer.type() aContainer = MyContainersMgr.FindContainer( 'FactoryServer' ) ) -print "Container running on",aContainer._get_machineName(),"with name",aContainer._get_name(),"and type",aContainers.type() +print "Container running on",aContainer._get_machineName(),"with name",aContainer._get_name(),"and type",aContainer.type() aContainer = MyContainersMgr.FindContainer( 'localhost/FactoryServer' ) ) -print "Container running on",aContainer._get_machineName(),"with name",aContainer._get_name(),"and type",aContainers.type() +print "Container running on",aContainer._get_machineName(),"with name",aContainer._get_name(),"and type",aContainer.type() DefaultParams.ContainerType = Engines.Cpp Containers = MyContainersMgr.FindContainers( DefaultParams ) @@ -292,11 +292,9 @@ lcc = LifeCycleCORBA( orb ) lccMulComponent = lcc.FindOrLoadComponent( 'SuperVisionContainer' , "MulComponent" ) - print lccMulComponent.GetContainerRef()._get_name(),lccMulComponent._get_instanceName(),lccMulComponent._get_interfaceName() lccDivComponent = lcc.FindOrLoadComponent( 'DivComponentContainer' , "DivComponent" ) - print lccDivComponent.GetContainerRef()._get_name(),lccDivComponent._get_instanceName(),lccDivComponent._get_interfaceName() @@ -308,7 +306,6 @@ lccAddComponent = lcc.FindOrLoadComponent( DefaultParams , "AddComponent" ) print lccAddComponent.GetContainerRef()._get_name(),lccAddComponent._get_instanceName(),lccAddComponent._get_interfaceName() DefaultParams.ContainerName = 'SubComponentContainer' - lccSubComponent = lcc.FindOrLoadComponent( DefaultParams , "SubComponent" ) print lccSubComponent.GetContainerRef()._get_name(),lccSubComponent._get_instanceName(),lccSubComponent._get_interfaceName() @@ -342,7 +339,6 @@ aComponent = lcc.FindComponent( DefaultParams , 'SubComponent' ) print aComponent.GetContainerRef()._get_name(),aComponent._get_instanceName(),aComponent._get_interfaceName() lccMulComponent = lcc.FindOrLoadComponent( DefaultParams , "MulComponent" ) - print lccMulComponent.GetContainerRef()._get_name(),lccMulComponent._get_instanceName(),lccMulComponent._get_interfaceName() DefaultParams.HostName = 'bojolex' diff --git a/src/ResourcesManager/ResourcesManager_Impl.cxx b/src/ResourcesManager/ResourcesManager_Impl.cxx index c266a0a90..1ecc00cbe 100755 --- a/src/ResourcesManager/ResourcesManager_Impl.cxx +++ b/src/ResourcesManager/ResourcesManager_Impl.cxx @@ -94,35 +94,6 @@ long Manager_Impl::ping() { return 1 ; } -Resources::Computer_ptr Manager_Impl::TestComputer() { -#if 1 - Resources::ComputerParameters * aComputerParameters = new Resources::ComputerParameters() ; - aComputerParameters->FullName = CORBA::string_dup( "FullName" ) ; - aComputerParameters->Alias = CORBA::string_dup( "Alias" ) ; - aComputerParameters->SshAccess = 1 ; - aComputerParameters->Interactive = 1 ; - aComputerParameters->Batch = 1 ; - aComputerParameters->UserName = CORBA::string_dup( "UserName" ) ; - aComputerParameters->Os = Containers::Linux ; - aComputerParameters->Memory = 100 ; - aComputerParameters->Swap = 200 ; - aComputerParameters->CpuClock = 300 ; - aComputerParameters->NbProc = 1 ; - aComputerParameters->NbNode = 1 ; - Resources::ComputerEnvironment * aComputerEnvironment = new Resources::ComputerEnvironment() ; - aComputerEnvironment->Path = CORBA::string_dup( "Path" ) ; - aComputerEnvironment->Ld_Library_Path = CORBA::string_dup( "Ld_Library_Path" ) ; - aComputerEnvironment->PythonPath = CORBA::string_dup( "PythonPath" ) ; - aComputerEnvironment->CasRoot = CORBA::string_dup( "CasRoot" ) ; - Computer_Impl * aComputer = new Computer_Impl( _Orb , _Poa , - aComputerParameters , aComputerEnvironment ) ; - PortableServer::ObjectId * id = aComputer->getId() ; - CORBA::Object_var obj = _Poa->id_to_reference( *id ) ; - Resources::Computer_var iobject = Resources::Computer::_narrow( obj ) ; - return Resources::Computer::_duplicate( iobject ) ; -#endif -} - long Manager_Impl::SshAccess( const char * aComputerName ) { if ( !CORBA::is_nil( SearchComputer( aComputerName ) ) ) { return SearchComputer( aComputerName )->Parameters()->SshAccess ; diff --git a/src/ResourcesManager/ResourcesManager_Impl.hxx b/src/ResourcesManager/ResourcesManager_Impl.hxx index c170eb100..5c2a2c6dd 100755 --- a/src/ResourcesManager/ResourcesManager_Impl.hxx +++ b/src/ResourcesManager/ResourcesManager_Impl.hxx @@ -80,7 +80,7 @@ class Manager_Impl : public POA_Resources::Manager , virtual long SshAccess( const char * aComputerName ) ; - virtual long UserName( const char * aComputerName ) ; + virtual char * UserName( const char * aComputerName ) ; virtual Resources::ListOfComputers * AllComputers() ;