Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # coding=utf8 | |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | |
|
M-A Ruel
2014/01/10 16:54:32
2014
| |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 """Triggers experimental try jobs on Rietveld without monitoring the results.""" | |
| 6 | |
| 7 import random | |
| 8 import urllib2 | |
| 9 | |
| 10 from verification import base | |
| 11 | |
| 12 | |
| 13 class TriggerExperimentalTryJobVerifier(base.VerifierCheckout): | |
|
M-A Ruel
2014/01/10 16:54:32
Technically, this doesn't require a checkout anymo
| |
| 14 name = 'trigger experimental try job' | |
| 15 | |
| 16 def __init__(self, context, percentage, try_job_description): | |
| 17 super(TriggerExperimentalTryJobVerifier, self).__init__(context) | |
| 18 self.percentage = percentage | |
| 19 self.try_job_description = try_job_description | |
| 20 | |
| 21 def verify(self, pending): | |
| 22 if random.random() < self.percentage: | |
| 23 try: | |
| 24 self.context.rietveld.trigger_try_jobs( | |
| 25 pending.issue, pending.patchset, 'CQ', False, 'HEAD', | |
| 26 self.try_job_description) | |
| 27 except urllib2.HTTPError as e: | |
| 28 if e.code == 400: | |
|
M-A Ruel
2014/01/10 16:54:32
You should probably eat 500 and 503 that happens w
| |
| 29 # This probably means a new patchset was uploaded since the last poll. | |
| 30 pass | |
| 31 else: | |
| 32 raise | |
| 33 | |
| 34 # Always succeed - experimental try jobs are not stable enough | |
| 35 # to block CQ on them, but triggering builds allows developers | |
| 36 # to get enough real-world traffic to get them to stable state. | |
| 37 pending.verifications[self.name] = base.SimpleStatus(base.SUCCEEDED) | |
| 38 | |
| 39 def update_status(self, queue): | |
| 40 pass | |
| OLD | NEW |