]> Creatis software - clitk.git/commitdiff
replace remote rsync with local
authorDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Thu, 9 Feb 2017 09:13:38 +0000 (10:13 +0100)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Thu, 9 Feb 2017 09:13:38 +0000 (10:13 +0100)
cluster_tools/gate_job_ccin2p3.job

index e4437808c250c5ca32aa46849860bda8416a4460..016b2368de00972fc3348668de2b7d56489b048d 100644 (file)
@@ -9,22 +9,34 @@
 # PARAM
 #
 #$ -P "P_creatis"
-#$ -l vmem=2G
+#$ -l vmem=4G
 #$ -l fsize=1G
 #$ -l ct=30:00:00
 #$ -j yes
 #$ -r no
 
+function transferJobData {
+    echo "Copying data back"
+    #ssh -i ${HOME}/.ssh/ccin2p3 linux1.dg.creatis.insa-lyon.fr "mkdir cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
+    #rsync -av --remove-source-files -e "ssh -i ${HOME}/.ssh/ccin2p3" output/ "linux1.dg.creatis.insa-lyon.fr:./cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
+    pwd
+    echo ${OUTPUTDIR}
+    mkdir "${OUTPUTDIR}/output.${JOB_ID%%.*}"
+    rsync -av --remove-source-files output/ "${OUTPUTDIR}/output.${JOB_ID%%.*}"
+    echo "Cleanup"
+    rm -r ${LOCALMACRODIR}
+}
 
 function error {
-echo "ERROR: $1"
-exit 1
+    echo "ERROR: $1"
+    exit 1
 }
 
 function warning {
-echo "WARNING: $1"
+    echo "WARNING: $1"
 }
 
+date
 test -f ${HOME}/.bashrc && echo "Sourcing bashrc" && source ${HOME}/.bashrc
 set -u
 
@@ -41,30 +53,30 @@ echo "PARAM=${PARAM}"
 
 if test "$RELEASEDIR" = "NONE"
 then
-       echo Using $(which Gate)
-       ldd $(which Gate)
+         echo Using $(which Gate)
+         ldd $(which Gate)
 else
-       test -d "${RELEASEDIR}" || error "can't find release"
-       md5sum ${RELEASEDIR}/Gate
-       test -f ${RELEASEDIR}/libGate.so && md5sum ${RELEASEDIR}/libGate.so
+         test -d "${RELEASEDIR}" || error "can't find release"
+         md5sum ${RELEASEDIR}/Gate
+         test -f ${RELEASEDIR}/libGate.so && md5sum ${RELEASEDIR}/libGate.so
 
-       echo "Finding libraries"
-       ROOTLIBS="${RELEASEDIR}/libCore.so:${RELEASEDIR}/libCint.so:${RELEASEDIR}/libRIO.so:${RELEASEDIR}/libNet.so:${RELEASEDIR}/libHist.so:${RELEASEDIR}/libGraf.so:${RELEASEDIR}/libGraf3d.so:${RELEASEDIR}/libGpad.so:${RELEASEDIR}/libTree.so:${RELEASEDIR}/libRint.so:${RELEASEDIR}/libPostscript.so:${RELEASEDIR}/libMatrix.so:${RELEASEDIR}/libPhysics.so:${RELEASEDIR}/libMathCore.so:${RELEASEDIR}/libThread.so:"
-       echo "ROOTLIBS=${ROOTLIBS}"
-       G4LIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libG4*.so'); do echo -n "${library}:"; done)"
-       echo "G4LIBS=${G4LIBS}"
-       CLHEPLIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libCLHEP*.so'); do echo -n "${library}:"; done)"
-       echo "CLHEPLIBS=${CLHEPLIBS}"
-       GATELIBS=""
-       test -f ${RELEASEDIR}/libGate.so && GATELIBS="${RELEASEDIR}/libGate.so:"
-       echo "GATELIBS=${GATELIBS}"
+         echo "Finding libraries"
+         ROOTLIBS="${RELEASEDIR}/libCore.so:${RELEASEDIR}/libCint.so:${RELEASEDIR}/libRIO.so:${RELEASEDIR}/libNet.so:${RELEASEDIR}/libHist.so:${RELEASEDIR}/libGraf.so:${RELEASEDIR}/libGraf3d.so:${RELEASEDIR}/libGpad.so:${RELEASEDIR}/libTree.so:${RELEASEDIR}/libRint.so:${RELEASEDIR}/libPostscript.so:${RELEASEDIR}/libMatrix.so:${RELEASEDIR}/libPhysics.so:${RELEASEDIR}/libMathCore.so:${RELEASEDIR}/libThread.so:"
+         echo "ROOTLIBS=${ROOTLIBS}"
+         G4LIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libG4*.so'); do echo -n "${library}:"; done)"
+         echo "G4LIBS=${G4LIBS}"
+         CLHEPLIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libCLHEP*.so'); do echo -n "${library}:"; done)"
+         echo "CLHEPLIBS=${CLHEPLIBS}"
+         GATELIBS=""
+         test -f ${RELEASEDIR}/libGate.so && GATELIBS="${RELEASEDIR}/libGate.so:"
+         echo "GATELIBS=${GATELIBS}"
 fi
 test -d "${MACRODIR}" && test -d "${MACRODIR}/mac" || error "invalid macro"
 
 
 echo "Copying inputs"
 LOCALMACRODIR=$(mktemp -d)
