]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Make try_push_job_info() retry using safe_while
authorZack Cerza <zack@cerza.org>
Sat, 8 Mar 2014 21:21:45 +0000 (15:21 -0600)
committerZack Cerza <zack@cerza.org>
Sat, 8 Mar 2014 21:36:22 +0000 (15:36 -0600)
I've noticed sometimes try_push_job_info() fails because of server load
issues. It should try more than once (and now does).

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/report.py

index 367adc1d4c7aabd6b7e38d9e8e3e080099aaa804..198f281f0ca4d85ddf2241bf6d99db6dcfdfaf16 100644 (file)
@@ -7,7 +7,8 @@ import logging
 import socket
 
 import teuthology
-from teuthology.config import config
+from .config import config
+from .contextutil import safe_while
 
 
 # Don't need to see connection pool INFO messages
@@ -342,9 +343,12 @@ def try_push_job_info(job_config, extra_info=None):
     else:
         job_info = job_config
 
-    try:
-        log.info("Pushing job info to %s", config.results_server)
-        push_job_info(run_name, job_id, job_info)
-    except (requests.exceptions.RequestException, socket.error):
-        log.exception("Could not report results to %s" %
-                      config.results_server)
+    with safe_while(_raise=False) as proceed:
+        while proceed():
+            try:
+                log.info("Pushing job info to %s", config.results_server)
+                push_job_info(run_name, job_id, job_info)
+                return
+            except (requests.exceptions.RequestException, socket.error):
+                log.exception("Could not report results to %s" %
+                              config.results_server)