1ad3e0a11b1650d330a3d69ae7cbea771d647bc0
hiram
  Wed Apr 29 21:52:42 2026 -0700
adding galaxy cleanup process to release history and workflow metadata refs #31811

diff --git src/hg/utils/otto/userRequests/ottoRequestWatch.sh src/hg/utils/otto/userRequests/ottoRequestWatch.sh
index f8e63f2bd08..b05ca7b5acf 100755
--- src/hg/utils/otto/userRequests/ottoRequestWatch.sh
+++ src/hg/utils/otto/userRequests/ottoRequestWatch.sh
@@ -275,29 +275,37 @@
     continue
   fi
 
   hgsql -N -e \
       "UPDATE ottoRequest SET status = 5 WHERE id=${reqId};" hgcentraltest
 done < <(hgsql -N -B -e \
   "SELECT id, buildDir FROM ottoRequest \
    WHERE status = 4 AND buildDir != '' AND requestType = 'liftOver';" hgcentraltest)
 
 ############################################################################
 # phase 4: check for push files is complete, send final notification
 #          clean up galaxy workflow
 ############################################################################
 
 while IFS=$'\t' read -r reqId fromDb toDb buildDir; do
-
-   # TBD using buildDir go clean up the galaxy workflow
+  # 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
 
   sendNotification "${reqId}" \
 "from UCSC: liftOverRequest complete: ${fromDb}<->${toDb}" \
 "Your lift over request is complete.  You can access the lift.over files at:"
 
   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)