Commit Graph

66 Commits

Author SHA1 Message Date
Tim Savannah
e99d1d8957 Add StoppableThread to the root module (so from 'func_timeout import StoppableThread' now works, instead of needing to do 'from func_timeout.StoppableThread import StoppableThread') 2017-06-04 04:46:47 -04:00
Tim Savannah
0e43f0b161 pydoc 2017-06-04 04:44:20 -04:00
Tim Savannah
f21d4b4b49 Update READMEs to note StoppableThread 2017-06-04 04:43:56 -04:00
Tim Savannah
6bee825db7 Add a bunch of comments to StoppableThread 2017-06-04 04:41:44 -04:00
Tim Savannah
19497ca229 4.2.0 2017-06-04 04:30:58 -04:00
Tim Savannah
4190710ec4 Update pydoc 2017-06-04 04:30:22 -04:00
Tim Savannah
57aed88c7a Add 'stop' method (rather than _stopThread) to StoppableThread 2017-05-28 01:11:42 -04:00
Tim Savannah
3f6d300aa0 4.1.0 2017-05-24 02:14:27 -04:00
Tim Savannah
0e2b0e9c3e doc 2017-05-24 02:14:11 -04:00
Tim Savannah
5e44de7210 Changelog 2017-05-24 02:12:07 -04:00
Tim Savannah
9e1ac2fb8c Change to using clever import strategy such that we dont have to use exec/eval 2017-05-24 02:08:15 -04:00
Tim Savannah
76cf4f6456 Much better exception handling - Have them make more sense. Get rid of the multiple traceback prints, one for each level of catchs on python3. Also improve traceback on both python3 and python2 to exclude the function wrapper, and instead follow the execution frame. Downside is that neither form compiles on the other python, so have to use exec... 2017-05-24 02:01:58 -04:00
Tim Savannah
fd0260fc05 For python >= 3.3, raise with the chained exception context disabled, since the funcwrap wrapper is within the context where the exception would be thrown (on python3+) 2017-05-24 01:32:55 -04:00
Tim Savannah
3275780482 Changelog 2017-05-24 01:23:34 -04:00
Tim Savannah
5a6187122d Force cleanup of thread if function completes in time. On python2 this forces the thread to be cleaned up right-away, on python3 it would get cleaned up during the next garbage-collect cycle. In python2 it may take several rounds. 2017-05-24 01:22:17 -04:00
Tim Savannah
3dcf6f921e pydoc update 2017-05-20 21:43:07 -04:00
Tim Savannah
38ec3de098 Fix date 2017-05-20 21:40:54 -04:00
Tim Savannah
0c1f6a7de6 README list pydocs 2017-05-20 21:40:34 -04:00
Tim Savannah
b6c02653b8 4.0.0 2017-05-20 21:38:02 -04:00
Tim Savannah
cfa466a302 Changelog 2017-05-20 21:30:36 -04:00
Tim Savannah
ca8a3a3534 Short README update 2017-05-20 21:30:13 -04:00
Tim Savannah
8af967169d Make python2 work as well as python3 2017-05-20 21:23:37 -04:00
Tim Savannah
f20e8e727c Fix so instantiation works in async exception. Also, dont need to worry about the exception comment, as we use BaseException and have for a while to prevent such. 2017-05-20 21:14:58 -04:00
Tim Savannah
525c291aef Regen html 2017-05-20 17:20:47 -04:00
Tim Savannah
d6ff5e1932 Make StoppableThread.JoinThread have a configurable retry interval (still default 2 seconds). Will attempt to retry stopping thread every this-many seconds 2017-05-20 17:20:23 -04:00
Tim Savannah
e554cd0252 Update docstring text 2017-05-20 17:18:06 -04:00
Tim Savannah
d10476b734 Update pydoc 2017-05-20 17:11:59 -04:00
Tim Savannah
63454c7178 Add mkdoc.sh script 2017-05-20 17:11:54 -04:00
Tim Savannah
9d3eec0475 Add README for tests dir, and add tests to MANIFEST.in 2017-05-20 17:10:16 -04:00
Tim Savannah
e4cf7fa765 Add TODO 2017-05-20 17:07:26 -04:00
Tim Savannah
ad944d3c2c Add tests 2017-05-20 17:06:51 -04:00
Tim Savannah
b729265855 Add msg property to FunctionTimedOut exception (also can get by str( exception ) 2017-05-20 17:04:22 -04:00
Tim Savannah
75d90251f6 Add missing import 2017-05-20 16:51:07 -04:00
Tim Savannah
2079932b4e Changelog 2017-05-20 16:24:24 -04:00
Tim Savannah
0ccca87e2c Some tests 2017-05-20 16:22:14 -04:00
Tim Savannah
36b7d6f266 Decrease thread join time. Because it is a daemon thread it will get closed automatically on garbage collect, just need to initate a join at all. 2017-05-20 16:21:43 -04:00
Tim Savannah
5b93fe5d7c Expand FunctionTimedOut exception to have attributes of the timeout, function that failed, args and kwargs. Also add a standard getMsg function for generating consistant message, and add a retry function to retry the function again with either same timeout, different timeout, or no timeout. 2017-05-20 16:04:39 -04:00
Tim Savannah
c3a114e1df Sometimes depending on critical section during timeout, traceback could be printed to stderr. Stop that. 2017-05-20 15:49:17 -04:00
Tim Savannah
b1a05fe92f Add GoodTests.py suite, some utils which will be used, and a test for the test. How meta! 2017-05-20 02:22:24 -04:00
Tim Savannah
32078a8065 Changeup how the function decorator works.
Rename to "set_func_timeout" - Give it 2 possible arguments.

First is either a floating point timeout, or a function which will be
invoked each call of decorated function and passed same arguments, to
calculate the timeout that should be used.

Second is "allowOverride", default False. If True, adds a kwarg to the
function being decorated, "forceTimeout", which if provided will
override any default timeout and prevent a calculation attempt.
2017-05-20 01:52:01 -04:00
Tim Savannah
84a3abd11d Revert 906f2b9028 on testit.py accidental commit 2017-05-20 00:06:54 -04:00
Tim Savannah
036c1dfa6f Add docstrings and imports 2017-05-19 21:01:07 -04:00
Tim Savannah
b778c644c3 Changelog 2017-05-19 20:50:25 -04:00
Tim Savannah
1a22f0f55b Merge branch 'master' into 4.0branch 2017-05-19 20:50:03 -04:00
Tim Savannah
906f2b9028 Version 4.0.0 2017-05-19 20:49:45 -04:00
Tim Savannah
1f4e536784 Changelog 2017-05-19 20:49:43 -04:00
Tim Savannah
f7baa18e64 Note set_timeout decorator in README 2017-05-19 20:49:42 -04:00
Tim Savannah
f8ec7f492c Add 'set_timeout' decorator for functions 2017-05-19 20:49:41 -04:00
Tim Savannah
3f4bae15c1 Fix year in changelog 2017-05-19 20:49:40 -04:00
Tim Savannah
7d74e815cc Fix year in changelog 2017-01-04 17:09:23 -05:00