interruptingcowA watchdog that interrupts long running code | |
Download |
interruptingcow Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Erik van Zijst
- Publisher web site:
- http://www.xmlmath.org/
interruptingcow Tags
interruptingcow Description
interruptingcow is a generic Python utility that can relatively gracefully interrupt your code when it doesn't execute within a specific number of seconds:from interruptingcow import timeouttry: with timeout(5): # perform a potentially very slow operation passexcept RuntimeError: print "didn't finish within 5 seconds"Installation pip install interruptingcowCaveatsInterruptingcow uses signal(SIGALRM) to let the operating system interrupt program execution. This has the following limitations:1. Python signal handlers only apply to the main thread, so you cannot use this from other threads2. You must not use this in a program that uses SIGALRM itselfProduct's homepage
interruptingcow Related Software