From a692afccdc96dc8d15ddc47fd27c71cc059a158d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lenain Date: Fri, 2 Feb 2024 17:53:28 +0100 Subject: [PATCH] Scripts for DQM (#105) * Update user script for DQM job submission * Work on user script for DQM job submission * Give up on COMDIRAC initialization: commands not found on DIRAC workers * The environment variable NECTARCAMDATA also needs to be passed into the container at runtime * Bug in handling $NECTARCAMDATA/runs * I was deleting $PWD on exit, which prevented any output sandbox to be retrievable ! * I forgot to specify the destination SE in dirac-dms-add-file (:facepalm:) * Update destination SE on DIRAC to GRIF instead of LPNHE * Use canonical quoting (SC2086) * Changed destination SE * Even if singularity binary available, some jobs tell that: INFO: Environment variable SINGULARITYENV_MPLCONFIGDIR is set, but APPTAINERENV_MPLCONFIGDIR is preferred * Generate plots on DIRAC * Add some doc. --------- Co-authored-by: Jean-Philippe Lenain --- .../dqm_job_submitter/dqm_processor.sh | 37 +++++++++---------- .../dqm_job_submitter/submit_dqm_processor.py | 14 ++++--- .../jlenain/submitGainFitDIRAC/GainFitter.sh | 2 +- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh b/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh index ba0d915e..ae2cf3a6 100755 --- a/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh +++ b/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh @@ -5,7 +5,7 @@ function usage () { - echo "Usage: $(basename $0) -r " + echo "Usage: $(basename "$0") -r " } function help () @@ -36,7 +36,7 @@ while getopts ":hr:" option; do done shift $((OPTIND-1)) -if [ -z $runnb ]; then +if [ -z "$runnb" ]; then usage exit 1 fi @@ -55,18 +55,18 @@ function exit_script() { # Some cleanup before leaving: # [ -d $CONTAINER ] && rm -rf $CONTAINER # [ -f $CONTAINER ] && rm -f $CONTAINER - [ -d $NECTARCAMDATA ] && rm -rf $NECTARCAMDATA - [ -d $OUTDIR ] && rm -rf $OUTDIR - [ -f ${OUTDIR}.tar.gz ] && rm -f ${OUTDIR}.tar.gz - [ -d ${OUTDIR} ] && rm -rf ${OUTDIR} + [ -d "$NECTARCAMDATA/runs" ] && rm -rf "$NECTARCAMDATA/runs" + [ -d "$OUTDIR" ] && rm -rf "$OUTDIR" + [ -f "${OUTDIR}.tar.gz" ] && rm -f "${OUTDIR}.tar.gz" + [ -d "${OUTDIR}" ] && rm -rf "${OUTDIR}" [ -f $WRAPPER ] && rm -f $WRAPPER - exit $return_code + exit "$return_code" } -export NECTARCAMDATA=$PWD/runs -[ ! -d $NECTARCAMDATA ] && mkdir -p $NECTARCAMDATA || exit_script $? -mv nectarcam*.sqlite NectarCAM.Run*.fits.fz $NECTARCAMDATA/. +export NECTARCAMDATA=$PWD +[ ! -d "$NECTARCAMDATA/runs" ] && mkdir -p "$NECTARCAMDATA/runs" || exit_script $? +mv nectarcam*.sqlite NectarCAM.Run*.fits.fz "$NECTARCAMDATA/runs/." # Halim's DQM code needs to use a specific output directory: export NECTARDIR=$PWD/$OUTDIR @@ -79,22 +79,19 @@ export NECTARDIR=$PWD/$OUTDIR # Create a wrapper BASH script with cleaned environment, see https://redmine.cta-observatory.org/issues/51483 cat > $WRAPPER <