pyufunc.timeout#
- pyufunc.timeout(seconds)#
A decorator to set the timeout for the function.
- Parameters:
seconds (int) – timeout seconds for the function.
Examples
>>> from pyufunc import timeout >>> @timeout(5) >>> def my_function(): >>> return "I'm running!" >>> my_function() >>> "I'm running!"
>>> @timeout(5) >>> def my_function(): >>> import time >>> time.sleep(10) >>> return "I'm running!" >>> my_function() >>> Error: my_function exceed 5 seconds timeout
- Returns:
the decorated function.
- Return type: