Skip to content

Commit c8467be

Browse files
Create a log file for Jenkins to parse
1 parent ddac3cb commit c8467be

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

sorc/build_compute.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ finished=false
8787
${runcmd}
8888
echo "Running builds on compute nodes"
8989
while [[ "${finished}" == "false" ]]; do
90-
sleep 3m
90+
sleep 10s
9191
${runcmd}
9292
state="$("${HOMEgfs}/ci/scripts/utils/rocotostat.py" -w "${build_xml}" -d "${build_db}")"
9393
if [[ "${verbose_opt}" == "true" ]]; then
@@ -100,13 +100,29 @@ while [[ "${finished}" == "false" ]]; do
100100
finished=true
101101
elif [[ "${state}" == "RUNNING" ]]; then
102102
finished=false
103-
elif [[ "${state}" == "DEAD" ]]; then
104-
echo "FATAL ERROR: ${BASH_SOURCE[0]} one or more builds failed!"
105-
# TODO add capability to determine which build(s) failed
106-
exit 2
107103
else
108104
echo "FATAL ERROR: ${BASH_SOURCE[0]} rocoto failed with state '${state}'"
109-
exit 3
105+
# Determine which builds failed
106+
echo "$(rocotostat -w "${build_xml}" -d "${build_db}")" > rocotostat.out
107+
line_number=0
108+
rm -f logs/error.logs
109+
set -x
110+
while read -r line; do
111+
(( line_number += 1 ))
112+
# Skip the first two lines (header)
113+
if [[ ${line_number} -lt 3 ]]; then
114+
continue
115+
fi
116+
117+
if [[ "${line}" =~ "DEAD" || "${line}" =~ "UNKNOWN" ||
118+
"${line}" =~ "UNAVAILABLE" || "${line}" =~ "FAIL" ]]; then
119+
job=$(echo "${line}" | awk '{ print $2 }')
120+
log_file="logs/build_${job}"
121+
echo "${log_file}" >> logs/error.logs
122+
echo "Rocoto reported that the build failed for ${job}"
123+
fi
124+
done < rocotostat.out
125+
exit 2
110126
fi
111127
done
112128

workflow/build_opts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ build:
9090
gdas:
9191
command: "./build_gdas.sh -j 24"
9292
log: "build_gdas.log"
93-
cores: 24
94-
walltime: "01:30:00"
93+
cores: 1
94+
walltime: "00:00:10"

0 commit comments

Comments
 (0)