diff --git a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py index f295da6bdc7b914a47b817a3e3d770dc9731e20a..e1792c40caa93a3a3c1168ae32822a6ce10b9d7c 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py +++ b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py @@ -109,7 +109,7 @@ useCal = False useLHC = False # Enable ACTS material corrections, this crashes testbeam geometries -ConfigFlags.TrackingGeometry.MaterialSource = "/cvmfs/faser.cern.ch/repo/sw/database/DBRelease/current/acts/material-maps.json" +ConfigFlags.TrackingGeometry.MaterialSource = "/cvmfs/faser.cern.ch/repo/sw/database/DBRelease/1.2.0/acts/material-maps.json" # TI12 Cosmics geometry if runtype == "TI12Data": @@ -315,5 +315,11 @@ b = time.time() from AthenaCommon.Logging import log log.info(f"Finish execution in {b-a} seconds") -sys.exit(int(sc.isFailure())) +# Signal errors +if sc.isSuccess(): + log.info("Execution succeeded") + sys.exit(0) +else: + log.info("Execution failed, return 1") + sys.exit(1) diff --git a/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh b/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh index 20b39c9178b01a3e0252b2cb9351c39359939106..20001adc920de09eceacb5e6e49293fd3a957d20 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh +++ b/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh @@ -217,6 +217,8 @@ else fi # faser_reco.py "--nevents=$nevents" $geomstr $tagstr $mcstr "$file_path" +reco_code=$? +echo "Return code: $reco_code" # # Print out ending time date @@ -230,11 +232,27 @@ if ! [ -z "$outdest" ] then echo "Output directory:" ls -l - echo "copy *-xAOD.root to $outdest" - eos mkdir -p $outdest - # Keep this line from stopping script, so we might get a log file - # || true ensures script continues even if copy fails - eos cp *-xAOD.root ${outdest}/ || true + thefile=`ls *-xAOD.root` + if [ $? -eq 0 ]; then + echo "copy $thefile to $outdest" + eos mkdir -p $outdest + # Keep this line from stopping script, so we might get a log file + # || true ensures script continues even if copy fails + eos cp $thefile ${outdest}/${thefile} || true + + # Check that it worked + eos ls ${outdest}/${thefile} > /dev/null + if [ $? -eq 0 ]; then + echo "file $thefile copied to $outdest" + copy_code=0 + else + echo "didnt find $thefile in $outdest !" + copy_code=1 + fi + else + echo "ls *-xAOD.root returned nothing!" + copy_code=1 + fi fi # # Copy log file second @@ -255,3 +273,11 @@ then eos mkdir -p $outdest eos cp $logfile $outdest/$logfile fi + +# Make sure to return an error is calypso failed +if [ $reco_code -ne 0 ] || [ $copy_code -ne 0 ]; then + exit 1 +else + exit 0 +fi + diff --git a/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py b/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py index 0f725fe9a5a4bf2dc63b915ccf9768b1ffd60c0f..35a4df7a8b7251f43396538ac1fcfa9971e71197 100755 --- a/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py +++ b/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py @@ -217,4 +217,10 @@ b = time.time() log.info(f"Finish execution in {b-a} seconds") # Success should be 0 -sys.exit(int(sc.isFailure())) +if sc.isSuccess(): + log.info("Execution succeeded") + sys.exit(0) +else: + log.info("Execution failed, return 1") + sys.exit(1) + diff --git a/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh b/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh index d32998724cb479aeff240dee489257b9f1a0f3fd..429ebc717e2d5ad4a0d9d5bf607a800a32131f21 100755 --- a/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh +++ b/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh @@ -220,6 +220,8 @@ export EOS_MGM_URL=root://eospublic.cern.ch # Run job # faser_ntuple_maker.py $last_file_str $partialstr $tagstr $ismc --slice $slice --files $nfiles $dir_path +ntup_code=$? +echo "Return code: $ntup_code" # # Print out ending time date @@ -250,3 +252,6 @@ then mkdir -p $outdest eos cp $logfile $outdest/$logfile fi + +# Make sure to return an error if ntuple failed +exit $ntup_code