sympy-bot-old
sympy-bot-old copied to clipboard
Some way for the bot to self-terminate instead of hang
If the tests of a PR hang, then the bot will also hang, which isn't very good for headless machines. There should be some failsafe. An easy thing to do would be to add a timeout. The default could be something large (say 4 hours per interpreter), but it could be configured. This can be implemented using alarms from the signals
module.
Another way would be to exit if no activity happens for some given amount of time. This is what Travis does. If no output is given in 10 minutes, it assumes the tests are hanging and gives up. I think to implement this, one just needs to reset the alarm every time something is written.
Regardless, we also have to make sure that the alarm is disabled at the end with a finally
block so that it doesn't trigger after the tests are done.
The last option is not as easy. I think one would need to hook sys.stdout
with a custom function that resets the alarm, and you would need to be careful with subtleties like flushing and correctly reseting the alarm in finally
.
@asmeurer I experienced this issue when I was reviewing a PR the tests test_plot.py
and test_plot_implicit.py
took excessively long time and my system hanged. Did it hang any time for you?
Yeah, sympy/sympy#1882.