Commit Graph

12 Commits

Author SHA1 Message Date
Zack Cerza
fc94879498 safe_while: Don't sleep() on the first attempt
This was causing unnecessary delays in several places

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-04-17 11:08:36 -05:00
Zack Cerza
0b9d8936c2 Add missing space in error message
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-08 17:26:14 -06:00
Zack Cerza
73849c1179 Update safe_while's suggested usage pattern
I didn't love the way safe_while was encouraged to be used and it didn't
fit right with the new no-raising behavior. Now it's encouraged to be
used like this:

with safe_while() as proceed:
    while proceed():
        do_things()

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-08 15:19:31 -06:00
Zack Cerza
c98098496e Add optional _raise parameter
Defaults to True but if set to False, when giving up log a warning
instead of raising an exception.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-08 14:58:39 -06:00
Zack Cerza
73f5af2f6a Add optional 'action' parameter to safe_while
This is to make it easier to see what actually timed out when scanning
error logs

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-07 14:02:33 -06:00
Zack Cerza
8258c8479b Change safe_while defaults to 6s 10x no increment
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-07 13:33:27 -06:00
Alfredo Deza
6ba89851f1 fix docstring typo
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-02-26 08:17:48 -05:00
Alfredo Deza
2591935180 use itertools for seconds sum
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-02-24 16:22:59 -05:00
Alfredo Deza
171a5e1ac5 add a helper for while loops
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-02-24 15:09:18 -05:00
Zack Cerza
3981a8f1af Never use 'except:' without specifying an Exception. 2013-08-30 11:10:05 -05:00
Tommi Virtanen
eaba08fbf4 Add debug logging to contextutil.nested. 2011-06-16 10:39:26 -07:00
Tommi Virtanen
14ddb419d6 Start splitting the ceph task into smaller units.
This lets them nicely have independent error handling;
an example case where that is desirable is that the
old code failed to archive the logs if one of the daemons
exited with an error.

This also means a config file might specify just some
of the smaller tasks, e.g. for a test that explicitly
wants to create operational error situations.

The diff looks big because of an indentation change,
use "git diff -b" for a smaller diff.
2011-06-16 10:39:26 -07:00