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

Unified Diff: rietveld.py

Issue 10920061: Add function to trigger try jobs on Rietveld. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Change get_pending_try_jobs() Created 8 years, 3 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: rietveld.py
diff --git a/rietveld.py b/rietveld.py
index ee8f00a879ecf818a797e02e18b8dd3faf8b2df5..88f024b6ca05309c26dc6ae30420134d8f4ebba9 100644
--- a/rietveld.py
+++ b/rietveld.py
@@ -303,6 +303,33 @@ 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, cursor=None, limit=100):
+ """Retrieves the try job requests in pending state.
+
+ Returns a tuple of the list of try jobs and the cursor for the next request.
+ """
+ url = '/get_pending_try_patchsets?limit=%d' % limit
+ extra = ('&cursor=' + cursor) if cursor else ''
+ data = json.loads(self.get(url + extra))
+ return data['jobs'], data['cursor']
+
def get(self, request_path, **kwargs):
kwargs.setdefault('payload', None)
return self._send(request_path, **kwargs)
« 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