Chromium Code Reviews| Index: commit-queue/verification/trigger_experimental_try_job.py |
| =================================================================== |
| --- commit-queue/verification/trigger_experimental_try_job.py (revision 0) |
| +++ commit-queue/verification/trigger_experimental_try_job.py (revision 0) |
| @@ -0,0 +1,40 @@ |
| +# coding=utf8 |
| +# Copyright 2013 The Chromium Authors. All rights reserved. |
|
M-A Ruel
2014/01/10 16:54:32
2014
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +"""Triggers experimental try jobs on Rietveld without monitoring the results.""" |
| + |
| +import random |
| +import urllib2 |
| + |
| +from verification import base |
| + |
| + |
| +class TriggerExperimentalTryJobVerifier(base.VerifierCheckout): |
|
M-A Ruel
2014/01/10 16:54:32
Technically, this doesn't require a checkout anymo
|
| + name = 'trigger experimental try job' |
| + |
| + def __init__(self, context, percentage, try_job_description): |
| + super(TriggerExperimentalTryJobVerifier, self).__init__(context) |
| + self.percentage = percentage |
| + self.try_job_description = try_job_description |
| + |
| + def verify(self, pending): |
| + if random.random() < self.percentage: |
| + try: |
| + self.context.rietveld.trigger_try_jobs( |
| + pending.issue, pending.patchset, 'CQ', False, 'HEAD', |
| + self.try_job_description) |
| + except urllib2.HTTPError as e: |
| + if e.code == 400: |
|
M-A Ruel
2014/01/10 16:54:32
You should probably eat 500 and 503 that happens w
|
| + # This probably means a new patchset was uploaded since the last poll. |
| + pass |
| + else: |
| + raise |
| + |
| + # Always succeed - experimental try jobs are not stable enough |
| + # to block CQ on them, but triggering builds allows developers |
| + # to get enough real-world traffic to get them to stable state. |
| + pending.verifications[self.name] = base.SimpleStatus(base.SUCCEEDED) |
| + |
| + def update_status(self, queue): |
| + pass |
| Property changes on: commit-queue/verification/trigger_experimental_try_job.py |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |