justIN           Dashboard       Workflows       Jobs       AWT       Sites       Storages       Docs       Login

Workflow 12633, Stage 1

Workflow12633
Campaign971
Priority50
Processors1
Wall seconds80000
Image/cvmfs/singularity.opensciencegrid.org/fermilab/fnal-wn-sl7:latest
RSS bytes4194304000 (4000 MiB)
Max distance for inputs0.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, CA_Victoria, 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_BNL, US_Colorado, US_FNAL-FermiGrid, US_FNAL-T1, US_Michigan, US_NotreDame, US_PuertoRico, US_SU-ITS, US_Swan, US_UChicago, US_UConn-HPC, US_UCSD, US_Wisconsin
Scopeusertests
Events for this stage

Output patterns

 DestinationPatternLifetimeFor next stageRSE expression
1https://fndcadoor.fnal.gov:2880/dune/scratch/users/jqin1/fnal/12633/1*_reco2.root

Environment variables

NameValue
INPUT_TAR_DIR_LOCAL/cvmfs/fifeuser4.opensciencegrid.org/sw/dune/cfefef5fb58e1aa63679ae6194314a8d95f9b9f9
MODEgt
NUM_EVENTS10

File states

Total filesFindingUnallocatedAllocatedOutputtingProcessedNot foundFailed
30300000

Job states

TotalSubmittedStartedProcessingOutputtingFinishedNotusedAbortedStalledJobscript errorOutputting failedNone processed
000000000000
Replicas per RSE3475.2844450513829189.487499999999983380.0354.5253284.71555494861707189.48750000000007Replicas per RSEDUNE_UK_MANCHESTER_CEPH (33%)DUNE_US_FNAL_DISK_STAGE (33%)T3_US_NERSC (33%)

Stats of processed input files as CSV or JSON, and of uploaded output files as CSV or JSON (up to 10000 files included)

Jobscript

#!/bin/bash

# --- CONFIGURATION ---


# 1. Standard DUNE FHiCLs for the downstream chain
FCL_G4="supernova_g4_dune10kt_1x2x6.fcl"
FCL_DS="standard_detsim_dune10kt_1x2x6.fcl"
FCL_R1="reco1_supernova_dune10kt_1x2x6.fcl"
FCL_R2="reco2_supernova_dune10kt_1x2x6.fcl"

# Unified Version for sim+reco
DUNE_VERSION=${DUNE_VERSION:-v09_91_04d01}
DUNE_QUALIFIER=${DUNE_QUALIFIER:-e26:prof}

# 3. Job Setup
MODE=${MODE:-fermi} # Default to 'fermi' if not set via --env
echo "Processing $NUM_EVENTS events per job in MODE: $MODE"

# 4. Trigger Handling (Dummy File)
did_pfn_rse=`$JUSTIN_PATH/justin-get-file`
if [ "$did_pfn_rse" = "" ] ; then
  echo "Nothing to process - exit jobscript"
  exit 0
fi
echo "$did_pfn_rse" | cut -f1 -d' ' >>all-input-dids.txt
pfn=`echo $did_pfn_rse | cut -f2 -d' '`

# --- MAIN WORKFLOW ---

# A. Setup Environment (Once for the whole chain)
source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
setup dunesw "$DUNE_VERSION" -q "$DUNE_QUALIFIER"
echo "Initialized DUNE software $DUNE_VERSION"

# B. Retrieve Custom Files
# Assumes INPUT_TAR_DIR_LOCAL is passed by justIN via --input-tar-local
if [ -d "$INPUT_TAR_DIR_LOCAL" ]; then
    echo "Getting custom files from $INPUT_TAR_DIR_LOCAL"
    cp $INPUT_TAR_DIR_LOCAL/*.react . 2>/dev/null
    cp $INPUT_TAR_DIR_LOCAL/*.fcl . 2>/dev/null

    # Validation
    if [ ! -f "run_${MODE}.fcl" ]; then
        echo "ERROR: run_${MODE}.fcl not found inside the tarball!"
        exit 1
    fi

    echo "" >> run_${MODE}.fcl
    echo "source.maxEvents: $NUM_EVENTS" >> run_${MODE}.fcl
    echo "DEBUG: Forced source.maxEvents to $NUM_EVENTS in run_${MODE}.fcl"

else
    echo "ERROR: INPUT_TAR_DIR_LOCAL not found. Did you use --input-tar-local?"
    exit 1
fi

# C. Construct Unique Filenames
now=$(date -u +"%Y-%m-%dT_%H%M%SZ")
# Unique prefix using Workflow+Stage+Job ID
fname="${MODE}_${JUSTIN_WORKFLOW_ID}_${JUSTIN_STAGE_ID}_${JUSTIN_JOB_ID}"

outFile_gen=${fname}_${now}_gen.root
outFile_g4=${fname}_${now}_gen_g4.root
outFile_ds=${fname}_${now}_gen_g4_detsim.root
outFile_r1=${fname}_${now}_gen_g4_detsim_reco1.root
outFile_r2=${fname}_${now}_reco2.root

# --- EXECUTION LOOP ---
(
export LD_PRELOAD=${XROOTD_LIB}/libXrdPosixPreload.so

# STEP 1: GENERATION (Custom)
echo "Running Generation ($MODE)..."
lar -c run_${MODE}.fcl -n ${NUM_EVENTS} -o $outFile_gen > ${fname}_sim_${now}.log 2>&1
if [ $? -ne 0 ]; then echo "GEN failed"; exit 1; fi

# STEP 2: GEANT4
echo "Running G4..."
lar -c $FCL_G4 -n ${NUM_EVENTS} -s $outFile_gen -o $outFile_g4 >> ${fname}_sim_${now}.log 2>&1
if [ $? -ne 0 ]; then echo "G4 failed"; exit 2; fi

# STEP 3: DETSIM
echo "Running Detsim..."
lar -c $FCL_DS -n ${NUM_EVENTS} -s $outFile_g4 -o $outFile_ds >> ${fname}_sim_${now}.log 2>&1
if [ $? -ne 0 ]; then echo "DETSIM failed"; exit 3; fi

# STEP 4: RECO1
echo "Running Reco1..."
lar -c $FCL_R1 -s $outFile_ds -o $outFile_r1 >> ${fname}_sim_${now}.log 2>&1
if [ $? -ne 0 ]; then echo "RECO1 failed"; exit 4; fi

# STEP 5: RECO2
echo "Running Reco2..."
lar -c $FCL_R2 -n ${NUM_EVENTS} -s $outFile_r1 -o $outFile_r2 >> ${fname}_sim_${now}.log 2>&1
if [ $? -ne 0 ]; then echo "RECO2 failed"; exit 5; fi
)

# Check logic for the whole subshell
if [ $? -ne 0 ]; then
  echo "Simulation chain failed. See logs."
  exit 1
fi


# --- CLEANUP & FINISH ---

# Remove intermediates
rm $outFile_gen $outFile_g4 $outFile_ds $outFile_r1

# Final Check
if [ -f "$outFile_r2" ]; then
  echo "$pfn" > justin-processed-pfns.txt
  exit_code=0
else
  echo "Error: Final reco2  output not found."
  exit_code=1
fi

# Tar logs
tar zcf `echo "$JUSTIN_JOBSUB_ID.logs.tgz" | sed 's/@/_/g'` *.log

exit $exit_code
justIN time: 2026-02-04 07:54:08 UTC       justIN version: 01.06.00