[pypy-svn] r75100 - pypy/benchmarks
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 4 12:34:41 CEST 2010
Author: arigo
Date: Fri Jun 4 12:34:40 2010
New Revision: 75100
Modified:
pypy/benchmarks/saveresults.py
Log:
To be sure: check explicitly if we *can* contact speed.pypy.org
before using the URL and reporting possibly obscured errors.
Modified: pypy/benchmarks/saveresults.py
==============================================================================
--- pypy/benchmarks/saveresults.py (original)
+++ pypy/benchmarks/saveresults.py Fri Jun 4 12:34:40 2010
@@ -55,6 +55,9 @@
info = str(datetime.today()) + ": Saving result for " + data['executable_name'] + " revision "
info += str(data['commitid']) + ", benchmark " + data['benchmark']
print(info)
+ if not check_host_exists(SPEEDURL):
+ print "fail to contact the host of %s\n" % (SPEEDURL,)
+ return 1
try:
f = urllib2.urlopen(SPEEDURL + 'result/add/', params)
response = f.read()
@@ -71,3 +74,11 @@
print "saved correctly!\n"
return 0
+def check_host_exists(url):
+ import urlparse, socket
+ machinename = urlparse.urlparse(url)[1]
+ try:
+ socket.gethostbyname(machinename)
+ return True
+ except socket.gaierror:
+ return False
More information about the Pypy-commit
mailing list