|
Decorator that applies a function with the given args and kwargs,
enforcing a timeout. Blocks until the function completes or the timeout
expires. If the timeout expires, raises a TimeoutError.
The intended use of this is to submit a job to a multiprocessing pool
with a timeout, after which the whole processing terminates. This only
makes sense if you have just one task per process or set
maxtasksperchild=1 on the pool.
Note:
the function execution does not actually halt when the exception is
raised, but continues in another thread. There is no way to
terminate this thread from outside it.
|