@@ -1386,21 +1386,31 @@ function notify()
1386
1386
[[ $? -ne 0 ]] && error " ERROR: Could not copy cromshell to server ${hostServer} " && error " $( cat ${tmpOut} ) " && exit 7
1387
1387
1388
1388
# Spin off notification process on the server:
1389
- results=$( ssh ${hostServer} " ~/${SCRIPTNAME} notify ${WORKFLOW_ID} ${email} ${WORKFLOW_SERVER_URL} " )
1389
+ results=$( ssh ${hostServer} " ~/${SCRIPTNAME} _rawNotify ${WORKFLOW_ID} ${email} ${WORKFLOW_SERVER_URL} " )
1390
1390
[[ $? -ne 0 ]] && error " ERROR: Could not start notification daemon on ${hostServer} " && exit 8
1391
1391
1392
1392
# Let the user know we've done our job:
1393
1393
echo " Spun off thread on ${hostServer} - PID = $( echo " ${results} " | grep " Spun off thread on PID" | sed ' s#Spun off thread on PID ##g' ) "
1394
1394
else
1395
- error " Spinning off notification to ${email} thread for"
1396
- error " workflow: ${WORKFLOW_ID} "
1397
- error " from Cromwell server: ${WORKFLOW_SERVER_URL} "
1398
- error " ..."
1399
- nohup bash -c " source ${SCRIPTDIR} /${SCRIPTNAME} ; _notifyHelper ${WORKFLOW_ID} ${email} ${WORKFLOW_SERVER_URL} " & > /dev/null &
1400
- echo " Spun off thread on PID $! "
1395
+ _rawNotify ${WORKFLOW_ID} ${email} ${WORKFLOW_SERVER_URL}
1401
1396
fi
1402
1397
}
1403
1398
1399
+ # Perform a raw notification without validating any input arguments.
1400
+ function _rawNotify()
1401
+ {
1402
+ local WORKFLOW_ID=$1
1403
+ local email=$2
1404
+ local WORKFLOW_SERVER_URL=$3
1405
+
1406
+ error " Spinning off notification thread to ${email} for"
1407
+ error " workflow: ${WORKFLOW_ID} "
1408
+ error " from Cromwell server: ${WORKFLOW_SERVER_URL} "
1409
+ error " ..."
1410
+ nohup bash -c " source ${SCRIPTDIR} /${SCRIPTNAME} ; _notifyHelper ${WORKFLOW_ID} ${email} ${WORKFLOW_SERVER_URL} " & > /dev/null &
1411
+ echo " Spun off thread on PID $! "
1412
+ }
1413
+
1404
1414
# Helper function for the notify command that actually notifies the user:
1405
1415
function _notifyHelper()
1406
1416
{
@@ -1706,6 +1716,10 @@ if ${ISINTERACTIVESHELL} ; then
1706
1716
cleanup|submit|status|logs|execution-status-count|metadata|slim-metadata|timing|abort|notify|list|fetch-all|fetch-logs|list-outputs)
1707
1717
# This is a good sub-command, so we do not need to do anything.
1708
1718
;;
1719
+ _rawNotify)
1720
+ # This is a valid internal sub-command.
1721
+ # While it should never be called directly by the user, it is possible that this was called by another command in this script.
1722
+ ;;
1709
1723
* )
1710
1724
if [[ ${# SUB_COMMAND} -eq 0 ]]; then
1711
1725
simpleUsage
@@ -1722,14 +1736,27 @@ if ${ISINTERACTIVESHELL} ; then
1722
1736
r=$?
1723
1737
[[ ${r} -ne 0 ]] && exit 6
1724
1738
1739
+ # Sanitize the displayed sub-command:
1740
+ SUB_COMMAND_FOR_DISPLAY=${SUB_COMMAND}
1741
+ case ${SUB_COMMAND} in
1742
+ _rawNotify)
1743
+ SUB_COMMAND_FOR_DISPLAY=" notify"
1744
+ ;;
1745
+ esac
1746
+
1725
1747
# Handle specific sub-command args and and call our sub-command:
1726
- error " Sub-Command: ${SUB_COMMAND } "
1748
+ error " Sub-Command: ${SUB_COMMAND_FOR_DISPLAY } "
1727
1749
case ${SUB_COMMAND} in
1728
1750
# These are the sub-commands that take arguments other than workflow IDs:
1729
1751
cleanup|submit|list|notify|execution-status-count)
1730
1752
${SUB_COMMAND} $@
1731
1753
rv=$?
1732
1754
;;
1755
+ # These are internal sub-commands that take arguments that should not be modified:
1756
+ _rawNotify)
1757
+ ${SUB_COMMAND} $@
1758
+ rv=$?
1759
+ ;;
1733
1760
# Handle sub-commands that only take workflow IDs:
1734
1761
* )
1735
1762
extract_workflow_ids_from_args $@
0 commit comments