Workflow 1449, Stage 1
| Priority | 50 | 
| Processors | 1 | 
| Wall seconds | 36000 | 
| Image | /cvmfs/singularity.opensciencegrid.org/fermilab/fnal-wn-sl7:latest | 
| RSS bytes | 4194304000 (4000 MiB) | 
| Max distance for inputs | 100.0 | 
| Enabled input RSEs | 
CERN_PDUNE_EOS, DUNE_CA_SFU, DUNE_CERN_EOS, DUNE_ES_PIC, DUNE_FR_CCIN2P3_DISK, DUNE_IN_TIFR, DUNE_IT_INFN_CNAF, DUNE_UK_GLASGOW, DUNE_UK_LANCASTER_CEPH, DUNE_UK_MANCHESTER_CEPH, DUNE_US_BNL_SDCC, DUNE_US_FNAL_DISK_STAGE, FNAL_DCACHE, FNAL_DCACHE_STAGING, FNAL_DCACHE_TEST, MONTECARLO, NIKHEF, PRAGUE, QMUL, RAL-PP, RAL_ECHO, SURFSARA, T3_US_NERSC | 
| Enabled output RSEs | 
CERN_PDUNE_EOS, DUNE_CA_SFU, DUNE_CERN_EOS, DUNE_ES_PIC, DUNE_FR_CCIN2P3_DISK, DUNE_IN_TIFR, DUNE_IT_INFN_CNAF, DUNE_UK_GLASGOW, DUNE_UK_LANCASTER_CEPH, DUNE_UK_MANCHESTER_CEPH, DUNE_US_BNL_SDCC, DUNE_US_FNAL_DISK_STAGE, FNAL_DCACHE, FNAL_DCACHE_STAGING, FNAL_DCACHE_TEST, NIKHEF, PRAGUE, QMUL, RAL-PP, RAL_ECHO, SURFSARA, T3_US_NERSC | 
| Enabled sites | 
BR_CBPF, CA_SFU, CERN, CH_UNIBE-LHEP, CZ_FZU, ES_CIEMAT, ES_PIC, FR_CCIN2P3, IT_CNAF, NL_NIKHEF, NL_SURFsara, UK_Bristol, UK_Brunel, UK_Durham, UK_Edinburgh, UK_Glasgow, UK_Imperial, UK_Lancaster, UK_Liverpool, UK_Manchester, UK_Oxford, UK_QMUL, UK_RAL-PPD, UK_RAL-Tier1, UK_Sheffield, US_Colorado, US_FNAL-FermiGrid, US_FNAL-T1, US_Michigan, US_PuertoRico, US_SU-ITS, US_Swan, US_UChicago, US_UConn-HPC, US_UCSD, US_Wisconsin | 
| Scope | usertests | 
| Events for this stage | 
Output patterns
|   | Destination | Pattern | Lifetime | For next stage | RSE expression | 
|---|
| 1 | https://fndcadoor.fnal.gov:2880/dune/scratch/users/rlalnunt/fnal/01449/1 | *_ana_*.root |   |   |   | 
| 2 | https://fndcadoor.fnal.gov:2880/dune/scratch/users/rlalnunt/fnal/01449/1 | *_hist.root |   |   |   | 
Environment variables
| Name | Value | 
|---|
| ANA_FILE | runPNSCRPflashes1.fcl | 
| FILES_PER_JOB | 10 | 
| INPUT_TAR_DIR_LOCAL | /cvmfs/fifeuser1.opensciencegrid.org/sw/dune/e259feb99d191a74b575d18ab0561050c3272a0a | 
File states
| Total files | Finding | Unallocated | Allocated | Outputting | Processed | Not found | Failed | 
|---|
|
| 22 | 0 | 0 | 0 | 0 | 0 | 0 | 22 | 
Job states
| Total | Submitted | Started | Processing | Outputting | Finished | Notused | Aborted | Stalled | Jobscript error | Outputting failed | None processed | 
|---|
| 194 | 0 | 0 | 0 | 0 | 0 | 0 | 194 | 0 | 0 | 0 | 0 | 
RSEs used
| Name | Inputs | Outputs | 
|---|
| MONTECARLO | 132 | 0 | 
Stats of processed input files as CSV or JSON, and of uploaded output files as CSV or JSON (up to 10000 files included)
File reset events, by site
| Site | Allocated | Outputting | 
|---|
| UK_RAL-Tier1 | 63 | 0 | 
| NL_NIKHEF | 33 | 0 | 
| NL_SURFsara | 7 | 0 | 
| ES_PIC | 6 | 0 | 
| UK_Edinburgh | 1 | 0 | 
Jobscript
#!/bin/bash
# Run runPNSCRPflashes1.fcl on 10 local PNFS inputs per job
ANA_FILE=${ANA_FILE:-runPNSCRPflashes1.fcl}
DUNE_VERSION=${DUNE_VERSION:-v09_91_02d00}
DUNE_QUALIFIER=${DUNE_QUALIFIER:-e26:prof}
FILES_PER_JOB=${FILES_PER_JOB:-10}
[ -n "$NUM_EVENTS" ] && NUM_EVENTS_OPT="-n $NUM_EVENTS" || NUM_EVENTS_OPT=""
export OMP_NUM_THREADS=${JUSTIN_PROCESSORS:-1}
# --- DUNE software ---
source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
setup dunesw "$DUNE_VERSION" -q "$DUNE_QUALIFIER" || { echo "ERROR: setup dunesw failed"; exit 2; }
# --- Inputs from RCDS/CVMFS tar ---
if [ -z "$INPUT_TAR_DIR_LOCAL" ]; then
  echo "ERROR: INPUT_TAR_DIR_LOCAL not set"; exit 2