-trap "mv output ${OUTPUTDIR}/output.${JOB_ID%%.*} ; rm -r ${LOCALMACRODIR} ; exit 1" 1 2 3 15
+trap "wait ; transferJobData ; exit 1" 137 138 152 153
 cd ${LOCALMACRODIR}
 cp -r -L "${MACRODIR}"/{data,mac} .
 mkdir output
@@ -76,29 +88,24 @@ echo "Lauching macro"
 date
 if test "$RELEASEDIR" = "NONE"
 then
-       Gate ${PARAM} ${MACROFILE} || error "gate failed"
+         Gate ${PARAM} ${MACROFILE} || error "gate failed"
 else
-       LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \
-       G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \
-       G4RADIOACTIVEDATA="${RELEASEDIR}/RadioactiveDecay3.3" \
-       G4LEDATA="${RELEASEDIR}/G4EMLOW6.19" \
-       G4NEUTRONHPDATA="${RELEASEDIR}/G4NDL3.14" \
-       G4ABLADATA="${RELEASEDIR}/G4ABLA3.0" \
-       G4REALSURFACEDATA="${RELEASEDIR}/RealSurface1.0" \
-       G4NEUTRONXSDATA="${RELEASEDIR}/G4NEUTRONXS1.0" \
-       G4PIIDATA="${RELEASEDIR}/G4PII1.2" \
-       /usr/bin/time --format="real %es\nuser %Us\nsys %Ss\nmaxmem %Mk" \
-       ${RELEASEDIR}/Gate ${PARAM} ${MACROFILE} \
-       || error "gate failed"
+         LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \
+                   G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \
+                   G4RADIOACTIVEDATA="${RELEASEDIR}/RadioactiveDecay3.3" \
+                   G4LEDATA="${RELEASEDIR}/G4EMLOW6.19" \
+                   G4NEUTRONHPDATA="${RELEASEDIR}/G4NDL3.14" \
+                   G4ABLADATA="${RELEASEDIR}/G4ABLA3.0" \
+                   G4REALSURFACEDATA="${RELEASEDIR}/RealSurface1.0" \
+                   G4NEUTRONXSDATA="${RELEASEDIR}/G4NEUTRONXS1.0" \
+                   G4PIIDATA="${RELEASEDIR}/G4PII1.2" \
+                   /usr/bin/time --format="real %es\nuser %Us\nsys %Ss\nmaxmem %Mk" \
+                   ${RELEASEDIR}/Gate ${PARAM} ${MACROFILE} \
+             || error "gate failed"
 fi
 
 date
-echo "Copying data back"
-ssh -i ${HOME}/.ssh/ccin2p3 linux1.dg.creatis.insa-lyon.fr "mkdir cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
-rsync -av --remove-source-files -e "ssh -i ${HOME}/.ssh/ccin2p3" output/ "linux1.dg.creatis.insa-lyon.fr:./cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
-
-echo "Cleanup"
-rm -r ${LOCALMACRODIR}
+transferJobData
 date
 
 echo "Success!!!"