Revision 8c67f82e snf-tools/synnefo_tools/burnin/cyclades_common.py
b/snf-tools/synnefo_tools/burnin/cyclades_common.py | ||
---|---|---|
52 | 52 |
# Too many public methods. pylint: disable-msg=R0904 |
53 | 53 |
class CycladesTests(BurninTests): |
54 | 54 |
"""Extends the BurninTests class for Cyclades""" |
55 |
def _try_until_timeout_expires(self, opmsg, check_fun):
|
|
55 |
def _ry_until_timeout_expires(self, opmsg, check_fun): |
|
56 | 56 |
"""Try to perform an action until timeout expires""" |
57 | 57 |
assert callable(check_fun), "Not a function" |
58 | 58 |
|
... | ... | |
61 | 61 |
if action_warning > action_timeout: |
62 | 62 |
action_warning = action_timeout |
63 | 63 |
|
64 |
start_time = time.time() |
|
65 |
while (start_time + action_warning) > time.time(): |
|
64 |
start_time = int(time.time()) |
|
65 |
end_time = start_time + action_warning |
|
66 |
while end_time > time.time(): |
|
66 | 67 |
try: |
67 |
return check_fun() |
|
68 |
ret_value = check_fun() |
|
69 |
self.info("Operation `%s' finished in %s seconds", |
|
70 |
opmsg, int(time.time()) - start_time) |
|
71 |
return ret_value |
|
68 | 72 |
except Retry: |
69 | 73 |
time.sleep(self.query_interval) |
70 |
self.warning("Operation `%s' is taking too long", opmsg) |
|
71 |
while (start_time + action_timeout) > time.time(): |
|
74 |
self.warning("Operation `%s' is taking too long after %s seconds", |
|
75 |
opmsg, int(time.time()) - start_time) |
|
76 |
|
|
77 |
end_time = start_time + action_timeout |
|
78 |
while end_time > time.time(): |
|
72 | 79 |
try: |
73 |
return check_fun() |
|
80 |
ret_value = check_fun() |
|
81 |
self.info("Operation `%s' finished in %s seconds", |
|
82 |
opmsg, int(time.time()) - start_time) |
|
83 |
return ret_value |
|
74 | 84 |
except Retry: |
75 | 85 |
time.sleep(self.query_interval) |
76 |
self.error("Operation `%s' timed out", opmsg) |
|
86 |
self.error("Operation `%s' timed out after %s seconds", |
|
87 |
opmsg, int(time.time()) - start_time) |
|
77 | 88 |
self.fail("time out") |
78 | 89 |
|
79 | 90 |
def _get_list_of_servers(self, detail=False): |
Also available in: Unified diff