From: Zack Cerza Date: Sat, 8 Mar 2014 21:21:45 +0000 (-0600) Subject: Make try_push_job_info() retry using safe_while X-Git-Tag: 1.1.0~1608 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e471f404e6dfcb2c1fcbaeac23207caad70c1e8e;p=teuthology.git Make try_push_job_info() retry using safe_while 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 --- diff --git a/teuthology/report.py b/teuthology/report.py index 367adc1d4c..198f281f0c 100644 --- a/teuthology/report.py +++ b/teuthology/report.py @@ -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)