fi
# Make FHiCL & config files in tar visible
export FHICL_FILE_PATH="$INPUT_TAR_DIR_LOCAL:${FHICL_FILE_PATH}"
export FW_SEARCH_PATH="$INPUT_TAR_DIR_LOCAL:${FW_SEARCH_PATH}"
# Load your localProducts (plugin) either from env or from the tar
LP="${LOCALPROD:-$(find "$INPUT_TAR_DIR_LOCAL" -maxdepth 1 -type d -name 'localProducts_*_e*_prof' -print -quit)}"
if [ -z "$LP" ] || [ ! -f "$LP/setup" ]; then
  echo "ERROR: need localProducts (plugin) for PNSCRPanalyzerflashes1"; exit 8
fi
export PRODUCTS="$LP:$PRODUCTS"
# shellcheck disable=SC1090
source "$LP/setup"
# Ensure plugin .so directory is on CET_PLUGIN_PATH
LP_LIB="$(dirname "$(find "$LP" -type f -name 'lib*PNSCRPanalyzerflashes1*_module.so' -print -quit 2>/dev/null)")"
if [ -n "$LP_LIB" ]; then
  export CET_PLUGIN_PATH="$LP_LIB:${CET_PLUGIN_PATH}"
fi
# --- Chunk list handling (wait for CVMFS propagation) ---
CHUNK_DIR="$INPUT_TAR_DIR_LOCAL/chunks"
if [ ! -d "$CHUNK_DIR" ]; then
  echo "ERROR: no chunks dir in $INPUT_TAR_DIR_LOCAL"; exit 3
fi
tries=0
while true; do
  NCHUNKS=$(ls -1 "$CHUNK_DIR"/chunk_*.lst 2>/dev/null | wc -l | tr -d ' ')
  if [ "$NCHUNKS" -gt 0 ]; then break; fi
  if [ $tries -ge 30 ]; then
    echo "ERROR: chunks not visible on CVMFS after waiting"; exit 4
  fi
  echo "[INFO] Waiting for chunks on CVMFS... ($tries)"; sleep 20; tries=$((tries+1))
done
# Map this job's virtual counter to a chunk list file
jgf="$($JUSTIN_PATH/justin-get-file)"   # one MONTECARLO counter
idx="$(echo "$jgf" | grep -oE '[0-9]+' | tail -1)"; [ -n "$idx" ] || idx=1
m=$(( idx % NCHUNKS )); [ "$m" -eq 0 ] && m=$NCHUNKS
LST=$(printf "%s/chunk_%03d.lst" "$CHUNK_DIR" "$m")
# Wait for this specific list to be present & non-empty
tries=0
while [ ! -s "$LST" ]; do
  if [ $tries -ge 30 ]; then
    echo "ERROR: missing/empty $LST after waiting"; exit 5
  fi
  echo "[INFO] Waiting for $LST on CVMFS... ($tries)"; sleep 20; tries=$((tries+1))
done
echo "[INFO] Using chunk list: $LST"
mapfile -t INPUTS < "$LST"
now=$(date -u +"%Y-%m-%dT_%H%M%SZ")
# Optional: helps some sites
[ -n "$XROOTD_LIB" ] && export LD_PRELOAD="${XROOTD_LIB}/libXrdPosixPreload.so"
# --- Process up to FILES_PER_JOB inputs ---
count=0
for PFN in "${INPUTS[@]}"; do
  [ -n "$PFN" ] || continue
  base="$(basename "$PFN")"
  stem="${base%.root}"
  outstem="${stem}_ana_${now}"
  echo "[INFO] lar -c $ANA_FILE -s $PFN -T ${outstem}_hist.root -o ${outstem}.root $NUM_EVENTS_OPT"
  lar -c "$ANA_FILE" -s "$PFN" -T "${outstem}_hist.root" -o "${outstem}.root" $NUM_EVENTS_OPT > "${outstem}.log" 2>&1
  rc=$?
  echo "[INFO] rc=$rc for $PFN"
  count=$((count+1))
  [ "$count" -ge "$FILES_PER_JOB" ] && break
done
# Bundle logs (optional)
tar zcf "$(echo "${JUSTIN_JOBSUB_ID:-job}.logs.tgz" | sed 's/@/_/g')" *.log 2>/dev/null || true
exit 0