OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """Sends patches to the Try server and reads back results. | 5 """Sends patches to the Try server and reads back results. |
6 """ | 6 """ |
7 | 7 |
8 import datetime | 8 import datetime |
9 import json | 9 import json |
10 import logging | 10 import logging |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 def build_status_url(self): | 56 def build_status_url(self): |
57 return '%sbuildstatus?builder=%s&number=%s' % ( | 57 return '%sbuildstatus?builder=%s&number=%s' % ( |
58 self.base_url, self.builder, self.build) | 58 self.base_url, self.builder, self.build) |
59 | 59 |
60 def json_url(self): | 60 def json_url(self): |
61 return '%sjson/builders/%s/builds/%s' % ( | 61 return '%sjson/builders/%s/builds/%s' % ( |
62 self.base_url, self.builder, self.build) | 62 self.base_url, self.builder, self.build) |
63 | 63 |
64 | 64 |
65 class TryJobs(model.PersistentMixIn): | 65 class TryJobs(base.IVerifierStatus): |
66 """A set of try jobs that were sent for a specific patch.""" | 66 """A set of try jobs that were sent for a specific patch.""" |
67 persistent = [ | 67 persistent = [ |
68 'try_jobs', | 68 'try_jobs', |
69 ] | 69 ] |
70 | 70 |
71 def __init__(self): | 71 def __init__(self): |
72 super(TryJobs, self).__init__() | 72 super(TryJobs, self).__init__() |
73 # An array of TryJob objects. | 73 # An array of TryJob objects. |
74 self.try_jobs = [] | 74 self.try_jobs = [] |
75 | 75 |
(...skipping 10 matching lines...) Expand all Loading... |
86 def failed(self): | 86 def failed(self): |
87 """At least one try job failed.""" | 87 """At least one try job failed.""" |
88 if not self.try_jobs: | 88 if not self.try_jobs: |
89 return False | 89 return False |
90 for job in self.try_jobs: | 90 for job in self.try_jobs: |
91 if job.result in (FAILURE, EXCEPTION): | 91 if job.result in (FAILURE, EXCEPTION): |
92 assert job.build | 92 assert job.build |
93 return True | 93 return True |
94 return False | 94 return False |
95 | 95 |
| 96 def ignored(self): |
| 97 return False |
| 98 |
96 | 99 |
97 class TryRunner(base.Verifier): | 100 class TryRunner(base.Verifier): |
98 """Stateless communication with a try server. | 101 """Stateless communication with a try server. |
99 | 102 |
100 Sends try jobs and reads try job status. | 103 Sends try jobs and reads try job status. |
101 """ | 104 """ |
102 name = 'try server' | 105 name = 'try server' |
103 | 106 |
104 def __init__(self, try_server_url, commit_user, builders, tests, extra_flags): | 107 def __init__(self, try_server_url, commit_user, builders, tests, extra_flags): |
105 super(TryRunner, self).__init__() | 108 super(TryRunner, self).__init__() |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 else: | 208 else: |
206 build_status = alljobs[job.builder].get(str(job.build), None) | 209 build_status = alljobs[job.builder].get(str(job.build), None) |
207 if build_status: | 210 if build_status: |
208 self._handle_try_job(pending, job, build_status) | 211 self._handle_try_job(pending, job, build_status) |
209 | 212 |
210 def _handle_try_job(self, pending, job, build_status): | 213 def _handle_try_job(self, pending, job, build_status): |
211 """Determines if the try job is a good signal to commit the patch.""" | 214 """Determines if the try job is a good signal to commit the patch.""" |
212 job.result = build_status.get(u'results', None) | 215 job.result = build_status.get(u'results', None) |
213 logging.info(u'Try job status for %s on %s: %s' % | 216 logging.info(u'Try job status for %s on %s: %s' % |
214 (pending.pending_name(), job.builder, job.result)) | 217 (pending.pending_name(), job.builder, job.result)) |
OLD | NEW |