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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld.py

Issue 2105043004: Add get_latest_try_jobs_results to rietveld.py to fetch results of try jobs from rietveld (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Utility functions to communicate with Rietveld.""" 5 """Utility functions to communicate with Rietveld."""
6 6
7 import collections 7 import collections
8 import json 8 import json
9 import logging 9 import logging
10 import urllib2 10 import urllib2
11 11
12 12
13 _log = logging.getLogger(__name__) 13 _log = logging.getLogger(__name__)
14 14
15 BASE_CODEREVIEW_URL = 'https://codereview.chromium.org/api' 15 BASE_CODEREVIEW_URL = 'https://codereview.chromium.org/api'
16 16
17 TryJob = collections.namedtuple('TryJob', ('builder_name', 'master_name', 'build _number')) 17 TryJob = collections.namedtuple('TryJob', ('builder_name', 'master_name', 'build _number'))
18 18 TryJobResults = collections.namedtuple('TryJob', ('builder_name', 'result'))
qyearsley 2016/06/29 17:37:56 Since it represents one single job's result, TryJo
19 19
20 def latest_try_jobs(issue_number, builder_names, web, patchset_number=None): 20 def latest_try_jobs(issue_number, builder_names, web, patchset_number=None):
21 """Returns a list of TryJob objects for jobs on the latest patchset. 21 """Returns a list of TryJob objects for jobs on the latest patchset.
22 22
23 Args: 23 Args:
24 issue_number: A Rietveld issue number. 24 issue_number: A Rietveld issue number.
25 builder_names: Builders that we're interested in; try jobs for only 25 builder_names: Builders that we're interested in; try jobs for only
26 these builders will be listed. 26 these builders will be listed.
27 web: webkitpy.common.net.web.Web object (which can be mocked out). 27 web: webkitpy.common.net.web.Web object (which can be mocked out).
28 patchset_number: Use a specific patchset instead of the latest one. 28 patchset_number: Use a specific patchset instead of the latest one.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 _log.error('Invalid JSON: %s' % contents) 73 _log.error('Invalid JSON: %s' % contents)
74 raise 74 raise
75 75
76 76
77 def _issue_url(issue_number): 77 def _issue_url(issue_number):
78 return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number) 78 return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number)
79 79
80 80
81 def _patchset_url(issue_number, patchset_number): 81 def _patchset_url(issue_number, patchset_number):
82 return '%s/%s' % (_issue_url(issue_number), patchset_number) 82 return '%s/%s' % (_issue_url(issue_number), patchset_number)
83
84
85 def get_latest_tryjob_results(issue_number, web):
qyearsley 2016/06/29 17:37:56 In the official documentation, "try job" is two wo
86 url = _latest_patchset_url(issue_number, web)
87 patchset_data = _get_json(url, web)
88 results = []
89 for job in patchset_data['try_job_results']:
90 results.append(TryJobResults(
91 builder_name=job['builder'],
92 result=job['result']))
93 return results
qyearsley 2016/06/29 17:37:56 Alternatively, if you are just having builders and
OLDNEW
« 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