blob: 0e8b144c138e4f37334348ccdc67874a4a64817b [file] [log] [blame]
# coding=utf8
# Copyright 2014 The Chromium Authors. All rights reserved.
# 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.Verifier):
name = 'trigger experimental try job'
def __init__(self, context, percentage, try_job_description):
super(TriggerExperimentalTryJobVerifier, self).__init__()
self.context = context
self.percentage = percentage
self.try_job_description = try_job_description
def verify(self, pending):
if random.random() < self.percentage:
pending.issue, pending.patchset, 'CQ', False, 'HEAD',
except urllib2.HTTPError as e:
if e.code not in (400, 500, 503):
# 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[] = base.SimpleStatus(base.SUCCEEDED)
def update_status(self, queue):