-# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
orbmodule.py
ORBConfigFile.py
parseConfigFile.py
- runSalome
+ PortManager.py
runSalome.py
runSession.py
runConsole.py
waitNS.py
)
-IF(SALOME_USE_PORTMANAGER)
- SET(PORTMANAGER_SCRIPTS
- PortManager.py
- )
- LIST(APPEND SCRIPTS ${PORTMANAGER_SCRIPTS})
-ENDIF()
-
SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${SALOME_INSTALL_SCRIPT_SCRIPTS})
#!/bin/bash
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#clean appli
-DELCOM="rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py runAppli runConsole runSession runRemote.sh SalomeApp.xml runSalomeScript update_catalogs.py kill_remote_containers.py salome *.pyc *~ .bashrc"
+DELCOM="rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py runRemote.sh SalomeApp.xml update_catalogs.py kill_remote_containers.py salome *.pyc *~ .bashrc"
DOIT="false"
if [ $# -gt 0 ]
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
for fn in ('envd',
'getAppliPath.py',
'kill_remote_containers.py',
- 'runAppli', # OBSOLETE (replaced by salome)
- 'runConsole', # OBSOLETE (replaced by salome)
'runRemote.sh',
- 'runSalomeScript', # OBSOLETE (replaced by salome)
- 'runSession', # OBSOLETE (replaced by salome)
'salome',
'update_catalogs.py',
'.bashrc',
-# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
SET(SCRIPTS
envd
runRemote.sh
- runAppli
- runConsole
- runSession
- runSalomeScript
.bashrc
getAppliPath.py
update_catalogs.py
+++ /dev/null
-#!/bin/bash
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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, or (at your option) any later version.
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-
-###############################################
-############### IMPORTANT NOTE ################
-###############################################
-# The runAppli script is obsolete. #
-# Please consider the new salome launcher. #
-###############################################
-
-
-#APPLI_HOME=`dirname $0`
-APPLI_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
-
-export APPLI=`${APPLI_HOME}/getAppliPath.py`
-
-# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
-
-. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
-
-#export OMNIORB_USER_PATH="${HOME}/.salomeConfig/USERS"
-export OMNIORB_USER_PATH="${HOME}/${APPLI}/USERS"
-
-# --- if mpi lam, start lam (seems safe to be done several times)
-# (manual stop with lamhalt)
-
-if [ "$LAMBHOST" ]; then
- lamboot
-fi
-
-# --- run SALOME
-# (default arguments defined in local SalomeApp.xml could be completed
-# by arguments to this command)
-
-if [ $# -ne 0 ] ; then
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
-
-else
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
-fi
+++ /dev/null
-#!/bin/bash
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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, or (at your option) any later version.
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-
-###############################################
-############### IMPORTANT NOTE ################
-###############################################
-# The runConsole script is obsolete. #
-# Please consider the new salome launcher. #
-###############################################
-
-
-APPLI_HOME=`dirname $0`
-
-# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
-
-export APPLI=`${APPLI_HOME}/getAppliPath.py`
-
-# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
-
-. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
-
-#export OMNIORB_USER_PATH="${HOME}/.salomeConfig/USERS"
-export OMNIORB_USER_PATH="${HOME}/${APPLI}/USERS"
-
-# --- open a Python interpreter with SALOME environment
-
-${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/salomeConsole.py $*
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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, or (at your option) any later version.
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-###############################################
-############### IMPORTANT NOTE ################
-###############################################
-# The runSalomeScript script is obsolete. #
-# Please consider the new salome launcher. #
-###############################################
-
-import os,sys,optparse
-import socket,shutil
-import re
-
-usage="""
- Connect to a SALOME session (local or remote) and execute a Python script with data files in argument (optional)
-
- Usage: %prog [ options ] script
-
- script : The Python script to execute in the SALOME session
-
- SALOME SESSION
- --------------
- If PORT and MACHINE are not given, try to connect to the last active session on the local machine
- If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE
- If MACHINE is not given, try to connect to the session associated to PORT on the local machine
- If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE
-
- If MACHINE isn't localhost or hostname, USER is needed
-
- If Salome isn't installed on the local machine, use APPLI_DIST to execute a distant session
-
-
- INPUTS AND OUPUTS
- -----------------
- script is needed in all case
- INPUT and OUTPUT are used only when Salome isn't on local machine. It defines a list of script (full path, blank separated)
- Actions done with these two lists are :
- - adjustment of path in a temporary script file
- - copy of the input files and script file on the distant machine
-
-"""
-
-appli_local=os.path.realpath(os.path.dirname(__file__))
-
-def get_hostname():
- return socket.gethostname().split('.')[0]
-
-def vararg_callback(option, opt_str, value, parser):
- """optparse callback for variable length arguments"""
- assert value is None
-
- done = 0
- value = []
- rargs = parser.rargs
- while rargs:
- arg = rargs[0]
-
- # Stop if we hit an arg like "--foo", "-a", "-fx", "--file=f",
- # etc. Note that this also stops on "-3" or "-3.0", so if
- # your option takes numeric values, you will need to handle this.
- if ((arg[:2] == "--" and len(arg) > 2) or
- (arg[:1] == "-" and len(arg) > 1 and arg[1] != "-")):
- break
- else:
- value.append(arg)
- del rargs[0]
-
- setattr(parser.values, option.dest, value)
-
-def parse_args():
- """parse arguments, check validity and set defaults"""
- parser = optparse.OptionParser(usage=usage)
- parser.add_option('-p','--port', dest="port", default='', help="The port to connect to")
- parser.add_option('-m','--machine', dest="machine", default='', help="The computer to connect to")
- parser.add_option('-d','--directory', dest="directory", help="[Distant Mode] The APPLI_HOME path on the distant machine (must be used if Salome isn't on the local machine)")
- parser.add_option('-u','--user', dest="user", default='', help="[Distant Mode] The user on the computer to connect to")
- parser.add_option('-i','--infiles', dest="infiles", default=[], action="callback", callback=vararg_callback,
- help="[Distant Mode] The list of input files (blank separated) used in the Python script")
- parser.add_option('-o','--outfiles', dest="outfiles", default=[], action="callback", callback=vararg_callback,
- help="[Distant Mode] The list of output files (blank separated) generated by the Python script")
-
- args=sys.argv[1:]
-
- script=""
- if args:
- script=args.pop()
-
- options, args = parser.parse_args(args)
-
- #check the arguments
- if not os.path.exists(script):
- print "ERROR: the script file is mandatory"
- sys.exit(1)
-
- machine=options.machine
- port=options.port
- user=options.user
- infiles = options.infiles
- outfiles = options.outfiles
- directory=options.directory
-
- mode="local"
-
- if machine:
- here=get_hostname()
- if machine != here and machine != "localhost":
- #SALOME server is on a remote computer
- mode="remote"
-
- if not user:
- print "ERROR: the remote execution needs -u user argument"
- sys.exit(1)
-
- if not os.path.exists(os.path.join(appli_local,"runSession")):
- if not directory:
- print "ERROR: the remote execution without SALOME installation needs -d directory argument"
- sys.exit(1)
-
- return mode,user,machine,port,directory,infiles,outfiles,script
-
-def copy_files(user,machine,script,infiles,outfiles,directory):
- """modify script, copy files to remote computer and return lists of copied files"""
-
- namescript=os.path.basename(script)
- import getpass
- logname = getpass.getuser()
- tmp_script="/tmp/%s_%s_%s" % (logname,os.getpid(),namescript)
- with open(script, 'r') as fscript:
- script_text=fscript.read()
-
- list_infiles=[]
- list_outfiles=[]
-
- n=0
- for infile in infiles:
- # generate a temporary file name
- namefile=os.path.basename(infile)
- tmp_file="/tmp/%s_%s_i%s_%s" % (logname,os.getpid(),n,namefile)
-
- #modify the salome script
- script_text = re.sub(infile,tmp_file,script_text)
-
- # copy the infile to the remote server
- cmd="scp %s %s@%s:%s" % (infile,user,machine,tmp_file)
- print "[ SCP ]",cmd
- os.system(cmd)
-
- list_infiles.append(tmp_file)
- n=n+1
-
- n=0
- for outfile in outfiles:
- # generate a temporary file name
- namefile=os.path.basename(outfile)
- tmp_file="/tmp/%s_%s_o%s_%s" % (logname,os.getpid(),n,namefile)
-
- #modify the salome script
- script_text = re.sub(outfile,tmp_file,script_text)
-
- list_outfiles.append(tmp_file)
- n=n+1
-
- with open(tmp_script,'w') as fscript:
- fscript.write(script_text)
-
- if directory:
- #copy the salome script on the remote server
- cmd="scp %s %s@%s:%s" % (tmp_script,user,machine,tmp_script)
- print "[ SCP ]",cmd
- os.system(cmd)
-
- return list_infiles, list_outfiles, tmp_script
-
-def main():
-
- mode,user,machine,port,directory,infiles,outfiles,script = parse_args()
-
- tmp_script=script
-
- if mode == "remote":
- list_infiles, list_outfiles, tmp_script = copy_files(user,machine,script,infiles,outfiles,directory)
-
- #################################################
- # Execution #
- #################################################
- if mode == "remote":
- print "[ REMOTE ]"
-
- # execute runSession from the remote SALOME application
- cmd="ssh %s@%s %s/runSession " % (user,machine,directory)
- if port:
- cmd=cmd+"-p %s "%port
- cmd = cmd +"python " + tmp_script
- print '[ SSH ] ' + cmd
- os.system(cmd)
-
- else:
- print "[ LOCAL ]"
-
- # execute runSession from the local SALOME application
- cmd="%s/runSession " % appli_local
- if machine:
- cmd=cmd+"-m %s "%machine
- if port:
- cmd=cmd+"-p %s "%port
- cmd = cmd +"python " + tmp_script
- print '[ SH ] ' + cmd
- os.system(cmd)
-
- #################################################
- # Get remote files and clean #
- #################################################
- if mode == "remote":
- temp_files=list_infiles+list_outfiles+[tmp_script]
-
- #get the outfiles
- for outfile in outfiles:
- remote_outfile=list_outfiles.pop(0)
- cmd="scp %s@%s:%s %s" %(user,machine,remote_outfile,outfile)
- print "[ SCP ] "+cmd
- os.system(cmd)
-
- #clean temporary files
- cmd="ssh %s@%s \\rm -f %s" % (user,machine," ".join(temp_files))
- print '[ SSH ] ' + cmd
- os.system(cmd)
- os.remove(tmp_script)
-
-if __name__ == '__main__':
- main()
+++ /dev/null
-#!/bin/bash
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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, or (at your option) any later version.
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# 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
-
-
-###############################################
-############### IMPORTANT NOTE ################
-###############################################
-# The runSession script is obsolete. #
-# Please consider the new salome launcher. #
-###############################################
-
-
-APPLI_HOME=`dirname $0`
-
-NSPORT=last
-NSHOST=localhost
-
-usage()
-{
- echo "Connect to a SALOME session (local or remote)"
- echo ""
- echo "Usage: $(basename $0) [ -p PORT ] [ -m MACHINE ] [ -h ] [command]"
- echo ""
- echo " -p PORT : The port to connect to "
- echo " -m MACHINE : The machine to connect to "
- echo " -h : Print this message"
- echo " command : The command to execute in the SALOME session"
- echo ""
- echo "If the command is not given a shell is opened"
- echo "If PORT and MACHINE are not given, try to connect to the last active session on the local machine"
- echo "If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE"
- echo "If MACHINE is not given, try to connect to the session associated to PORT on the local machine"
- echo "If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE"
- echo ""
-}
-
-while getopts 'm:p:h' OPTION
- do
- case $OPTION in
- m)NSHOST="$OPTARG" ;;
- p)NSPORT="$OPTARG" ;;
- h|?) usage
- exit 1 ;;
- esac
- done
-shift $(($OPTIND - 1))
-
-# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
-
-export APPLI=`${APPLI_HOME}/getAppliPath.py`
-
-# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
-
-. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
-
-#export OMNIORB_USER_PATH="${HOME}/.salomeConfig/USERS"
-export OMNIORB_USER_PATH="${HOME}/${APPLI}/USERS"
-
-# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
-# Usage: writeConfigFile PORT HOST
-function writeConfigFile
-{
- if [ $# -ne 2 ]; then
- echo "Usage: $0 PORT HOST"
- return
- fi
- export NSPORT=$1
- export NSHOST=$2
-
- # Get (in bash) the configuration filename from (Python) ORBConfigFile return values
- RETURN_VALUES=$(${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ORBConfigFile.py ${OMNIORB_USER_PATH} ${NSHOST} ${NSPORT} with_username=${USER})
- export OMNIORB_CONFIG=$(echo ${RETURN_VALUES} | cut -d' ' -f1)
-}
-
-
-if test "x${NSPORT}" == "xlast"; then
- #PORT is not given
- if test "x${NSHOST}" == "xlocalhost"; then
- #MACHINE and PORT are not given
- # --- set omniORB configuration to current session if any
- fileOmniConfig=${OMNIORB_USER_PATH}/.omniORB_${USER}_last.cfg
- if [ -f $fileOmniConfig ]; then
- export OMNIORB_CONFIG=${OMNIORB_USER_PATH}/.omniORB_${USER}_last.cfg
- # --- set environment variables for port and hostname of NamingService
- export NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
- export NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
- fi
- else
- #MACHINE is given PORT is not given
- writeConfigFile 2810 ${NSHOST}
- fi
-else
- #PORT is given
- if test "x${NSHOST}" == "xlocalhost"; then
- #MACHINE is not given PORT is given
- NSHOST=`hostname`
- fi
- writeConfigFile ${NSPORT} ${NSHOST}
-fi
-
-# --- invoke shell with or without args
-
-if [ $# -ne 0 ] ; then
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py -exec $*
-else
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
-fi
+++ /dev/null
-#!/bin/bash
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 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, or (at your option) any later version.
-#
-# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-
-###############################################
-############### IMPORTANT NOTE ################
-###############################################
-# The runSalome script is obsolete. #
-# Please consider the new salome launcher. #
-###############################################
-
-
-# **********************************************************
-# This file is used by m4 files in many modules to detect SALOME KERNEL.
-# Its initial purpose (starting salome) can be replaced by new salome command.
-# When definitively switching from autotools to Cmake, this file may be removed.
-# **********************************************************
-
-
-
-${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
-
-
-
-
-# -----------------------------------------------------------------------------
-# examples:
-# ---------
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome
-#
-# - parameters for launching are taken from SalomeApp.xml;
-# - if the config file does not exist, it is created with default values.
-#
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog --standalone=cppContainer --xterm --killall
-#
-# - parameters from command line supersede those from SalomeApp.xml
-#
-# Some CORBA servers can be launched in the SALOME_Session_Server's process
-# (embedded = same process) or in a separate process (standalone).
-# In above example, Registry, Study and Module Catalog servers are started
-# in the embedded mode; default C++ container (FactoryServer) is started in
-# the standalone mode.
-#
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
-#
-# - print help on the runSalome command
-# -----------------------------------------------------------------------------
-#
-# The -i option starts Python interpreter after launching SALOME session
-# (see runSalome.py script).
-# Logger server is optional.
-#
-# -----------------------------------------------------------------------------
See \subpage SALOME_Application to define your own configuration of %SALOME and run it
on one or several computers. This is the recommended way of configuration.
-# <b>How to launch %SALOME</b>:
- - Using a python launcher like the \subpage salome_command.
- - <i>Deprecated:</i> Using the shell launchers (runAppli, runSession, runConsole...) alongside configuration files (*.cfg or *.sh),
- - <i>Deprecated:</i> Using \c runSalome script, see \subpage running_salome_page
+ - Using the python \subpage salome_command.
-# <b>How to use KERNEL services in Python scripts</b>\n
The %SALOME KERNEL offers a list of services available in Python. See \subpage KERNEL_Services.
-# <b>How to use KERNEL services from a C++ context</b>\n
\page running_salome_page Running Salome
-There are two ways to run %SALOME:
+To run %SALOME, use the python \ref salome_command.
-1) Using a python launcher.
+Using this command, you DO NOT need to first set-up proper environment for %SALOME; all is done by the command itself.
-For more details see \ref salome_command.
-
-2) Deprecated : Using shell launchers.
-
-For more details see \ref SALOME_Application.
-
-3) Deprecated : Using <b>\c %runSalome</b> script supplied with %SALOME KERNEL module distribution.
-
-To launch %SALOME using \c %runSalome script, you have first to
-set-up proper environment for %SALOME. If you installed %SALOME using
-%SALOME Installation Wizard (Linux), you can use \c salome.sh or
-\c salome.csh script (that is located in the \c KERNEL_<version>
-directory of your %SALOME installation), for example:
-
-\code
-cd /home/user/salome_6.5.0/KERNEL_6.5.0
-source salome.csh
-\endcode
-
-Launch %SALOME session using the \c %runSalome script located
-in the \c SALOME/KERNEL/bin/salome directory:
+Launch %SALOME session using the following command:
\code
-runSalome [options] [STUDY_FILE] [PYTHON_FILE [PYTHON_FILE ...]]
+salome start [options] [STUDY_FILE] [PYTHON_FILE [args] [PYTHON_FILE [args]...]]
\endcode
Optionally, you can specify in the command line:
- Study (document) file to be opened in %SALOME session passing;
- One or more Python scripts to be executed after %SALOME
start-up. Python scripts will be executed in the new or opened study
- in the order they appear in the command line.
+ in the order they appear in the command line. Passing args to these scripts
+ is possible but require a specific \c args: syntax (see \ref salome_command).
-The \c %runSalome script supports large set of options that allow
+This command supports large set of options that allow
specifying the way to launch %SALOME session. Complete description of
all options can be obtained using \c --help or -h option:
\code
-runSalome --help
+salome start --help
\endcode
Here below is a description of most important options:
- \c --help or \c -h
-Print detail help information on the \c %runSalome script.
+Print detail help information on the command.
- \c --version
Parse application settings from the <file> instead of default resource
file. Default resource file is situated in user's home directory; for
-example, for %SALOME version 6.5.0, the file is ${HOME}/.config/salome/.SalomeApprc.6.5.0
+example, for %SALOME version 6.5.0, the file is ${HOME}/.config/salome/.SalomeApprc.6.5.0
- \c --modules=module1,module2,... or \c -m=module1,module2,...
-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifdef WIN32
# include <io.h>
#endif
-BatchTest::BatchTest(const Engines::ResourceDefinition& batch_descr)
+BatchTest::BatchTest(const Engines::ResourceDefinition& batch_descr)
{
#ifdef WITH_LIBBATCH
_batch_descr = batch_descr;
BatchTest::test()
{
bool rtn = false;
- INFOS(std::endl
+ INFOS(std::endl
<< "--- Testing batch Machine :" << std::endl
<< "--- Name : " << _batch_descr.hostname << std::endl
<< "--- hostname : " << _batch_descr.hostname << std::endl
<< "--- Submit mpi job : " << result_jobsubmit_mpi << std::endl
<< "--- Application : " << result_appli << std::endl
);
-
- if (result_connection == "OK" &&
+
+ if (result_connection == "OK" &&
result_filecopy == "OK" &&
result_getresult == "OK" &&
result_jobsubmit_simple == "OK" &&
result_jobsubmit_mpi == "OK" &&
result_appli == "OK")
rtn = true;
-
+
return rtn;
}
command = "scp";
if(protocol == "rsh")
command = "rcp";
- command += " " + username + "@" + hostname + ":" + home
+ command += " " + username + "@" + hostname + ":" + home
+ "/" + _base_filename + " " + _test_filename + "_copy";
// Test
result += oss.str();
return result;
}
-
+
// Compare files
std::ifstream src_file(_test_filename.c_str());
if (!src_file)
return result;
}
-std::string
-BatchTest::test_jobsubmit_simple()
+std::string
+BatchTest::test_jobsubmit_simple()
{
int status;
std::string home;
}
std::getline(file_job, jobid);
file_job.close();
-
+
// Wait the end of the job
command = protocol + " " + username + "@" + hostname + " qstat -f " + jobid + " > " + file_job_name;
bool stop = false;
- while (!stop)
+ while (!stop)
{
status = system(command.c_str());
if(status && status != 153 && status != 256*153)
command = "scp";
if(protocol == "rsh")
command = "rcp";
- command += " "
+ command += " "
+ username + "@" + hostname + ":" + home + "/" + _date + "_simple* /tmp";
status = system(command.c_str());
if(status) {
result += oss.str();
return result;
}
-
+
// Test results
std::string normal_input;
std::string file_normal_name = "/tmp/" + _date + "_simple_output.log";
return result;
}
-std::string
-BatchTest::test_jobsubmit_mpi()
+std::string
+BatchTest::test_jobsubmit_mpi()
{
#ifdef WITH_LIBBATCH
int status;
}
std::getline(file_job, jobid);
file_job.close();
-
+
// Wait the end of the job
command = protocol + " " + username + "@" + hostname + " qstat -f " + jobid + " > " + file_job_name;
bool stop = false;
- while (!stop)
+ while (!stop)
{
status = system(command.c_str());
if(status && status != 153 && status != 256*153)
command = "scp";
if(protocol == "rsh")
command = "rcp";
- command += " "
+ command += " "
+ username + "@" + hostname + ":" + home + "/" + _date + "_mpi* /tmp";
status = system(command.c_str());
if(status) {
result += oss.str();
return result;
}
-
+
// Test results
std::string normal_input;
std::string file_normal_name = "/tmp/" + _date + "_mpi_output.log";
return result;
}
result = "OK";
- return result;
+ return result;
#else
throw LauncherException("Method BatchTest::test_jobsubmit_mpi is not available "
"(libBatch was not present at compilation time)");
#endif
}
-std::string
+std::string
BatchTest::test_appli()
{
int status;
std::string username = _batch_descr.username.in();
std::string protocol = _batch_descr.protocol.in();
std::string applipath = _batch_descr.applipath.in();
-
+
// Getting home directory
std::string rst = get_home(&home);
if(rst != "") {
std::ofstream file_appli;
file_appli.open(_test_file_appli.c_str(), std::ofstream::out);
file_appli << "#!/bin/bash\n"
- << "if [ -f " << applipath << "/runAppli ]\n"
+ << "if [ -f " << applipath << "/salome ]\n"
<< "then\n"
<< " echo OK\n"
<< "else\n"
}
// Launch test
- command = protocol + " " + username + "@" + hostname
- + " sh " + home + "/" + _base_filename + "_appli_test > "
+ command = protocol + " " + username + "@" + hostname
+ + " sh " + home + "/" + _base_filename + "_appli_test > "
+ _test_filename + "_appli_test_result";
status = system(command.c_str());
}
std::getline(file_appli_result, rst_appli);
file_appli_result.close();
-
+
if (rst_appli != "OK")
{
result += "Error checking application on remote host ! result = " + rst;
std::string protocol = _batch_descr.protocol.in();
std::string file_home_name = _test_filename + "_home";
- command = protocol + " " + username + "@" + hostname + " 'echo $HOME' > " + file_home_name;
+ command = protocol + " " + username + "@" + hostname + " 'echo $HOME' > " + file_home_name;
status = system(command.c_str());
if(status) {
std::ostringstream oss;
-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifdef WIN32
#define setenv Kernel_Utils::setenv
-#endif
+#endif
// ============================================================================
/*!
setenv("SALOME_trace", "file:./traceUnitTest.log", 1); // 1: overwrite
- system("runSalome -t &");
+ system("salome -t &");
// --- Wait till SALOMEDS server is launched
-
+
char hostname[511];
int size;
gethostname(hostname, size);
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
CORBA::ORB_var orb = init(argc , argv ) ;
-
+
#ifndef WIN32
sleep(15);
#else
Sleep(15000);
#endif
-
+
std::string host; // = Kernel_Utils::GetHostname();
char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR");
- if(wait_Superv) host = Kernel_Utils::GetHostname();
+ if(wait_Superv) host = Kernel_Utils::GetHostname();
SALOME_NamingService NS(orb);
if(host.empty())
// Activate the objects. This tells the POA that the objects are ready to accept requests.
PortableServer::ObjectId_var aStudyManager_iid = poa->activate_object(aStudyManager_i);
aStudyManager_i->register_name("/myStudyManager_embedded");
-
+
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
}
-
+
// --- Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// --- Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
- controller.addListener( &result );
+ controller.addListener( &result );
// --- Add a listener that print dots as test run.
#ifdef WIN32
#else
CPPUNIT_NS::BriefTestProgressListener progress;
#endif
- controller.addListener( &progress );
+ controller.addListener( &progress );
// --- Get the top level suite from the registry
testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc);
//CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
CPPUNIT_NS::CompilerOutputter outputter( &result, testFile );
- outputter.write();
+ outputter.write();
// --- Run the tests.