From b19ce4cea6e1cb04a0f058b11467104817d78dd4 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 8 Jun 2005 13:56:30 +0000 Subject: [PATCH] PR: distributed SALOME Application concept --- Makefile.in | 7 +- bin/appliskel/CatalogResources.xml | 28 ++++ bin/appliskel/README | 42 ++++++ bin/appliskel/env.d/atFirst.sh | 62 +++++++++ bin/appliskel/env.d/envProducts.sh | 120 ++++++++++++++++ bin/appliskel/env.d/envSalome.sh | 22 +++ bin/appliskel/envd | 3 + bin/appliskel/runAppli | 53 +++++++ bin/appliskel/runConsole | 15 ++ bin/appliskel/runRemote.sh | 44 ++++++ bin/appliskel/runSession | 24 ++++ bin/appliskel/salome.launch | 32 +++++ bin/createAppli.sh | 7 + bin/runSalome | 1 + configure.in.base | 9 +- src/Container/SALOME_ContainerManager.cxx | 18 ++- .../SALOME_ContainerManagerServer.cxx | 6 + src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py | 5 + .../SALOME_ResourcesManager.cxx | 130 +++++++++++------- 19 files changed, 569 insertions(+), 59 deletions(-) create mode 100644 bin/appliskel/CatalogResources.xml create mode 100644 bin/appliskel/README create mode 100644 bin/appliskel/env.d/atFirst.sh create mode 100644 bin/appliskel/env.d/envProducts.sh create mode 100644 bin/appliskel/env.d/envSalome.sh create mode 100644 bin/appliskel/envd create mode 100755 bin/appliskel/runAppli create mode 100755 bin/appliskel/runConsole create mode 100755 bin/appliskel/runRemote.sh create mode 100755 bin/appliskel/runSession create mode 100755 bin/appliskel/salome.launch create mode 100755 bin/createAppli.sh diff --git a/Makefile.in b/Makefile.in index 5c92e402e..3eda287c4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,6 +96,7 @@ killSalomeWithPort.py \ runSalome \ runSalome.csh \ runNS.sh \ +createAppli.sh \ launchConfigureParser.py \ salome.launch \ envSalome.py \ @@ -171,6 +172,10 @@ install-include: $(include_list) done # install script in $(bindir) : +install-appliskel: + $(INSTALL) -d $(bindir) + cp -rp $(top_builddir)/bin/salome/appliskel $(bindir) + install-bin: $(BIN_SCRIPT) $(INSTALL) -d $(bindir) $(INSTALL_PROGRAM) $^ $(bindir) @@ -190,5 +195,5 @@ distclean-other: @MODULE@ -install: install-bin install-include install-make install-end +install: install-bin install-appliskel install-include install-make install-end diff --git a/bin/appliskel/CatalogResources.xml b/bin/appliskel/CatalogResources.xml new file mode 100644 index 000000000..8caed2bfb --- /dev/null +++ b/bin/appliskel/CatalogResources.xml @@ -0,0 +1,28 @@ + + + + + + + + diff --git a/bin/appliskel/README b/bin/appliskel/README new file mode 100644 index 000000000..3a0b1fead --- /dev/null +++ b/bin/appliskel/README @@ -0,0 +1,42 @@ +Set of scripts for a SALOME application +======================================= + +# - A SALOME application distributed on several computers needs APPLI +# directories on the same path ($APPLI) relative to $HOME directory +# of the user, on each computer. + +user scripts: +------------- + +runAppli : SALOME launch (idem runSalome but different name to avoid + confusion with ${KERNEL_ROOT_DIR}/bin/salome/runSalome + +runConsole : a python console in the current SALOME session environment + +runSession : a shell in SALOME environment, either interactive (without args) + or used to run a program (defined by given args) + +internal application scripts: +----------------------------- + +runRemote.sh : called from remote computer, via ssh, rsh... + used for instance to create container + +envd : sets SALOME application environment + called by other scripts + +The following files must be adapted to your environment and SALOME Application: +------------------------------------------------------------------------------- + +salome.launch - list of modules, options on server launch... +CatalogResources.xml - configuration of machines used in SALOME application + (no need of modules list and path here) + +env.d directory must contain the necessary files to source, to define +the SALOME Application environment : + ( envd script source these files in alphanumeric order ) + +For instance, + atFirst.sh - general presets + envProducts.sh - prerequisite SALOME environment + envSalome.sh - list of MODULE_ROOT_DIR diff --git a/bin/appliskel/env.d/atFirst.sh b/bin/appliskel/env.d/atFirst.sh new file mode 100644 index 000000000..0c6715f75 --- /dev/null +++ b/bin/appliskel/env.d/atFirst.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +#------------------------------------------------ +# to be sourced first, used in following scripts +#------------------------------------------------ + +export LD_LIBRARY_PATH="." +export PATH="/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/prascle/bin:." +export PYTHONPATH="" + +export RAC=${HOME} +export PAKSAL=/opt +export PUB=${RAC}/public +export TARP=${RAC}/tarpublic +export PYPACKAGES=${PUB}/site_packages + +# ------------------------------------------------ +# ---- gdb 5.3 + +export PATH=${PAKSAL}/gdb53/bin:${PATH} +export LD_LIBRARY_PATH=${PAKSAL}/gdb53/lib:${LD_LIBRARY_PATH} + +# ------------------------------------------------ +# ---- ddd 3.3.7 + +export PATH=${PAKSAL}/ddd337/bin:${PATH} +export LD_LIBRARY_PATH=${PAKSAL}/ddd337/lib:${LD_LIBRARY_PATH} + +# ------------------------------------------------ +# --- Java 1.4 + +export JDKHOME=${PUB}/j2sdk_nb/j2sdk1.4.2 +export JAVAHOME=${PUB}/j2sdk_nb/j2sdk1.4.2 +export PATH=${JAVAHOME}/bin:${PATH} +export LD_LIBRARY_PATH=${JAVAHOME}/lib:${LD_LIBRARY_PATH} +export LD_LIBRARY_PATH=${JAVAHOME}/jre/lib/i386:${LD_LIBRARY_PATH} +export LD_LIBRARY_PATH=${JAVAHOME}/jre/lib/i386/client:${LD_LIBRARY_PATH} + +# ------------------------------------------------ +# --- gsl -1.4 + +export GSLHOME=${PAKSAL}/gsl-1.4 +export PATH=${GSLHOME}/bin:${PATH} +export LD_LIBRARY_PATH=${GSLHOME}/lib:${LD_LIBRARY_PATH} + +# ------------------------------------------------ +# --- fltk 1.1.4 + +export FLTKHOME=${PAKSAL}/fltk114 +export PATH=${FLTKHOME}/bin:${PATH} +export LD_LIBRARY_PATH=${FLTKHOME}/lib:${LD_LIBRARY_PATH} + +# ------------------------------------------------ +# --- gmsh 1.48 + +export GMSHHOME=${PAKSAL}/gmsh148 +export PATH=${GMSHHOME}/bin:${PATH} + +# ------------------------------------------------ +# ---- tkcvs, tkdiffb, cvs + +export PATH=${PAKSAL}/tkcvs7.2/bin:${PAKSAL}/cvs1.11.14/bin:${PATH} diff --git a/bin/appliskel/env.d/envProducts.sh b/bin/appliskel/env.d/envProducts.sh new file mode 100644 index 000000000..aa0570562 --- /dev/null +++ b/bin/appliskel/env.d/envProducts.sh @@ -0,0 +1,120 @@ +#!/bin/sh + +# ------------------------------------------------ +# ---- openpbs + +export OPENPBS=/optroot/openpbs2316 +export PATH=${OPENPBS}/bin:${PATH} +export LD_LIBRARY_PATH=${OPENPBS}/lib:${LD_LIBRARY_PATH} + +#------------------------------------------------------------------------------ + +export INSTALL_ROOT=/home/prascle/PAL_SALOME141 +#------ gcc ------ +export GCC_ROOT=/usr +export CXX=${GCC_ROOT}/bin/g++ +export CC=${GCC_ROOT}/bin/gcc +## +#------ boost ------ +export BOOSTDIR=${INSTALL_ROOT}/boost-1.30.2 +## + +#------ tcltk ------ +export TCLHOME=/usr + +#------ Python ------ +export PYTHONHOME=/usr +export PYTHONPATH=${PYPACKAGES}:${PYTHONPATH} +## +#------ Qt ------ +#export QTDIR=/usr/lib/qt-3.0.5 +export QTDIR=/usr/lib/qt3-gcc3.2 +export PATH=${PATH}:${QTDIR}/bin +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QTDIR}/lib +## +#------ Sip ------ +export SIPDIR=/usr +export PYQTDIR=/usr +## +#------ PyQt ------ +export PYQT_SIPS=/usr/share/sip/qt +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/python2.2/site-packages +## +#------ Swig ------ +export SWIG_ROOT=${INSTALL_ROOT}/SWIG-1.3.17 +export PATH=${SWIG_ROOT}/bin:${PATH} +export LD_LIBRARY_PATH=${SWIG_ROOT}/lib:${LD_LIBRARY_PATH} +## +#------ OpenCascade ------ +export CASROOT=/opt/CAS52patch +export LD_LIBRARY_PATH=${CASROOT}/Linux/lib:${LD_LIBRARY_PATH} +export PATH=${CASROOT}/Linux/bin:${PATH} +# Variable for Foundation Classes : +export CSF_UnitsLexicon=${CASROOT}/src/UnitsAPI/Lexi_Expr.dat +export CSF_UnitsDefinition=${CASROOT}/src/UnitsAPI/Units.dat +# Variable for DataExchange : +export CSF_SHMessage=${CASROOT}/src/SHMessage +export CSF_XSMessage=${CASROOT}/src/XSMessage +# Variable for Font : +export CSF_MDTVFontDirectory=${CASROOT}/src/FontMFT +export CSF_MDTVTexturesDirectory=${CASROOT}/src/Textures +## +export CSF_LANGUAGE=us +export MMGT_CLEAR=1 +export CSF_EXCEPTION_PROMPT=1 +export CSF_StandardDefaults=${CASROOT}/src/StdResource +export CSF_PluginDefaults=${CASROOT}/src/StdResource +export CSF_XCAFDefaults=${CASROOT}/src/StdResource +export CSF_GraphicShr=${CASROOT}/Linux/lib/libTKOpenGl.so +export CSF_IGESDefaults=${CASROOT}/src/XSTEPResource +export CSF_STEPDefaults=${CASROOT}/src/XSTEPResource +## +#export TCLLIBPATH=$TCLHOME/lib +## +#------ Qwt ------ +export QWTHOME=${INSTALL_ROOT}/qwt-0.4.1 +export LD_LIBRARY_PATH=${QWTHOME}/lib:${LD_LIBRARY_PATH} +## +#------ Hdf ------ +export HDF5HOME=${INSTALL_ROOT}/hdf5-1.4.4 +export PATH=${HDF5HOME}/bin:$PATH +export LD_LIBRARY_PATH=${HDF5HOME}/lib:${LD_LIBRARY_PATH} +## +#------ Med ------ +export MED2HOME=/opt/med2.2.2 +export PATH=${MED2HOME}/bin:${PATH} +export LD_LIBRARY_PATH=${MED2HOME}/lib:${LD_LIBRARY_PATH} +## +#------ Vtk ------ +export VTKHOME=${INSTALL_ROOT}/VTK-4.2.2 +export PATH=${VTKHOME}/bin:${PATH} +export LD_LIBRARY_PATH=${VTKHOME}/lib/vtk:${LD_LIBRARY_PATH} +export PYTHONPATH=${VTKHOME}/lib/vtk:${VTKHOME}/lib/python2.2/site-packages/vtk_python:${PYTHONPATH} +## +#------ netgen ------ +export NETGENROOT=${INSTALL_ROOT}/netgen4.3 +export NETGEN_HOME=${INSTALL_ROOT}/netgen4.3 +## +#------ OmniORB ------ +export OMNIORBDIR=${INSTALL_ROOT}/omniORB-3.0.5 +export OMNIORB_CONFIG=${OMNIORBDIR}/.omniORB.cfg +export PYTHONPATH=${OMNIORBDIR}/lib/python:${OMNIORBDIR}/lib/i586_linux_2.0_glibc2.1:${PYTHONPATH} +export PATH=$OMNIORBDIR/bin/i586_linux_2.0_glibc2.1:$PATH +export LD_LIBRARY_PATH=$OMNIORBDIR/lib/i586_linux_2.0_glibc2.1:$LD_LIBRARY_PATH +## +#------ Numeric ------ +export PYTHONPATH=${INSTALL_ROOT}/Numeric-22.0/lib/python2.2/site-packages/Numeric:${PYTHONPATH} +## +#------ HappyDoc ------ +export PATH=${INSTALL_ROOT}/HappyDoc-r2_1/bin:${PATH} +export PYTHONPATH=${INSTALL_ROOT}/HappyDoc-r2_1/lib/python2.2/site-packages:${PYTHONPATH} +## +#------ Doxygen ------ +export PATH=${INSTALL_ROOT}/doxygen-1.3-rc2/bin:${PATH} +## +#------ Graphviz ------ +export PATH=${INSTALL_ROOT}/graphviz-1.9/bin:${PATH} +export LD_LIBRARY_PATH=${INSTALL_ROOT}/graphviz-1.9/lib/graphviz:${LD_LIBRARY_PATH} +## + +#------------------------------------------------------------------------------ diff --git a/bin/appliskel/env.d/envSalome.sh b/bin/appliskel/env.d/envSalome.sh new file mode 100644 index 000000000..a7ea9a389 --- /dev/null +++ b/bin/appliskel/env.d/envSalome.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# --- example to adapt to your own configuration --- +# +# --- envSalome.sh gives a set of MODULE_ROOT_DIR, to source +# --- you must at least define and export KERNEL_ROOT_DIR + +REPINST=/home/prascle/SALOME2/Install + +export KERNEL_ROOT_DIR=${REPINST}/KERNEL_V222_lc + +export GEOM_ROOT_DIR=${REPINST}/GEOM_V222_lc +export MED_ROOT_DIR=${REPINST}/MED_V222_lc +export SMESH_ROOT_DIR=${REPINST}/SMESH_V222_lc +export SUPERV_ROOT_DIR=${REPINST}/SUPERV_V222_lc +export VISU_ROOT_DIR=${REPINST}/VISU_V222_lc +export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V222_lc +export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V222_lc +export PYCALCULATOR_ROOT_DIR=${REPINST}/PYCALCULATOR_V222_lc +export PYHELLO_ROOT_DIR=${REPINST}/PYHELLO_V222_lc +export PYTIX_ROOT_DIR=${REPINST}/PYTIX_V222_lc + diff --git a/bin/appliskel/envd b/bin/appliskel/envd new file mode 100644 index 000000000..80261ada2 --- /dev/null +++ b/bin/appliskel/envd @@ -0,0 +1,3 @@ +#!/bin/bash + +for i in $1/env.d/*;do source ${i}; done diff --git a/bin/appliskel/runAppli b/bin/appliskel/runAppli new file mode 100755 index 000000000..e2d7e9721 --- /dev/null +++ b/bin/appliskel/runAppli @@ -0,0 +1,53 @@ +#!/bin/bash + +# --- retrieve APPLI path, relative to $HOME + +comName=`which $0` +APPLI=`echo ${HOME} \`dirname $comName\` | awk ' { print substr($2,length($1)+2) } '` +export APPLI + +# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) + +${HOME}/${APPLI}/envd ${HOME}/${APPLI} + +# --- define port for CORBA naming service + +searchFreePort() { + echo -n "Searching for a free port for naming service: " + export NSPORT=2810 + local limit=$NSPORT + let limit=limit+100 + while [ 1 ] + do + aRes=`netstat -ltn | grep -E :${NSPORT}` + if [ -z "$aRes" ]; then + echo ${NSPORT} - Ok + local myhost=`hostname` + export OMNIORB_CONFIG=${HOME}/$APPLI//.omniORB_${myhost}_${NSPORT}.cfg + export NSPORT + local initref="NameService=corbaname::"`hostname`":$NSPORT" + echo "ORBInitRef $initref" > $OMNIORB_CONFIG + break + fi + echo -n "${NSPORT} " + if [[ $NSPORT -eq $limit ]] ; then + echo + echo "Can't find a free port to launch omniNames" + echo "Try to kill the running servers and then launch SALOME again." + exit + fi + let NSPORT=NSPORT+1 + done +} + +# --- run SALOME +# (default arguments defined in local salome.launch could be completed +# by arguments to this command) + +searchFreePort + +if [ $# -ne 0 ] ; then + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* +else + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py +fi diff --git a/bin/appliskel/runConsole b/bin/appliskel/runConsole new file mode 100755 index 000000000..950caf62a --- /dev/null +++ b/bin/appliskel/runConsole @@ -0,0 +1,15 @@ +#!/bin/bash + +# --- retrieve APPLI path, relative to $HOME + +comName=`which $0` +APPLI=`echo ${HOME} \`dirname $comName\` | awk ' { print substr($2,length($1)+2) } '` +export APPLI + +# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) + +${HOME}/${APPLI}/envd ${HOME}/${APPLI} + +# --- open a Python interpreter with SALOME environment + +${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/salomeConsole.py $* diff --git a/bin/appliskel/runRemote.sh b/bin/appliskel/runRemote.sh new file mode 100755 index 000000000..868dab9d5 --- /dev/null +++ b/bin/appliskel/runRemote.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# --- run command in SALOME environment from remote call, ssh or rsh +# - SALOME configuration is defined by : +# - list of MODULE_ROOT_DIR +# - prerequisite environment +# - specific configuration for a particular SALOME application +# - These elements of configuration are defined locally on each computer +# in the directory APPLI: +# - A SALOME application distributed on several computers needs APPLI +# directories on the same path ($APPLI) relative to $HOME directory +# of the user, on each computer. +# +# --- call example (from cli76cd to cli76ce): +# ssh cli76ce ${APPLI}/runRemote.sh cli76cd 2810 SALOME_Container myContainerName +# +# --- local arguments +# $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable +# $1 : computer name for CORBA name service (where SALOME was launched) +# $2 : port for CORBA name service +# $3 and following : local command to execute, with args +# + +# --- retrieve APPLI path, relative to $HOME + +comName=`which $0` +APPLI=`echo ${HOME} \`dirname $comName\` | awk ' { print substr($2,length($1)+2) } '` +export APPLI + +# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) + +${HOME}/${APPLI}/envd ${HOME}/${APPLI} + +# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME + +export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_$1_$2.cfg +initref="NameService=corbaname::"$1":$2" +echo "ORBInitRef $initref" > $OMNIORB_CONFIG + +# --- execute the command in the SALOME environment + +shift 2 + +${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile $HOME/$APPLI/.bashrc -c "$*" diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession new file mode 100755 index 000000000..ec0486c63 --- /dev/null +++ b/bin/appliskel/runSession @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Useful shell to run executable progs or shells under Salome env +# Use it with args to run a program : runSession python -i myprog.py +# Use it without args to run an interactive shell under Salome env +# + +# --- retrieve APPLI path, relative to $HOME + +comName=`which $0` +APPLI=`echo ${HOME} \`dirname $comName\` | awk ' { print substr($2,length($1)+2) } '` +export APPLI + +# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) + +${HOME}/${APPLI}/envd ${HOME}/${APPLI} + +# --- invoque shell with or without args + +if [ $# -ne 0 ] ; then + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*" +else + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc +fi diff --git a/bin/appliskel/salome.launch b/bin/appliskel/salome.launch new file mode 100755 index 000000000..92c5eab6d --- /dev/null +++ b/bin/appliskel/salome.launch @@ -0,0 +1,32 @@ + + + yes + no + + no + yes + no + + + + + + + + + + + + + + + registry + study + moduleCatalog + cppContainer + + + pyContainer + supervContainer + + diff --git a/bin/createAppli.sh b/bin/createAppli.sh new file mode 100755 index 000000000..c6c4de072 --- /dev/null +++ b/bin/createAppli.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +comName=`which $0` +rep=`dirname $comName` + +cp -r $rep/appliskel $1 +chmod +x $1/*.sh $1/run* $1/envd diff --git a/bin/runSalome b/bin/runSalome index 7505e8b89..1112c8433 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -12,6 +12,7 @@ searchFreePort() { echo ${NSPORT} - Ok local myhost=`hostname` export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg + export NSPORT local initref="NameService=corbaname::"`hostname`":$NSPORT" echo "ORBInitRef $initref" > $OMNIORB_CONFIG break diff --git a/configure.in.base b/configure.in.base index 687d5d093..2b66e799c 100644 --- a/configure.in.base +++ b/configure.in.base @@ -436,13 +436,14 @@ dnl directory mkdir -p bin/salome cd bin/salome -for i in $ROOT_SRCDIR/bin/* +for i in `find $ROOT_SRCDIR/bin` do - local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` + local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR/bin,.,"` case "$local_bin" in *.in | *~) ;; - ./bin/CVS | ./bin/salome) ;; - *) $INSTALL $i .; echo $local_bin ;; + . | */CVS | */CVS/* | ./salome) ;; + ./appliskel |./appliskel/env.d) $INSTALL -d $local_bin ; echo $local_bin ;; + *) $INSTALL $i $local_bin; echo $local_bin ;; esac done cd $ROOT_BUILDDIR diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 77cebf354..cc6c5d752 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -13,6 +13,7 @@ const char *SALOME_ContainerManager::_ContainerManagerNameInNS="/ContainerManage SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb) { + MESSAGE("constructor"); _NS=new SALOME_NamingService(orb); PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa(); PortableServer::POAManager_var pman = root_poa->the_POAManager(); @@ -27,15 +28,18 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb) 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"); } SALOME_ContainerManager::~SALOME_ContainerManager() { + MESSAGE("destructor"); delete _NS; } void SALOME_ContainerManager::Shutdown() { + MESSAGE("Shutdown"); ShutdownContainers(); PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this); _default_POA()->deactivate_object(oid); @@ -45,6 +49,7 @@ void SALOME_ContainerManager::Shutdown() 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++) @@ -59,18 +64,20 @@ void SALOME_ContainerManager::ShutdownContainers() Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const char *containerName, const Engines::MachineList& possibleComputers) { + MESSAGE("FindOrStartContainer "< vector; string theMachine=_LoadManager.FindBest(possibleComputers); + SCRUTE(theMachine); string command; if(theMachine==GetHostname()) command=_ResManager.BuildCommandToLaunchLocalContainer(containerName); else command=_ResManager.BuildTempFileToLaunchRemoteContainer(theMachine,containerName); - _ResManager.RmTmpFile(); + //_ResManager.RmTmpFile(); int status=system(command.c_str()); if (status == -1) { MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)"); @@ -101,8 +108,10 @@ Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const char Engines::MachineList *SALOME_ContainerManager::GetFittingResources(const Engines::MachineParameters& params, const char *componentName) { + MESSAGE("GetFittingResources"); vector vec=_ResManager.GetFittingResources(params,componentName); Engines::MachineList *ret=new Engines::MachineList; + MESSAGE("Machine list length "<length(vec.size()); for(unsigned int i=0;iResolve(containerNameInNS.c_str()); @@ -130,8 +141,10 @@ Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *contai Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *containerName,const Engines::MachineList& possibleComputers) { + MESSAGE("FindContainer "<resolve_initial_references("RootPOA"); if(!CORBA::is_nil(obj)) @@ -35,5 +39,7 @@ int main(int argc, char* argv[]) }catch(...){ MESSAGE("Caught unknown exception."); } + END_OF(argv[0]); + delete myThreadTrace; } diff --git a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py index c8241085f..2cfb6d174 100644 --- a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py @@ -8,3 +8,8 @@ obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") comp=obj._narrow(Engines.TestComponent) comp.Coucou(1) +param={} +param['hostname']='cli76ce' +param['container_name']='myContainer' +smesh=lcc.FindElseLoadComponent(param,'SMESH') + diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index da3c89977..b9954ade1 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -15,6 +15,7 @@ #include #include +#include "utilities.h" #define MAX_SIZE_FOR_HOSTNAME 256; @@ -27,8 +28,12 @@ SALOME_ResourcesManager::SALOME_ResourcesManager(const char *xmlFilePath):_path_ SALOME_ResourcesManager::SALOME_ResourcesManager() { - _path_resources=getenv("KERNEL_ROOT_DIR"); - _path_resources+="/share/salome/resources/CatalogResources.xml"; +// _path_resources=getenv("KERNEL_ROOT_DIR"); +// _path_resources+="/share/salome/resources/CatalogResources.xml"; + _path_resources=getenv("HOME"); + _path_resources+="/"; + _path_resources+=getenv("APPLI"); + _path_resources+="/CatalogResources.xml"; ParseXmlFile(); } @@ -38,18 +43,26 @@ SALOME_ResourcesManager::~SALOME_ResourcesManager() vector SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params,const char *moduleName) throw(SALOME_Exception) { + MESSAGE("GetFittingResources"); vector ret; //To be sure that we search in a correct list. ParseXmlFile(); const char *hostname=(const char *)params.hostname; + SCRUTE(hostname); if(hostname[0]!='\0') { if(_resourcesList.find(hostname)!=_resourcesList.end()) - // params.hostame is in the list of resources so return it. - ret.push_back(hostname); + { + // params.hostame is in the list of resources so return it. + MESSAGE("hostname " << hostname << " in catalog"); + ret.push_back(hostname); + } else - //user specified an unknown hostame so notify to him. - throw SALOME_Exception("unknown host"); + { + ASSERT(0); + //user specified an unknown hostame so notify to him. + throw SALOME_Exception("unknown host"); + } } else // Search for available resources sorted by priority @@ -178,64 +191,77 @@ string SALOME_ResourcesManager::FindBest(const Engines::MachineList& listOfMachi string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer(const string& machine,const char *containerName) { - _TmpFileName=BuildTemporaryFileName(); - ofstream tempOutputFile; - tempOutputFile.open(_TmpFileName.c_str(),ofstream::out ); +// _TmpFileName=BuildTemporaryFileName(); +// SCRUTE(_TmpFileName); +// ofstream tempOutputFile; +// tempOutputFile.open(_TmpFileName.c_str(),ofstream::out ); + const ParserResourcesType& resInfo=_resourcesList[machine]; - tempOutputFile << "#! /bin/sh" << endl; - //set env vars - for(map::const_iterator iter=resInfo.ModulesPath.begin();iter!=resInfo.ModulesPath.end();iter++) - { - string curModulePath((*iter).second); - tempOutputFile << (*iter).first << "_ROOT_DIR="<< curModulePath << endl; - tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl; - tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl; - tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:" << curModulePath << "/lib/salome:" << curModulePath << "/lib/python2.2/site-packages/salome:"; - tempOutputFile << curModulePath << "/lib/python2.2/site-packages/salome/shared_modules:${PYTHONPATH}" << endl; - } - tempOutputFile << "export LD_LIBRARY_PATH" << endl; - tempOutputFile << "export PYTHONPATH" << endl; - tempOutputFile << "source " << resInfo.PreReqFilePath << endl; - // ! env vars - tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second << "/bin/salome/"; - if(Engines_Container_i::isPythonContainer(containerName)) - tempOutputFile << "SALOME_ContainerPy.py "; - else - tempOutputFile << "SALOME_Container "; - tempOutputFile << containerName << " -"; - AddOmninamesParams(tempOutputFile); - tempOutputFile << " &" << endl; - tempOutputFile.flush(); - tempOutputFile.close(); - chmod(_TmpFileName.c_str(),0x1ED); + +// tempOutputFile << "#! /bin/sh" << endl; +// //set env vars +// for(map::const_iterator iter=resInfo.ModulesPath.begin();iter!=resInfo.ModulesPath.end();iter++) +// { +// string curModulePath((*iter).second); +// tempOutputFile << (*iter).first << "_ROOT_DIR="<< curModulePath << endl; +// tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl; +// tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl; +// tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:" << curModulePath << "/lib/salome:" << curModulePath << "/lib/python2.2/site-packages/salome:"; +// tempOutputFile << curModulePath << "/lib/python2.2/site-packages/salome/shared_modules:${PYTHONPATH}" << endl; +// } +// tempOutputFile << "export LD_LIBRARY_PATH" << endl; +// tempOutputFile << "export PYTHONPATH" << endl; +// tempOutputFile << "source " << resInfo.PreReqFilePath << endl; +// // ! env vars +// tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second << "/bin/salome/"; +// if(Engines_Container_i::isPythonContainer(containerName)) +// tempOutputFile << "SALOME_ContainerPy.py "; +// else +// tempOutputFile << "SALOME_Container "; +// tempOutputFile << containerName << " -"; +// AddOmninamesParams(tempOutputFile); +// tempOutputFile << " &" << endl; +// tempOutputFile.flush(); +// tempOutputFile.close(); +// chmod(_TmpFileName.c_str(),0x1ED); //Build command string command; if(resInfo.Protocol==rsh) { command = "rsh "; - string commandRcp="rcp "; - commandRcp+=_TmpFileName; - commandRcp+=" "; - commandRcp+=machine; - commandRcp+=":"; - commandRcp+=_TmpFileName; - system(commandRcp.c_str()); +// string commandRcp="rcp "; +// commandRcp+=_TmpFileName; +// commandRcp+=" "; +// commandRcp+=machine; +// commandRcp+=":"; +// commandRcp+=_TmpFileName; +// system(commandRcp.c_str()); } else if(resInfo.Protocol==ssh) command = "ssh "; else throw SALOME_Exception("Unknown protocol"); - command+=machine; - _CommandForRemAccess=command; - command+=" "; - command+=_TmpFileName; - command += " > "; - command += "/tmp/"; - command += containerName; - command += "_"; +// command+=machine; +// _CommandForRemAccess=command; +// command+=" "; +// command+=_TmpFileName; +// command += " > "; +// command += "/tmp/"; +// command += containerName; +// command += "_"; +// command += machine; +// command += ".log &"; command += machine; - command += ".log &"; - cout << "Command is ... " << command << endl; + command += " ${HOME}/"; + command += getenv("APPLI"); + command += "/runRemote.sh "; + command += GetHostname(); + command += " "; + command += getenv("NSPORT"); + command += " SALOME_Container "; + command += containerName; + command += "&"; + MESSAGE( "Command is ... " << command); return command; } -- 2.39.2