Chromium Code Reviews| Index: rietveld.py |
| diff --git a/rietveld.py b/rietveld.py |
| index 8f95a5db2f3dee682cd8cbae153985027a584f78..837d4fd63f4da6624bf1fe80ea8564e599505de3 100644 |
| --- a/rietveld.py |
| +++ b/rietveld.py |
| @@ -300,6 +300,37 @@ class Rietveld(object): |
| yield i |
| cursor = '&cursor=%s' % data['cursor'] |
| + def trigger_try_jobs( |
| + self, issue, patchset, reason, clobber, revision, builders_and_tests): |
| + """Requests new try jobs. |
| + |
| + |builders_and_tests| is a map of builders: [tests] to run. |
| + |
| + Returns the keys of the new TryJobResult entites. |
| + """ |
| + params = [ |
| + ('reason', reason), |
| + ('clobber', 'True' if clobber else 'False'), |
| + ('revision', revision if revision else 'HEAD'), |
| + ('builders', json.dumps(builders_and_tests)), |
| + ('xsrf_token', self.xsrf_token()), |
| + ] |
| + return self.post('/%d/try/%d' % (issue, patchset), params) |
| + |
| + def get_pending_try_jobs(self): |
|
Roger Tawa OOO till Jul 10th
2012/09/04 13:40:12
add docstring.
|
| + limit = 100 |
| + url = '/get_pending_try_patchsets?limit=%d' % limit |
| + jobs = [] |
| + cursor = None |
|
Roger Tawa OOO till Jul 10th
2012/09/04 13:40:12
why not make |cursor| an argument to get_pending_t
|
| + while True: |
| + extra = ('&cursor=' + cursor) if cursor else '' |
| + data = json.loads(self.get(url + extra)) |
| + if not data['jobs']: |
| + break |
| + jobs.extend(data['jobs']) |
| + cursor = data['cursor'] |
| + return jobs |
| + |
| def get(self, request_path, **kwargs): |
| kwargs.setdefault('payload', None) |
| return self._send(request_path, **kwargs) |