From 4fd73b272bdfeb5a83cf2fb41491ecd78c37e9c6 Mon Sep 17 00:00:00 2001 From: Sorina Pop Date: Tue, 13 Sep 2016 13:04:27 +0200 Subject: [PATCH] integrated 3wires and 1D simulators; renamed existing one in circle --- bin/1D_CreaPhase.sh | 114 +++++++++++++++ bin/3wires_CreaPhase.sh | 114 +++++++++++++++ bin/circle_CreaPhase.sh | 114 +++++++++++++++ gasw/1D_CreaPhase.xml | 49 +++++++ gasw/3wires_CreaPhase.xml | 43 ++++++ gasw/circle_CreaPhase.xml | 51 +++++++ workflow/1D_CreaPhase.gwendia | 205 +++++++++++++++++++++++++++ workflow/3wires_CreaPhase.gwendia | 186 +++++++++++++++++++++++++ workflow/circle_CreaPhase.gwendia | 223 ++++++++++++++++++++++++++++++ 9 files changed, 1099 insertions(+) create mode 100755 bin/1D_CreaPhase.sh create mode 100755 bin/3wires_CreaPhase.sh create mode 100755 bin/circle_CreaPhase.sh create mode 100644 gasw/1D_CreaPhase.xml create mode 100644 gasw/3wires_CreaPhase.xml create mode 100644 gasw/circle_CreaPhase.xml create mode 100644 workflow/1D_CreaPhase.gwendia create mode 100644 workflow/3wires_CreaPhase.gwendia create mode 100644 workflow/circle_CreaPhase.gwendia diff --git a/bin/1D_CreaPhase.sh b/bin/1D_CreaPhase.sh new file mode 100755 index 0000000..0e0e6c2 --- /dev/null +++ b/bin/1D_CreaPhase.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# Functions # + +function info { + local D=`date` + echo [ INFO - $D ] $* +} + +function warning { + local D=`date` + echo [ WARN - $D ] $* +} + +function error { + local D=`date` + echo [ ERROR - $D ] $* >&2 +} + +function downloadLFN { + + local LFN=$1 + local LOCAL=${PWD}/`basename ${LFN}` + + info "getting file size and computing sendReceiveTimeout" + size=`lfc-ls -l ${LFN} | awk -F' ' '{print $5}'` + sendReceiveTimeout=`echo $[${size}/150/1024]` + if [ "$sendReceiveTimeout" = "" ] || [ $sendReceiveTimeout -le 900 ]; then echo "sendReceiveTimeout empty or too small, setting it to 900s"; sendReceiveTimeout=900; else echo "sendReceiveTimeout is $sendReceiveTimeout"; fi; + info "Removing file ${LOCAL} in case it is already here" + \rm -f ${LOCAL} + + info "Checking if the file is on local SE ${VO_BIOMED_DEFAULT_SE}" + local closeSURL=`lcg-lr lfn:${LFN} | grep ${VO_BIOMED_DEFAULT_SE}` + if [ "${closeSURL}" != "" ] + then + info "It is. Trying to download the file from there" + LINE="lcg-cp -v --connect-timeout 10 --sendreceive-timeout $sendReceiveTimeout --bdii-timeout 10 --srm-timeout 30 ${closeSURL} file:${LOCAL}" + info ${LINE} + ${LINE} &> lcg-log + if [ $? = 0 ] + then + info "lcg-cp worked fine" + lcg_source=`cat lcg-log | awk -F"://" '/Trying SURL srm/ {print $2}' | awk -F"/" '{print $1}'|awk -F":" '{print $1}'`; + lcg_destination=`hostname`; + lcg_time=`cat lcg-log | awk '/Transfer took/ {print $3$4}'`; + info "DownloadCommand=lcg-cp Source=$lcg_source Destination=$lcg_destination Size=$size Time=$lcg_time"; + return 0 + else + error "It failed, falling back on regular lcg-cp" + fi + else + info "It's not, falling back on regular lcg-cp" + fi + +info "Downloading file ${LFN}..." +LINE="lcg-cp -v --connect-timeout 10 --sendreceive-timeout $sendReceiveTimeout --bdii-timeout 10 --srm-timeout 30 lfn:${LFN} file:${LOCAL}" +info ${LINE} +${LINE} &> lcg-log +if [ $? = 0 ] +then + info "lcg-cp worked fine" + lcg_source=`cat lcg-log | awk -F"://" '/Trying SURL srm/ {print $2}' | awk -F"/" '{print $1}'|awk -F":" '{print $1}'`; + lcg_destination=`hostname`; + lcg_time=`cat lcg-log | awk '/Transfer took/ {print $3$4}'`; + info "DownloadCommand=lcg-cp Source=$lcg_source Destination=$lcg_destination Size=$size Time=$lcg_time"; +else + error "lcg-cp failed" + error "`cat lcg-log`" + return 1 +fi +\rm lcg-log +} + +# Arguments parsing # +RES=$1 +COMM_LINE=`echo "${@:2:$(($#-2))}"` +# Command-line construction # + +#echo "COMM line is $COMM_LINE" +#remove flags starting with -- +#BOUTIQUES_ARGS="$(echo ${COMM_LINE} | sed 's/[--][[:alpha:]]*/,/g')" +BOUTIQUES_ARGS="$(echo ${COMM_LINE} | sed 's/ , /, /g')" +#remove leading ,, +#BOUTIQUES_ARGS="$(echo ${BOUTIQUES_ARGS} | sed 's/^,, //g')" +BOUTIQUES_COMMAND_LINE="octave --silent --eval \"SimuPBI_unknown_1D_func(${BOUTIQUES_ARGS})\"" +echo "Boutiques COMM line is $BOUTIQUES_COMMAND_LINE" + + +#WARNING Cheating here : we know that outputs are written in dirOut +DIROUT="dirOut" +# Command-line execution # + +cat << DOCKERJOB > .dockerjob.sh +#!/bin/bash -l +cd /CreaPhase +${BOUTIQUES_COMMAND_LINE} +DOCKERJOB + +mkdir $DIROUT +chmod 755 .dockerjob.sh +#.dockerjob.sh script needs to be found in the workdir, ten we need to cd to /CreaPhase to be able to execute SimuPBI_circle_func +docker run --rm -v $PWD:/gasw-dir -v $PWD/$DIROUT:/CreaPhase/$DIROUT -v $PWD/../cache:$PWD/../cache -w /gasw-dir -u `id -u`:`id -g` camarasu/creaphase ./.dockerjob.sh + +if [ $? != 0 ] +then + echo "CreaPhase execution failed!" + exit 1 +fi + +tar -czvf result.tgz $DIROUT + + +echo "Execution of CreaPhase completed." + diff --git a/bin/3wires_CreaPhase.sh b/bin/3wires_CreaPhase.sh new file mode 100755 index 0000000..86f77dd --- /dev/null +++ b/bin/3wires_CreaPhase.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# Functions # + +function info { + local D=`date` + echo [ INFO - $D ] $* +} + +function warning { + local D=`date` + echo [ WARN - $D ] $* +} + +function error { + local D=`date` + echo [ ERROR - $D ] $* >&2 +} + +function downloadLFN { + + local LFN=$1 + local LOCAL=${PWD}/`basename ${LFN}` + + info "getting file size and computing sendReceiveTimeout" + size=`lfc-ls -l ${LFN} | awk -F' ' '{print $5}'` + sendReceiveTimeout=`echo $[${size}/150/1024]` + if [ "$sendReceiveTimeout" = "" ] || [ $sendReceiveTimeout -le 900 ]; then echo "sendReceiveTimeout empty or too small, setting it to 900s"; sendReceiveTimeout=900; else echo "sendReceiveTimeout is $sendReceiveTimeout"; fi; + info "Removing file ${LOCAL} in case it is already here" + \rm -f ${LOCAL} + + info "Checking if the file is on local SE ${VO_BIOMED_DEFAULT_SE}" + local closeSURL=`lcg-lr lfn:${LFN} | grep ${VO_BIOMED_DEFAULT_SE}` + if [ "${closeSURL}" != "" ] + then + info "It is. Trying to download the file from there" + LINE="lcg-cp -v --connect-timeout 10 --sendreceive-timeout $sendReceiveTimeout --bdii-timeout 10 --srm-timeout 30 ${closeSURL} file:${LOCAL}" + info ${LINE} + ${LINE} &> lcg-log + if [ $? = 0 ] + then + info "lcg-cp worked fine" + lcg_source=`cat lcg-log | awk -F"://" '/Trying SURL srm/ {print $2}' | awk -F"/" '{print $1}'|awk -F":" '{print $1}'`; + lcg_destination=`hostname`; + lcg_time=`cat lcg-log | awk '/Transfer took/ {print $3$4}'`; + info "DownloadCommand=lcg-cp Source=$lcg_source Destination=$lcg_destination Size=$size Time=$lcg_time"; + return 0 + else + error "It failed, falling back on regular lcg-cp" + fi + else + info "It's not, falling back on regular lcg-cp" + fi + +info "Downloading file ${LFN}..." +LINE="lcg-cp -v --connect-timeout 10 --sendreceive-timeout $sendReceiveTimeout --bdii-timeout 10 --srm-timeout 30 lfn:${LFN} file:${LOCAL}" +info ${LINE} +${LINE} &> lcg-log +if [ $? = 0 ] +then + info "lcg-cp worked fine" + lcg_source=`cat lcg-log | awk -F"://" '/Trying SURL srm/ {print $2}' | awk -F"/" '{print $1}'|awk -F":" '{print $1}'`; + lcg_destination=`hostname`; + lcg_time=`cat lcg-log | awk '/Transfer took/ {print $3$4}'`; + info "DownloadCommand=lcg-cp Source=$lcg_source Destination=$lcg_destination Size=$size Time=$lcg_time"; +else + error "lcg-cp failed" + error "`cat lcg-log`" + return 1 +fi +\rm lcg-log +} + +# Arguments parsing # +RES=$1 +COMM_LINE=`echo "${@:2:$(($#-2))}"` +# Command-line construction # + +#echo "COMM line is $COMM_LINE" +#remove flags starting with -- +#BOUTIQUES_ARGS="$(echo ${COMM_LINE} | sed 's/[--][[:alpha:]]*/,/g')" +BOUTIQUES_ARGS="$(echo ${COMM_LINE} | sed 's/ , /, /g')" +#remove leading ,, +#BOUTIQUES_ARGS="$(echo ${BOUTIQUES_ARGS} | sed 's/^,, //g')" +BOUTIQUES_COMMAND_LINE="octave --silent --eval \"SimuPBI_3WiresPhant_func(${BOUTIQUES_ARGS})\"" +echo "Boutiques COMM line is $BOUTIQUES_COMMAND_LINE" + + +#WARNING Cheating here : we know that outputs are written in dirOut +DIROUT="dirOut" +# Command-line execution # + +cat << DOCKERJOB > .dockerjob.sh +#!/bin/bash -l +cd /CreaPhase +${BOUTIQUES_COMMAND_LINE} +DOCKERJOB + +mkdir $DIROUT +chmod 755 .dockerjob.sh +#.dockerjob.sh script needs to be found in the workdir, ten we need to cd to /CreaPhase to be able to execute SimuPBI_circle_func +docker run --rm -v $PWD:/gasw-dir -v $PWD/$DIROUT:/CreaPhase/$DIROUT -v $PWD/../cache:$PWD/../cache -w /gasw-dir -u `id -u`:`id -g` camarasu/creaphase ./.dockerjob.sh + +if [ $? != 0 ] +then + echo "CreaPhase execution failed!" + exit 1 +fi + +tar -czvf result.tgz $DIROUT + + +echo "Execution of CreaPhase completed." + diff --git a/bin/circle_CreaPhase.sh b/bin/circle_CreaPhase.sh new file mode 100755 index 0000000..bf04443 --- /dev/null +++ b/bin/circle_CreaPhase.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# Functions # + +function info { + local D=`date` + echo [ INFO - $D ] $* +} + +function warning { + local D=`date` + echo [ WARN - $D ] $* +} + +function error { + local D=`date` + echo [ ERROR - $D ] $* >&2 +} + +function downloadLFN { + + local LFN=$1 + local LOCAL=${PWD}/`basename ${LFN}` + + info "getting file size and computing sendReceiveTimeout" + size=`lfc-ls -l ${LFN} | awk -F' ' '{print $5}'` + sendReceiveTimeout=`echo $[${size}/150/1024]` + if [ "$sendReceiveTimeout" = "" ] || [ $sendReceiveTimeout -le 900 ]; then echo "sendReceiveTimeout empty or too small, setting it to 900s"; sendReceiveTimeout=900; else echo "sendReceiveTimeout is $sendReceiveTimeout"; fi; + info "Removing file ${LOCAL} in case it is already here" + \rm -f ${LOCAL} + + info "Checking if the file is on local SE ${VO_BIOMED_DEFAULT_SE}" + local closeSURL=`lcg-lr lfn:${LFN} | grep ${VO_BIOMED_DEFAULT_SE}` + if [ "${closeSURL}" != "" ] + then + info "It is. Trying to download the file from there" + LINE="lcg-cp -v --connect-timeout 10 --sendreceive-timeout $sendReceiveTimeout --bdii-timeout 10 --srm-timeout 30 ${closeSURL} file:${LOCAL}" + info ${LINE} + ${LINE} &> lcg-log + if [ $? = 0 ] + then + info "lcg-cp worked fine" + lcg_source=`cat lcg-log | awk -F"://" '/Trying SURL srm/ {print $2}' | awk -F"/" '{print $1}'|awk -F":" '{print $1}'`; + lcg_destination=`hostname`; + lcg_time=`cat lcg-log | awk '/Transfer took/ {print $3$4}'`; + info "DownloadCommand=lcg-cp Source=$lcg_source Destination=$lcg_destination Size=$size Time=$lcg_time"; + return 0 + else + error "It failed, falling back on regular lcg-cp" + fi + else + info "It's not, falling back on regular lcg-cp" + fi + +info "Downloading file ${LFN}..." +LINE="lcg-cp -v --connect-timeout 10 --sendreceive-timeout $sendReceiveTimeout --bdii-timeout 10 --srm-timeout 30 lfn:${LFN} file:${LOCAL}" +info ${LINE} +${LINE} &> lcg-log +if [ $? = 0 ] +then + info "lcg-cp worked fine" + lcg_source=`cat lcg-log | awk -F"://" '/Trying SURL srm/ {print $2}' | awk -F"/" '{print $1}'|awk -F":" '{print $1}'`; + lcg_destination=`hostname`; + lcg_time=`cat lcg-log | awk '/Transfer took/ {print $3$4}'`; + info "DownloadCommand=lcg-cp Source=$lcg_source Destination=$lcg_destination Size=$size Time=$lcg_time"; +else + error "lcg-cp failed" + error "`cat lcg-log`" + return 1 +fi +\rm lcg-log +} + +# Arguments parsing # +RES=$1 +COMM_LINE=`echo "${@:2:$(($#-2))}"` +# Command-line construction # + +#echo "COMM line is $COMM_LINE" +#remove flags starting with -- +#BOUTIQUES_ARGS="$(echo ${COMM_LINE} | sed 's/[--][[:alpha:]]*/,/g')" +BOUTIQUES_ARGS="$(echo ${COMM_LINE} | sed 's/ , /, /g')" +#remove leading ,, +#BOUTIQUES_ARGS="$(echo ${BOUTIQUES_ARGS} | sed 's/^,, //g')" +BOUTIQUES_COMMAND_LINE="octave --silent --eval \"SimuPBI_circle_func(${BOUTIQUES_ARGS})\"" +echo "Boutiques COMM line is $BOUTIQUES_COMMAND_LINE" + + +#WARNING Cheating here : we know that outputs are written in dirOut +DIROUT="dirOut" +# Command-line execution # + +cat << DOCKERJOB > .dockerjob.sh +#!/bin/bash -l +cd /CreaPhase +${BOUTIQUES_COMMAND_LINE} +DOCKERJOB + +mkdir $DIROUT +chmod 755 .dockerjob.sh +#.dockerjob.sh script needs to be found in the workdir, ten we need to cd to /CreaPhase to be able to execute SimuPBI_circle_func +docker run --rm -v $PWD:/gasw-dir -v $PWD/$DIROUT:/CreaPhase/$DIROUT -v $PWD/../cache:$PWD/../cache -w /gasw-dir -u `id -u`:`id -g` camarasu/creaphase ./.dockerjob.sh + +if [ $? != 0 ] +then + echo "CreaPhase execution failed!" + exit 1 +fi + +tar -czvf result.tgz $DIROUT + + +echo "Execution of CreaPhase completed." + diff --git a/gasw/1D_CreaPhase.xml b/gasw/1D_CreaPhase.xml new file mode 100644 index 0000000..6a79eef --- /dev/null +++ b/gasw/1D_CreaPhase.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +