ray/ci/suppress_output
Eric Liang 437459f40a
[build] Make travis logs not as long (#4213)
* clean it up

* Update .travis.yml

* Update .travis.yml

* update

* fix example

* suppress

* timeout

* print periodic progress

* Update suppress_output

* Update run_silent.sh

* Update suppress_output

* Update suppress_output

* manually do timeout

* sleep 300

* fix test

* Update run_silent.sh

* Update suppress_output

* Update .travis.yml
2019-03-07 12:09:03 -08:00

34 lines
629 B
Bash
Executable file

#!/bin/bash
# Run a command, suppressing output unless it hangs or crashes.
TMPFILE=`mktemp`
COMMAND="$@"
PID=$$
# Print output to avoid travis killing us
watchdog() {
for i in `seq 5 5 120`; do
sleep 300
echo "This command has been running for more than $i minutes..."
done
echo "Command timed out after 2h, dumping logs:"
cat $TMPFILE
echo "TIMED OUT"
kill -SIGKILL $PID
}
watchdog & 2>/dev/null
WATCHDOG_PID=$!
time $COMMAND >$TMPFILE 2>&1
CODE=$?
if [ $CODE != 0 ]; then
cat $TMPFILE
echo "FAILED $CODE"
kill $WATCHDOG_PID
exit $CODE
fi
kill $WATCHDOG_PID
exit 0