0aa99b19411f52674c57d49c8b41c2706c78bf29 hiram Thu Apr 30 10:44:15 2026 -0700 add URL path names to the final email notice refs #31811 diff --git src/hg/utils/otto/userRequests/ottoRequestWatch.sh src/hg/utils/otto/userRequests/ottoRequestWatch.sh index b05ca7b5acf..8918c1c3835 100755 --- src/hg/utils/otto/userRequests/ottoRequestWatch.sh +++ src/hg/utils/otto/userRequests/ottoRequestWatch.sh @@ -17,30 +17,58 @@ set -eEu -o pipefail set -x export scriptDir=$(cd "$(dirname "$0")" && pwd) ############################################################################## ### errors - set error status in the table function setErrorStatus() { id="${1}" hgsql -N -e \ "UPDATE ottoRequest SET status=7 WHERE id=${id};" hgcentraltest } ############################################################################## +############################################################################## +### liftOverUrl - build the public download URL for an over.chain.gz file +### args: srcDb dstDb +### GenArk: https://hgdownload.soe.ucsc.edu/hubs/<3>/<3>/<3>/<3>//liftOver/To.over.chain.gz +### UCSC native: https://hgdownload.soe.ucsc.edu/goldenPath//liftOver/To.over.chain.gz +### DstDb is dstDb with the first letter upper-cased (matches the +### filename convention used in installLinks()). +############################################################################## +function liftOverUrl() { + local srcDb="${1}" + local dstDb="${2}" + local DstDb="${dstDb^}" + local fileName="${srcDb}To${DstDb}.over.chain.gz" + if [[ "${srcDb}" == GC* ]]; then + local gcX="${srcDb:0:3}" + local d0="${srcDb:4:3}" + local d1="${srcDb:7:3}" + local d2="${srcDb:10:3}" + local accPath="${gcX}/${d0}/${d1}/${d2}/${srcDb}" + printf "https://hgdownload.soe.ucsc.edu/hubs/%s/liftOver/%s" \ + "${accPath}" "${fileName}" + else + printf "https://hgdownload.soe.ucsc.edu/goldenPath/%s/liftOver/%s" \ + "${srcDb}" "${fileName}" + fi +} +############################################################################## + ############################################################################## ### sendNotification - email the requesting user that their alignment is done ### args: reqId subject ### message body is read from stdin ### recipient: email column of ottoRequest table for that reqId ### bcc: chain-file-request-group@ucsc.edu ### envelope sender / Return-Path / bounce: genome-www@soe.ucsc.edu ### returns 0 on success, non-zero on failure ############################################################################## function sendNotification() { local reqId="${1}" local subject="${2}" local msgBody="${3}" local toAddr toAddr="$(hgsql -N -B -e \ @@ -286,26 +314,32 @@ # clean up galaxy workflow ############################################################################ while IFS=$'\t' read -r reqId fromDb toDb buildDir; do # time to clean up the galaxy history and workflow to release the space if [ -s "${buildDir}/successInvocationId.txt" ]; then invocationId=$(cut -f2 "${buildDir}/successInvocationId.txt") profileJson="${HOME}/.planemo/profiles/vgp/planemo_profile_options.json" if "${scriptDir}/galaxyCleanup.py" "${profileJson}" "${invocationId}"; then printf "# galaxy cleanup complete for request %s\n" "${reqId}" 1>&2 else printf "# WARNING: galaxy cleanup failed for request %s\n" "${reqId}" 1>&2 fi fi + fromUrl="$(liftOverUrl "${fromDb}" "${toDb}")" + toUrl="$(liftOverUrl "${toDb}" "${fromDb}")" sendNotification "${reqId}" \ "from UCSC: liftOverRequest complete: ${fromDb}<->${toDb}" \ -"Your lift over request is complete. You can access the lift.over files at:" +"Your lift over request is complete. You can access the lift.over files at: + + ${fromUrl} + ${toUrl} +" hgsql -N -e \ "UPDATE ottoRequest SET status=8 WHERE id=${reqId};" hgcentraltest done < <(hgsql -N -B -e \ "SELECT id, fromDb, toDb, buildDir FROM ottoRequest \ WHERE status = 6 AND requestType = 'liftOver';" hgcentraltest)