--- /dev/null
+#! /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()
+
<parameters>
<fullname>xmen.saclay.opencascade.com</fullname>
<alias>xmen</alias>
- <sshaccess>1</sshaccess>
+ <sshaccess>0</sshaccess>
<interactive>1</interactive>
<batch>1</batch>
<username></username>
<parameters>
<fullname>bojolex.saclay.opencascade.com</fullname>
<alias>bojolex</alias>
- <sshaccess>0</sshaccess>
+ <sshaccess>1</sshaccess>
<interactive>1</interactive>
<batch>1</batch>
- <username></username>
+ <username>jr</username>
<os>Linux</os>
<memory>400</memory>
<swap>400</swap>
}
if ( !CORBA::is_nil( _ResourcesComputer ) ) {
string aUserName = _ResourcesManager->UserName( HostName ) ;
- if ( strlen( aUserName ) ) {
+ if ( aUserName.length() ) {
rsh += "-l " ;
rsh += aUserName ;
rsh += " " ;
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 )
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()
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()
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'
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 ;
virtual long SshAccess( const char * aComputerName ) ;
- virtual long UserName( const char * aComputerName ) ;
+ virtual char * UserName( const char * aComputerName ) ;
virtual Resources::ListOfComputers * AllComputers() ;