Skip to content

Commit caec4d3

Browse files
authored
Added WILL_FAIL as a terminal state for the notify daemon. (#91)
- Fixed jq calls for v1.3 on the GSA machines. - Moved testing files into better directories.
1 parent f848a38 commit caec4d3

File tree

7 files changed

+17602
-8
lines changed

7 files changed

+17602
-8
lines changed

cromshell

+19-6
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,15 @@ function status()
761761

762762
# Get execution status count and filter the metadata down:
763763
curl --compressed -s "${2}/api/workflows/v1/${1}/metadata?${CROMWELL_SLIM_METADATA_PARAMETERS}" > ${tmpMetadata}
764-
cat ${tmpMetadata} | jq '.calls | map_values(group_by(.executionStatus) | map({(.[0].executionStatus): . | length}) | add)' > ${tmpExecutionStatusCount}
764+
765+
# Commented out due to limitations of jq 1.3 on some machines.
766+
# The following two lines are functionally equivalent:
767+
#jq '.calls | map_values(group_by(.executionStatus) | map({(.[0].executionStatus): . | length}) | add)' ${tmpMetadata} > ${tmpExecutionStatusCount}
768+
#jq '(.calls | to_entries[] | .key as $task_name | .value | group_by(.executionStatus) | map({(.[0].executionStatus): . | length}) | add | to_entries[] | { ($task_name): {(.key): .value} })' ${tmpMetadata} | jq -s '. | add' > ${tmpExecutionStatusCount}
769+
jq -s 'map(.calls | to_entries[] | {(.key): .value | map(.executionStatus) | group_by(.) | map({(.[0]): length}) | add} ) | add' ${tmpMetadata} > ${tmpExecutionStatusCount}
765770

766771
# Check for failure states:
767-
cat ${tmpMetadata} | jq --exit-status '[ ..|.executionStatus? | values | . == "Failed" ] | any' > /dev/null
772+
cat ${tmpMetadata} | grep -q 'Failed'
768773
r=$?
769774

770775
# Check for failures:
@@ -774,6 +779,9 @@ function status()
774779
else
775780
turtleDead
776781
workflowStatus="WILL_FAIL"
782+
local newTempFile=$(makeTemp)
783+
jq ".status=\"${workflowStatus}\" | .ID=\"${1}\"" ${tmpExecutionStatusCount} > ${newTempFile}
784+
cp ${newTempFile} ${tmpExecutionStatusCount}
777785
f=${tmpExecutionStatusCount}
778786
fi
779787
else
@@ -1402,12 +1410,17 @@ function _notifyHelper()
14021410

14031411
assertCanCommunicateWithServer ${cromwellServer}
14041412
local separator="=================================================="
1413+
local statusFile=$( makeTemp )
14051414

14061415
while true ; do
1407-
completionStatus=$( status ${id} ${cromwellServer} 2>/dev/null | grep "status" | sed -e 's#.*status":##g' | tr -d ' ",' )
1408-
echo ${completionStatus} | grep -qE "Succeeded|Failed|Aborted"
1409-
r=${PIPESTATUS[1]}
1410-
if [[ ${r} -eq 0 ]] ; then
1416+
1417+
status ${id} ${cromwellServer} 2>/dev/null > ${statusFile}
1418+
completionStatus=$( jq -r '.status' ${statusFile} )
1419+
1420+
if [[ "${completionStatus}" == "Succeeded" ]] || \
1421+
[[ "${completionStatus}" == "Failed" ]] || \
1422+
[[ "${completionStatus}" == "Aborted" ]] || \
1423+
[[ "${completionStatus}" == "WILL_FAIL" ]] ; then
14111424
workflowFile=$( grep '$id' ${CROMWELL_SUBMISSIONS_FILE} | head -n1 | awk '{print $4}' )
14121425
metaData=$( metadata ${id} ${cromwellServer} )
14131426
echo -e "CROMWELL Task ${completionStatus}:\n\n${id}\n\non\n\n${cromwellServer}\n\n${separator}\n\nStatus:\n$(cat ${statusFile})\n\n${separator}\nMetadata:\n${metaData}\n\n${separator}\nSent by $( whoami )@$( hostname ) on $( date ) \n\n\n" | mail -n -s "Cromwell Task ${completionStatus} [${cromwellServer}] ${workflowFile}" ${email}

resources/no_call_cache.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"read_from_cache": false,
3+
"write_to_cache": false
4+
}

testing/metadata/metadata.json

+17,577
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.
File renamed without changes.

testing/will_fail.wdl renamed to testing/workflows/will_fail.wdl

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ task PassRunsLong {
144144
command <<<
145145
set -e
146146

147-
# Wait for 5 minutes:
148-
sleep 300
147+
# Wait for 6 minutes:
148+
sleep 360
149149
>>>
150150

151151
# ------------------------------------------------

0 commit comments

Comments
 (0)