OLD | NEW |
| (Empty) |
1 # coding=utf8 | |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | |
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.Verifier): | |
14 name = 'trigger experimental try job' | |
15 | |
16 def __init__(self, context, percentage, revision, try_job_description): | |
17 super(TriggerExperimentalTryJobVerifier, self).__init__() | |
18 self.context = context | |
19 self.percentage = percentage | |
20 self.revision = revision | |
21 self.try_job_description = try_job_description | |
22 | |
23 def verify(self, pending): | |
24 if random.random() < self.percentage: | |
25 try: | |
26 self.context.rietveld.trigger_try_jobs( | |
27 pending.issue, pending.patchset, 'CQ', False, self.revision, | |
28 self.try_job_description) | |
29 except urllib2.HTTPError as e: | |
30 if e.code not in (400, 500, 503): | |
31 raise | |
32 | |
33 # Always succeed - experimental try jobs are not stable enough | |
34 # to block CQ on them, but triggering builds allows developers | |
35 # to get enough real-world traffic to get them to stable state. | |
36 pending.verifications[self.name] = base.SimpleStatus(base.SUCCEEDED) | |
37 | |
38 def update_status(self, queue): | |
39 pass | |
OLD | NEW |