Skip to content

Commit

Permalink
send an error from run_inversion.sh batch job (#196)
Browse files Browse the repository at this point in the history
Previously if the run_inversion.sh script failed with an error, the inversion workflow would continue despite the error because run_inversion.sh is run via an sbatch job.

To fix this, on any non-zero exit code this script writes out a hidden error file that the inversion workflow reads and errors out on. This is how we handle other failed sbatch jobs eg. jacobian runs in the IMI.
  • Loading branch information
laestrada authored Mar 25, 2024
1 parent ed50db5 commit f6ece5d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/inversion_scripts/run_inversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

#SBATCH -N 1
#SBATCH -o run_inversion_%j.out
#SBATCH -e run_inversion_%j.err

##=======================================================================
## Parse config.yml file
##=======================================================================

send_error() {
file=`basename "$0"`
printf "\nInversion Error: on line number ${1} of ${file}: IMI exiting."
echo "Error Status: 1" > .error_status_file.txt
exit 1
}

# remove error status file if present
rm -f .error_status_file.txt

# trap and exit on errors
trap 'send_error $LINENO' ERR

printf "\n=== PARSING CONFIG FILE ===\n"

invPath={INVERSION_PATH}
Expand Down

0 comments on commit f6ece5d

Please sign in to comment.