From 56dbafb56c86ce077fdc14cedfbcde27793080a8 Mon Sep 17 00:00:00 2001 From: emilyhcliu <36091766+emilyhcliu@users.noreply.github.com> Date: Mon, 6 May 2024 18:04:11 +0000 Subject: [PATCH] Enhance error handlings for missing input files (#2557) Enhance error handling for missing input files in the WDQMS job script With the missing stnstat file, the WDQMS processing job did not fail but went through all FATAL ERROR and ran completely. Refs #2389 --- scripts/exgdas_atmos_analysis_wdqms.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/exgdas_atmos_analysis_wdqms.sh b/scripts/exgdas_atmos_analysis_wdqms.sh index 60f2d94c7b..b050c08bfc 100755 --- a/scripts/exgdas_atmos_analysis_wdqms.sh +++ b/scripts/exgdas_atmos_analysis_wdqms.sh @@ -46,15 +46,15 @@ cd "${DATA}" || ( echo "FATAL ERROR: Unable to cd into '${DATA}', ABORT!"; exit # Copy cnvstat file from COMIN to DATA, untar and gunzip input files for wdqms.py # These should always be available cp "${COMIN}/${CNVSTAT}" . -rc=$? -(( rc != 0 )) && ( echo "FATAL ERROR: Unable to copy '${CNVSTAT}' from '${COMIN}', ABORT!"; exit 2 ) +export err=$? +(( err != 0 )) && ( msg="Unable to copy '${CNVSTAT}' from '${COMIN}'"; err_exit "${msg}" ) for diagfile in "${INPUT_LIST[@]}"; do tar -xvf "${CNVSTAT}" "${diagfile}.gz" - rc=$? - (( rc != 0 )) && ( echo "FATAL ERROR: Unable to extract '${diagfile}.gz' from '${CNVSTAT}', ABORT!"; exit 3 ) + export err=$? + (( err != 0 )) && ( msg="Unable to extract '${diagfile}.gz' from '${CNVSTAT}'"; err_exit "${msg}" ) gunzip "${diagfile}.gz" - rc=$? - (( rc != 0 )) && ( echo "FATAL ERROR: Unable to gunzip '${diagfile}.gz', ABORT!"; exit 3 ) + export err=$? + (( err != 0 )) && ( msg="Unable to gunzip '${diagfile}.gz'"; err_exit "${msg}" ) done #-------------------------------------------------------------------------------