351ed2fc24a13b86cf2a1fc9695309e2c0da9de5
lrnassar
  Wed Jun 3 09:33:28 2026 -0700
Make otto fetch failures loud and clinGen silent on no-update. refs #37697

Several otto jobs used 'wget -q'/'curl -s' under 'set -e', so a broken download
aborted with no output and cron (which mails on output, not exit code) sent nothing
-- the mode by which mastermind failed silently for months.

- mastermind, malacards: add an ERR trap that echoes a failure message; switch
mastermind's 'curl -s' to 'curl -sf' so an HTTP error fails loudly instead of
writing a challenge page into the release file.
- geneReviews: add an ERR trap (kept silent on no-update via the wrapper's mail -E).
- All three use 'set -eE' (errtrace) so the ERR trap also fires for failures inside
functions/subshells, not just top-level commands.
- clinGen: capture each sub-build's exit status instead of swallowing it under
'set +e', and report which sub-build failed. Also drop the routine 'No ... update'
echoes and the unconditional 'ClinGen update done.' line, and switch the wrapper to
'mail -E', so clinGen is now silent on no-update and only emails on a real update
or a failure.

diff --git src/hg/utils/otto/malacards/update.sh src/hg/utils/otto/malacards/update.sh
index 8abcada5b1c..2f9f5a8117d 100755
--- src/hg/utils/otto/malacards/update.sh
+++ src/hg/utils/otto/malacards/update.sh
@@ -1,20 +1,24 @@
 #!/bin/bash
 # redmine 14417
-set -e -o pipefail
+set -eE -o pipefail
+# Emit an error line on any failure so cron sends mail. wget -q is silent and set -e
+# would otherwise abort with no output, which cron treats as nothing to report.
+# -E (errtrace) makes the ERR trap fire for failures inside functions/subshells too.
+trap 'echo "ERROR: malacards update failed (exit $?) at line $LINENO" >&2' ERR
 now=`date -I`
 cd /hive/data/outside/otto/malacards
 wget -q https://genecardscustomers.blob.core.windows.net/ucsc/UCSC_DiseaseCentric_dump_MC_current.csv -O oldVersions/$now.csv
 # copied from ~/kent/src/hg/makeDb/doc/ucscGenes/hg38.ucscGenes16.sh  
 # load malacards table
 hgsql hg38 -e 'drop table malacards; create table malacards (geneSymbol varchar(255), maladySymbol varchar(255), urlSuffix varchar(255), mainName varchar(255), geneScore float, diseaseScore float, isElite bool)'
 hgsql hg38 -e 'create index malacardsGeneIdx on malacards(geneSymbol);'
 s='"'; hgsql hg38  -e "delete from malacards; load data local infile ${s}oldVersions/$now.csv${s} into table malacards columns terminated by ',' enclosed by '$s' escaped by '' ignore 1 lines"
 # load knownToMalacards tables
 kent=~/kent
 for db in hg38 hg19; do 
         hgsql -e "select geneSymbol,kgId from kgXref" --skip-column-names $db | awk '{if (NF == 2) print}' | sort > geneSymbolToKgId.txt
         hgsql -e "select geneSymbol from malacards" --skip-column-names $db | sort > malacardExists.txt
         join malacardExists.txt  geneSymbolToKgId.txt | awk 'BEGIN {OFS="\t"} {print $2, $1}' > knownToMalacard.txt
         hgLoadSqlTab -notOnServer $db  knownToMalacards $kent/src/hg/lib/knownTo.sql  knownToMalacard.txt
 done
 echo Malacards update OK