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

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: add unittest 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 | third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py » ('j') | 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
19
20 def latest_try_jobs(issue_number, builder_names, web, patchset_number=None): 19 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. 20 """Returns a list of TryJob objects for jobs on the latest patchset.
22 21
23 Args: 22 Args:
24 issue_number: A Rietveld issue number. 23 issue_number: A Rietveld issue number.
25 builder_names: Builders that we're interested in; try jobs for only 24 builder_names: Builders that we're interested in; try jobs for only
26 these builders will be listed. 25 these builders will be listed.
27 web: webkitpy.common.net.web.Web object (which can be mocked out). 26 web: webkitpy.common.net.web.Web object (which can be mocked out).
28 patchset_number: Use a specific patchset instead of the latest one. 27 patchset_number: Use a specific patchset instead of the latest one.
29 28
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 _log.error('Invalid JSON: %s' % contents) 72 _log.error('Invalid JSON: %s' % contents)
74 raise 73 raise
75 74
76 75
77 def _issue_url(issue_number): 76 def _issue_url(issue_number):
78 return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number) 77 return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number)
79 78
80 79
81 def _patchset_url(issue_number, patchset_number): 80 def _patchset_url(issue_number, patchset_number):
82 return '%s/%s' % (_issue_url(issue_number), patchset_number) 81 return '%s/%s' % (_issue_url(issue_number), patchset_number)
82
83
84 def get_latest_try_job_results(issue_number, web):
85 url = _latest_patchset_url(issue_number, web)
86 patchset_data = _get_json(url, web)
87 results = {}
88 for job in patchset_data['try_job_results']:
89 results[job['builder']] = job['result']
90 return results
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698