[llvm-commits] [zorg] r125914 - in /zorg/trunk/llvmlab/llvmlab/ci: buildbot/statusclient.py status.py
Daniel Dunbar
daniel at zuster.org
Fri Feb 18 08:43:29 PST 2011
Author: ddunbar
Date: Fri Feb 18 10:43:28 2011
New Revision: 125914
URL: http://llvm.org/viewvc/llvm-project?rev=125914&view=rev
Log:
llvmlab: Don't crash on network outages.
Modified:
zorg/trunk/llvmlab/llvmlab/ci/buildbot/statusclient.py
zorg/trunk/llvmlab/llvmlab/ci/status.py
Modified: zorg/trunk/llvmlab/llvmlab/ci/buildbot/statusclient.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ci/buildbot/statusclient.py?rev=125914&r1=125913&r2=125914&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ci/buildbot/statusclient.py (original)
+++ zorg/trunk/llvmlab/llvmlab/ci/buildbot/statusclient.py Fri Feb 18 10:43:28 2011
@@ -88,7 +88,13 @@
path += '?' + urllib2.urlencode(arguments)
url = self.master_url + path
- request = urllib2.urlopen(url)
+ try:
+ request = urllib2.urlopen(url)
+ except:
+ # FIXME: Logging.
+ import traceback
+ traceback.print_exc()
+ return None
data = request.read()
request.close()
@@ -116,6 +122,9 @@
# FIXME: BuildBot should provide a more efficient query for this.
#yield ('poll_builders',)
res = self.get_json_result(('builders',))
+ if not res:
+ return
+
builder_names = set(res.keys())
current_builders = set(self.builders)
@@ -134,6 +143,8 @@
# Get the latest build number.
res = self.get_json_result(('builders', builder.name, 'builds', '-1'))
+ if not res:
+ return
number = res['number']
# Check if we need to start or reset the state.
@@ -157,6 +168,8 @@
for id in builds:
res = self.get_json_result(('builders', builder.name, 'builds',
str(id)))
+ if not res:
+ continue
times = res.get('times')
# In rare circumstances, we could have accessed an invalid build,
Modified: zorg/trunk/llvmlab/llvmlab/ci/status.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ci/status.py?rev=125914&r1=125913&r2=125914&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ci/status.py (original)
+++ zorg/trunk/llvmlab/llvmlab/ci/status.py Fri Feb 18 10:43:28 2011
@@ -86,10 +86,11 @@
# Get the build information.
res = self.status.statusclient.get_json_result((
'builders', name, 'builds', str(build.number)))
- build.result = res['results']
- build.source_stamp = res['sourceStamp']['revision']
- build.start_time = res['times'][0]
- build.end_time = res['times'][1]
+ if res:
+ build.result = res['results']
+ build.source_stamp = res['sourceStamp']['revision']
+ build.start_time = res['times'][0]
+ build.end_time = res['times'][1]
else:
# FIXME: Use flask logging APIs.
print >>sys.stderr,"warning: unknown event '%r'" % (event,)
More information about the llvm-commits
mailing list