Currently we use the bash timeout command extensively in our scripts to avoid jobs from eating up too much time. This choice is useful, but since timeout provides diagnostics in the form of an exit code, unless we handle that exit code there is no useful information presented in CI regarding why the commands failed. Since we typically run with set -e the command simply fails outright with no information.
I propose that we replace all timeout commands with a new rapids_timeout command that provides a useful diagnostic here. The implementation would be fairly simple I think:
rapids_timeout() {
local old_opts="$-"
set +e
timeout $@
timeout_exit=$?
if [[ $? == 124 ]]; do
echo "The command timed out"
done
# Restore options
case $old_opts in
*e*) set -e ;;
*) set +e ;;
esac
}
Currently we use the bash
timeoutcommand extensively in our scripts to avoid jobs from eating up too much time. This choice is useful, but sincetimeoutprovides diagnostics in the form of an exit code, unless we handle that exit code there is no useful information presented in CI regarding why the commands failed. Since we typically run withset -ethe command simply fails outright with no information.I propose that we replace all
timeoutcommands with a newrapids_timeoutcommand that provides a useful diagnostic here. The implementation would be fairly simple I think: