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

Side by Side Diff: rietveld.py

Issue 178223016: Support multiple try masters when sending tries to rietveld. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Addressed review comments. Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """Defines class Rietveld to easily access a rietveld instance. 5 """Defines class Rietveld to easily access a rietveld instance.
6 6
7 Security implications: 7 Security implications:
8 8
9 The following hypothesis are made: 9 The following hypothesis are made:
10 - Rietveld enforces: 10 - Rietveld enforces:
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 # It's an error message. Return as no result. 324 # It's an error message. Return as no result.
325 break 325 break
326 data = json.loads(output) or {} 326 data = json.loads(output) or {}
327 if not data.get('results'): 327 if not data.get('results'):
328 break 328 break
329 for i in data['results']: 329 for i in data['results']:
330 yield i 330 yield i
331 cursor = '&cursor=%s' % data['cursor'] 331 cursor = '&cursor=%s' % data['cursor']
332 332
333 def trigger_try_jobs( 333 def trigger_try_jobs(
334 self, issue, patchset, reason, clobber, revision, builders_and_tests): 334 self, issue, patchset, reason, clobber, revision, builders_and_tests):
ghost stip (do not use) 2014/03/01 00:56:16 add optional master= argument, and have trigger_di
335 """Requests new try jobs. 335 """Requests new try jobs. Deprecated in favor of the method below.
336 336
337 |builders_and_tests| is a map of builders: [tests] to run. 337 |builders_and_tests| is a map of builders: [tests] to run.
338 338
339 Returns the keys of the new TryJobResult entites. 339 Returns the keys of the new TryJobResult entites.
340 """ 340 """
341 params = [ 341 params = [
342 ('reason', reason), 342 ('reason', reason),
343 ('clobber', 'True' if clobber else 'False'), 343 ('clobber', 'True' if clobber else 'False'),
344 ('builders', json.dumps(builders_and_tests)), 344 ('builders', json.dumps(builders_and_tests)),
345 ('xsrf_token', self.xsrf_token()), 345 ('xsrf_token', self.xsrf_token()),
346 ] 346 ]
347 if revision: 347 if revision:
348 params.append(('revision', revision)) 348 params.append(('revision', revision))
349 return self.post('/%d/try/%d' % (issue, patchset), params) 349 return self.post('/%d/try/%d' % (issue, patchset), params)
350 350
351 def trigger_distributed_try_jobs(
352 self, issue, patchset, reason, clobber, revision, masters):
353 """Requests new try jobs.
354
355 |masters| is a map of masters: map of builders: [tests] to run.
356 """
357 for (master, builders_and_tests) in masters.iteritems():
358 params = [
359 ('reason', reason),
360 ('clobber', 'True' if clobber else 'False'),
361 ('builders', json.dumps(builders_and_tests)),
362 ('xsrf_token', self.xsrf_token()),
363 ]
364 if revision:
365 params.append(('revision', revision))
366 if master:
367 # Temporarily allow empty master names for old configurations. The try
368 # job will not be associated with a master name on rietveld. This is
369 # going to be deprecated.
370 params.append(('master', master))
371 self.post('/%d/try/%d' % (issue, patchset), params)
372
351 def get_pending_try_jobs(self, cursor=None, limit=100): 373 def get_pending_try_jobs(self, cursor=None, limit=100):
352 """Retrieves the try job requests in pending state. 374 """Retrieves the try job requests in pending state.
353 375
354 Returns a tuple of the list of try jobs and the cursor for the next request. 376 Returns a tuple of the list of try jobs and the cursor for the next request.
355 """ 377 """
356 url = '/get_pending_try_patchsets?limit=%d' % limit 378 url = '/get_pending_try_patchsets?limit=%d' % limit
357 extra = ('&cursor=' + cursor) if cursor else '' 379 extra = ('&cursor=' + cursor) if cursor else ''
358 data = json.loads(self.get(url + extra)) 380 data = json.loads(self.get(url + extra))
359 return data['jobs'], data['cursor'] 381 return data['jobs'], data['cursor']
360 382
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 557
536 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 558 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201
537 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % 559 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' %
538 (flag, value, issue)) 560 (flag, value, issue))
539 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value 561 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value
540 562
541 def trigger_try_jobs( # pylint:disable=R0201 563 def trigger_try_jobs( # pylint:disable=R0201
542 self, issue, patchset, reason, clobber, revision, builders_and_tests): 564 self, issue, patchset, reason, clobber, revision, builders_and_tests):
543 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % 565 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
544 (builders_and_tests, issue)) 566 (builders_and_tests, issue))
567
568 def trigger_distributed_try_jobs( # pylint:disable=R0201
569 self, issue, patchset, reason, clobber, revision, masters):
570 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
571 (masters, issue))
OLDNEW
« presubmit_support.py ('K') | « presubmit_support.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698