Skip to content

Commit 3610c81

Browse files
authored
make upload job concurrent with lldb job (#14)
* make upload job concurrent with lldb job * Update post-command * Update post-command
1 parent 2771ebd commit 3610c81

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

hooks/post-command

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ if [[ "${#CORE_DUMPS[@]}" > 0 ]]; then
1111
echo "--- List of core dumps"
1212
ls -lah "${CORE_DUMPS[@]}"
1313

14-
# Start compressing/collecting corefiles in the background
14+
# Start a subshell for compressing/collecting corefiles in the background in parallel
15+
(
1516
PIDS=()
1617
for COREFILE in "${CORE_DUMPS[@]}"; do
17-
compress_bundle "${COREFILE}" &
18+
(
19+
compress_bundle "${COREFILE}"
20+
buildkite-agent artifact upload "$(compressed_bundle_names "${COREFILE}")"
21+
) &
1822
PIDS+=( "$!" )
1923
done
2024

25+
# Wait for compression and upload to finish
26+
wait -f "${PIDS[@]}"
27+
) &
28+
UPLOAD_PID="$!"
29+
2130
# If we're given debugger commands, print them out here:
2231
if [[ "${#DBG_COMMANDS[@]}" > 0 ]]; then
2332
# Spit some preliminary information out into the log for each corefile
@@ -32,22 +41,12 @@ if [[ "${#CORE_DUMPS[@]}" > 0 ]]; then
3241
(sleep "${DEBUGGER_TIMEOUT}"; kill "${DBG_PID}" 2>/dev/null >/dev/null; echo "DEBUGGER KILLED BY WATCHDOG TIMER") &
3342

3443
# Wait for one debugging command to finish before starting the next
35-
wait "${DBG_PID}" || true
44+
wait -f "${DBG_PID}" || true
3645
done
3746
done
3847
fi
3948

40-
# Wait for compression to finish
41-
echo "--- Waiting upon compression/bundling"
42-
for PID in "${PIDS[@]}"; do
43-
wait "${PID}"
44-
done
49+
echo "--- Waiting upon compression/bundling finishing"
50+
wait -f "${UPLOAD_PID}"
4551
echo " -> done!"
46-
47-
# Upload all compressed core files
48-
echo "--- Uploading corefiles"
49-
UPLOAD_TARGETS=( $(compressed_bundle_names "${CORE_DUMPS[@]}" ) )
50-
for TARGET in "${UPLOAD_TARGETS[@]}"; do
51-
buildkite-agent artifact upload "${TARGET}"
52-
done
5352
fi

0 commit comments

Comments
 (0)