Update documentation and fix version number specified in module
This commit is contained in:
parent
2bb4b52640
commit
675d68254d
@ -1,3 +1,6 @@
|
||||
* 3.0.1 - Mar 21 2016
|
||||
- Update documentation
|
||||
|
||||
* 3.0.0 - Mar 18 2016
|
||||
- Change implementation to not leave lingering threads after a timeout occurs
|
||||
- Split module into several parts
|
||||
|
||||
@ -49,6 +49,14 @@ So, for esxample, if you have a function "doit('arg1', 'arg2')" that you want to
|
||||
# Handle any exceptions that doit might raise here
|
||||
|
||||
|
||||
How it works
|
||||
------------
|
||||
|
||||
func\_timeout will run the specified function in a thread with the specified arguments until it returns, raises an exception, or the timeout is exceeded.
|
||||
If there is a return or an exception raised, it will be returned/raised as normal.
|
||||
|
||||
If the timeout has exceeded, the "FunctionTimedOut" exception will be raised in the context of the function being called, as well as from the context of "func\_timeout". You should have your function catch the "FunctionTimedOut" exception and exit cleanly if possible. Every 2 seconds until your function is terminated, it will continue to raise FunctionTimedOut. The terminating of the timed-out function happens in the context of the thread and will not block main execution.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
|
||||
@ -66,6 +66,13 @@ So, for esxample, if you have a function "doit('arg1', 'arg2')" that you want to
|
||||
|
||||
# Handle any exceptions that doit might raise here
|
||||
|
||||
How it works
|
||||
------------
|
||||
|
||||
func_timeout will run the specified function in a thread with the specified arguments until it returns, raises an exception, or the timeout is exceeded.
|
||||
If there is a return or an exception raised, it will be returned/raised as normal.
|
||||
|
||||
If the timeout has exceeded, the "FunctionTimedOut" exception will be raised in the context of the function being called, as well as from the context of "func_timeout". You should have your function catch the "FunctionTimedOut" exception and exit cleanly if possible. Every 2 seconds until your function is terminated, it will continue to raise FunctionTimedOut. The terminating of the timed-out function happens in the context of the thread and will not block main execution.
|
||||
|
||||
|
||||
Support
|
||||
|
||||
@ -9,7 +9,10 @@
|
||||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="func_timeout.html"><font color="#ffffff">func_timeout</font></a>.dafunc</strong></big></big></font></td
|
||||
><td align=right valign=bottom
|
||||
><font color="#ffffff" face="helvetica, arial"><a href="func_timeout.html">index</a></font></td></tr></table>
|
||||
<p></p>
|
||||
<p><tt>Copyright (c) 2016 Tim Savannah All Rights Reserved.<br>
|
||||
<br>
|
||||
Licensed under the Lesser GNU Public License Version 3, LGPLv3. You should have recieved a copy of this with the source distribution as<br>
|
||||
LICENSE, otherwise it is available at https://github.com/kata198/func_timeout/LICENSE</tt></p>
|
||||
<p>
|
||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||||
<tr bgcolor="#aa55cc">
|
||||
@ -37,6 +40,20 @@ Raises any exceptions #func# would raise, returns&
|
||||
<br>
|
||||
@raises - FunctionTimedOut if #timeout# is exceeded, otherwise anything #func# could raise will be raised<br>
|
||||
<br>
|
||||
If the timeout is exceeded, FunctionTimedOut will be raised within the context of the called function every two seconds until it terminates,<br>
|
||||
but will not block the calling thread (a new thread will be created to perform the join). If possible, you should try/except FunctionTimedOut<br>
|
||||
to return cleanly, but in most cases it will 'just work'.<br>
|
||||
<br>
|
||||
Be careful of code like:<br>
|
||||
def myfunc():<br>
|
||||
while True:<br>
|
||||
try:<br>
|
||||
dosomething()<br>
|
||||
except Exception:<br>
|
||||
continue<br>
|
||||
<br>
|
||||
because it will never terminate.<br>
|
||||
<br>
|
||||
@return - The return value that #func# gives</tt></dd></dl>
|
||||
</td></tr></table>
|
||||
</body></html>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
||||
<tr bgcolor="#7799ee">
|
||||
<td valign=bottom> <br>
|
||||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>func_timeout</strong></big></big> (version 2.0.0)</font></td
|
||||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>func_timeout</strong></big></big> (version 3.0.1)</font></td
|
||||
><td align=right valign=bottom
|
||||
><font color="#ffffff" face="helvetica, arial"><a href="func_timeout.html">index</a></font></td></tr></table>
|
||||
<p><tt>Copyright (c) 2016 Tim Savannah All Rights Reserved.<br>
|
||||
@ -45,7 +45,7 @@ LICENSE, otherwise it is available at https://gith
|
||||
<font color="#000000" face="helvetica, arial"><a name="FunctionTimedOut">class <strong>FunctionTimedOut</strong></a>(<a href="builtins.html#BaseException">builtins.BaseException</a>)</font></td></tr>
|
||||
|
||||
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
||||
<td colspan=2><tt>Common base class for all exceptions<br> </tt></td></tr>
|
||||
<td colspan=2><tt><a href="#FunctionTimedOut">FunctionTimedOut</a> - Exception raised when a function times out<br> </tt></td></tr>
|
||||
<tr><td> </td>
|
||||
<td width="100%"><dl><dt>Method resolution order:</dt>
|
||||
<dd><a href="func_timeout.exceptions.html#FunctionTimedOut">FunctionTimedOut</a></dd>
|
||||
@ -114,6 +114,20 @@ Raises any exceptions #func# would raise, returns&
|
||||
<br>
|
||||
@raises - <a href="#FunctionTimedOut">FunctionTimedOut</a> if #timeout# is exceeded, otherwise anything #func# could raise will be raised<br>
|
||||
<br>
|
||||
If the timeout is exceeded, <a href="#FunctionTimedOut">FunctionTimedOut</a> will be raised within the context of the called function every two seconds until it terminates,<br>
|
||||
but will not block the calling thread (a new thread will be created to perform the join). If possible, you should try/except <a href="#FunctionTimedOut">FunctionTimedOut</a><br>
|
||||
to return cleanly, but in most cases it will 'just work'.<br>
|
||||
<br>
|
||||
Be careful of code like:<br>
|
||||
def myfunc():<br>
|
||||
while True:<br>
|
||||
try:<br>
|
||||
dosomething()<br>
|
||||
except Exception:<br>
|
||||
continue<br>
|
||||
<br>
|
||||
because it will never terminate.<br>
|
||||
<br>
|
||||
@return - The return value that #func# gives</tt></dd></dl>
|
||||
</td></tr></table><p>
|
||||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||||
@ -123,5 +137,5 @@ Raises any exceptions #func# would raise, returns&
|
||||
|
||||
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
||||
<td width="100%"><strong>__all__</strong> = ('func_timeout', 'FunctionTimedOut')<br>
|
||||
<strong>__version_tuple__</strong> = (2, 0, 0)</td></tr></table>
|
||||
<strong>__version_tuple__</strong> = (3, 0, 1)</td></tr></table>
|
||||
</body></html>
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
'''
|
||||
|
||||
|
||||
__version__ = '2.0.0'
|
||||
__version_tuple__ = (2, 0, 0)
|
||||
__version__ = '3.0.1'
|
||||
__version_tuple__ = (3, 0, 1)
|
||||
|
||||
__all__ = ('func_timeout', 'FunctionTimedOut')
|
||||
|
||||
|
||||
@ -23,6 +23,20 @@ def func_timeout(timeout, func, args=(), kwargs=None):
|
||||
|
||||
@raises - FunctionTimedOut if #timeout# is exceeded, otherwise anything #func# could raise will be raised
|
||||
|
||||
If the timeout is exceeded, FunctionTimedOut will be raised within the context of the called function every two seconds until it terminates,
|
||||
but will not block the calling thread (a new thread will be created to perform the join). If possible, you should try/except FunctionTimedOut
|
||||
to return cleanly, but in most cases it will 'just work'.
|
||||
|
||||
Be careful of code like:
|
||||
def myfunc():
|
||||
while True:
|
||||
try:
|
||||
dosomething()
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
because it will never terminate.
|
||||
|
||||
@return - The return value that #func# gives
|
||||
'''
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user