Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-10-15 08:17:26

0001 #!/bin/bash
0002 # Submit Finalize for a dataset as a SLURM job: it runs in a scratch dir on the worker node and copies its
0003 # outputs to where they belong, so nothing is copied by hand.
0004 #   Usage: ./run_finalize.bash <dataset> [Finalize_<tokens>] [<dataset> ...]
0005 #     <dataset>          the -d dataset, e.g. ana573_795xx, ana573 (all runs), ana573_795xx_nocm (a variant)
0006 #     Finalize_<tokens>  optional Finalize run string (default Finalize), e.g. Finalize_fz16; applies to every
0007 #                        dataset named after it
0008 #   e.g. ./run_finalize.bash ana573_795xx ana573_8156x ana573_8158x ana573     (four jobs)
0009 # Outputs (<name> = corral_<runstring>, e.g. corral_Finalize, corral_Finalize_fz16):
0010 #   root/<dataset>/<name>.root, pdf/<dataset>/<name>.pdf, log/<dataset>/<name>.log
0011 # The binary is snapshotted to log/<dataset>/<name>.snapshot (a rebuild cannot change a pending job).
0012 # FINALIZE_NEXPMIN / FINALIZE_MFRAC in the environment are passed on to the job (--export=ALL).
0013 # MEM= / TIME= override the defaults (4G, 2 h; a 49-pair-type ana573 run group took ~5 min and 0.7 GB).
0014 # project directory = $CORRAL_DIR if set, else the directory this script lives in (passed on to the job)
0015 export CORRAL_DIR=${CORRAL_DIR:-$(cd "$(dirname "$(readlink -f "$0")")" && pwd)}
0016 [ $# -lt 1 ] && { echo "usage: $0 <dataset> [Finalize_<tokens>] [<dataset> ...]"; exit 1; }
0017 #---- keep off the hax* and rpr* nodes (as run_m*.bash); EXCLUDE="..." replaces the list, EXCLUDE= allows every node
0018 EXCLUDE=${EXCLUDE-hax[1-18],rpr[1-24]}
0019 TIME=${TIME-2:00:00}
0020 MEM=${MEM-4G}
0021 FRS=Finalize
0022 for ARG in "$@"; do
0023         if [[ $ARG == Finalize* ]]; then FRS=$ARG; continue; fi
0024         SET=$ARG
0025         if [ ! -f $CORRAL_DIR/lists/$SET/manifest.txt ]; then echo "skip $SET: no lists/$SET/manifest.txt"; continue; fi
0026         if ! ls $CORRAL_DIR/root/$SET/chunks/*.root >/dev/null 2>&1; then echo "skip $SET: no root/$SET/chunks/*.root"; continue; fi
0027         NAME=corral_$FRS
0028         mkdir -p $CORRAL_DIR/root/$SET $CORRAL_DIR/pdf/$SET $CORRAL_DIR/log/$SET
0029         cp $CORRAL_DIR/corral $CORRAL_DIR/log/$SET/$NAME.snapshot
0030         echo -n "$SET  $FRS  -> root|pdf|log/$SET/$NAME.*   "
0031         sbatch --partition=prip --time=$TIME ${EXCLUDE:+--exclude=$EXCLUDE} \
0032                 --job-name=fin_$SET \
0033                 --output=$CORRAL_DIR/log/$SET/$NAME.log \
0034                 --error=$CORRAL_DIR/log/$SET/$NAME.log \
0035                 --mem=$MEM \
0036                 --export=ALL \
0037                 $CORRAL_DIR/run_finalize.slurm $SET $FRS
0038 done