3 # Copyright (C) 2015-2016 CEA/DEN, EDF R&D, OPEN CASCADE
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 echo "This is a script that can be run concurrently."
23 echo "It takes as single argument the number of concurrent executions:"
24 echo "Usage: " $0 "<nb_execution> <output_folder>"
26 echo "Here is what executed code contents looks like:"
27 echo " - do some stuff"
28 echo " - run SALOME in terminal mode, and log port number to a file"
29 echo " - run some scripts (Python, binary), each in a dedicated SALOME session on a specific port"
30 echo " - do some stuff"
35 echo "Usage:" $0 "<nb_execution> <output_folder>"
43 if [ "x${SALOME_APPLI_FOLDER}" == "x" ]; then
44 echo "SALOME_APPLI_FOLDER variable is not set (or empty)."
45 echo "Try to locate SALOME launcher in current directory."
46 SALOME_APPLI_FOLDER=`pwd`
47 if ! [ -f ${SALOME_APPLI_FOLDER}/salome ]; then
48 echo "Unable to locate salome command."
54 WORK_DIR=`pwd` # a pushd has been done before calling this function
55 echo "Run command in folder:" ${WORK_DIR}
56 ${SALOME_APPLI_FOLDER}/salome start -t --ns-port-log=${WORK_DIR}/session.log
57 ${SALOME_APPLI_FOLDER}/salome shell -p `cat ${WORK_DIR}/session.log` ${SALOME_APPLI_FOLDER}/bin/salome/waitContainers.py
58 ${SALOME_APPLI_FOLDER}/salome shell -p `cat ${WORK_DIR}/session.log` ${BASE_DIR}/hello.py
59 ${SALOME_APPLI_FOLDER}/salome shell -p `cat ${WORK_DIR}/session.log` ${SALOME_APPLI_FOLDER}/bin/salome/killSalomeWithPort.py args:`cat ${WORK_DIR}/session.log`
60 echo "Execution terminated in folder:" ${WORK_DIR}
68 " > ${BASE_DIR}/hello.py
70 # Build output folders
71 typeset -i i=${NB_COMP}
74 mkdir -p ${OUTPUT_FOLDER}/execution_$i
79 typeset -i i=${NB_COMP}
82 pushd ${OUTPUT_FOLDER}/execution_$i > /dev/null