Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: tools/gn/bin/roll_gn.py

Issue 2819853003: Update GN roller for new JSON endpoints. (Closed)
Patch Set: fix error handling Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/bin/roll_gn.py
diff --git a/tools/gn/bin/roll_gn.py b/tools/gn/bin/roll_gn.py
index 91dad7e6acb75ae8001c10b90988c1b4fab5f439..7436f4ecb59b765461bf63f19f247aa3d66f5e4e 100755
--- a/tools/gn/bin/roll_gn.py
+++ b/tools/gn/bin/roll_gn.py
@@ -186,8 +186,7 @@ class GNRoller(object):
print('Checking build')
results = self.CheckBuild()
- while (len(results) < 3 or
- any(r['state'] in ('pending', 'started')
+ while (any(r['state'] in ('pending', 'started')
for r in results.values())):
print()
print('Sleeping for 30 seconds')
@@ -228,16 +227,18 @@ class GNRoller(object):
rpc_server = upload.GetRpcServer(CODE_REVIEW_SERVER, email)
try:
props = json.loads(rpc_server.Send('/api/%d' % issue))
- except Exception as _e:
- raise
+ except Exception as e:
+ print('Failed to load patch data: %s' % e)
+ return {}
patchset = int(props['patchsets'][-1])
try:
try_job_results = json.loads(rpc_server.Send(
'/api/%d/%d/try_job_results' % (issue, patchset)))
- except Exception as _e:
- raise
+ except Exception as e:
+ print('Failed to load try job results: %s' % e)
+ return {}
if not try_job_results:
print('No try jobs found on most recent patchset')
@@ -266,8 +267,15 @@ class GNRoller(object):
results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str})
if state == 'success':
- jsurl = url_str.replace('/builders/', '/json/builders/')
- fp = urllib2.urlopen(jsurl)
+ jsurl = url_str.replace('http://build.chromium.org/',
+ 'http://chrome-build-extract.appspot.com/')
+ jsurl = jsurl + '?json=1'
+ try:
+ fp = urllib2.urlopen(jsurl)
+ except urllib2.HTTPError as e:
+ print('Failed to open %s: %s' % (jsurl, e))
+ return {}
+
js = json.loads(fp.read())
fp.close()
sha1_step_name = 'gn sha1'
@@ -460,7 +468,7 @@ class GNRoller(object):
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
cwd=(cwd or self.chromium_src_dir))
out, err = proc.communicate()
- return proc.returncode, out, err
+ return proc.returncode, out or '', err or ''
if __name__ == '__main__':
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698