[pypy-commit] benchmarks default: If the web POST request fails, retry a few times before
arigo
noreply at buildbot.pypy.org
Sun Sep 4 13:16:03 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r142:295b8e416c4a
Date: 2011-09-04 13:15 +0200
http://bitbucket.org/pypy/benchmarks/changeset/295b8e416c4a/
Log: If the web POST request fails, retry a few times before giving up.
diff --git a/saveresults.py b/saveresults.py
--- a/saveresults.py
+++ b/saveresults.py
@@ -21,7 +21,7 @@
"""
import sys
-import urllib, urllib2
+import urllib, urllib2, time
from datetime import datetime
import optparse
@@ -93,9 +93,19 @@
info += str(data['commitid']) + ", benchmark " + data['benchmark']
print(info)
try:
- f = urllib2.urlopen(SPEEDURL + 'result/add/', params)
- response = f.read()
- f.close()
+ retries = [10, 20, 30, 60, 150, 300]
+ while True:
+ try:
+ f = urllib2.urlopen(SPEEDURL + 'result/add/', params)
+ response = f.read()
+ f.close()
+ break
+ except urllib2.URLError:
+ if not retries:
+ raise
+ d = retries.pop(0)
+ print "retrying in %d seconds..." % d
+ time.sleep(d)
except urllib2.URLError, e:
if hasattr(e, 'reason'):
response = '\n We failed to reach a server\n'
More information about the pypy-commit
mailing list