OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """An interface for holding state and result of revisions in a bisect job. | 5 """An interface for holding state and result of revisions in a bisect job. |
6 | 6 |
7 When implementing support for tests other than perf, one should extend this | 7 When implementing support for tests other than perf, one should extend this |
8 class so that the bisect module and recipe can use it. | 8 class so that the bisect module and recipe can use it. |
9 | 9 |
10 See perf_revision_state for an example. | 10 See perf_revision_state for an example. |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 api = self.bisector.api | 290 api = self.bisector.api |
291 self.build_archived = api.gsutil_file_exists(self.build_url) | 291 self.build_archived = api.gsutil_file_exists(self.build_url) |
292 | 292 |
293 if self.bisector.dummy_builds: | 293 if self.bisector.dummy_builds: |
294 self.build_archived = self.in_progress | 294 self.build_archived = self.in_progress |
295 | 295 |
296 return self.build_archived | 296 return self.build_archived |
297 | 297 |
298 def _is_build_failed(self): | 298 def _is_build_failed(self): |
299 api = self.bisector.api | 299 api = self.bisector.api |
300 result = api.m.buildbucket.get_build( | 300 try: |
301 self.build_id, | 301 result = api.m.buildbucket.get_build( |
302 api.m.service_account.get_json_path(api.SERVICE_ACCOUNT), | 302 self.build_id, |
303 step_test_data=lambda: api.m.json.test_api.output_stream( | 303 api.m.service_account.get_json_path(api.SERVICE_ACCOUNT), |
304 {'build': {'result': 'SUCCESS', 'status': 'COMPLETED'}} | 304 step_test_data=lambda: api.m.json.test_api.output_stream( |
305 )) | 305 {'build': {'result': 'SUCCESS', 'status': 'COMPLETED'}} |
306 )) | |
307 except api.m.step.StepFailure: # pragma: no cover | |
308 # If the check fails, we cannot assume that the build is failed. | |
prasadv1
2016/10/21 21:37:17
What should happen when buildbucket.get() fails an
| |
309 return False | |
306 return (result.stdout['build']['status'] == 'COMPLETED' and | 310 return (result.stdout['build']['status'] == 'COMPLETED' and |
307 result.stdout['build'].get('result') != 'SUCCESS') | 311 result.stdout['build'].get('result') != 'SUCCESS') |
308 | 312 |
309 def _results_available(self): | 313 def _results_available(self): |
310 """Checks if the results for the test job have been uploaded.""" | 314 """Checks if the results for the test job have been uploaded.""" |
311 api = self.bisector.api | 315 api = self.bisector.api |
312 result = api.gsutil_file_exists(self.test_results_url) | 316 result = api.gsutil_file_exists(self.test_results_url) |
313 if self.bisector.dummy_builds: | 317 if self.bisector.dummy_builds: |
314 return self.in_progress | 318 return self.in_progress |
315 return result # pragma: no cover | 319 return result # pragma: no cover |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 else: | 573 else: |
570 next_revision_to_test.retest() | 574 next_revision_to_test.retest() |
571 | 575 |
572 def __repr__(self): | 576 def __repr__(self): |
573 if self.overall_return_code is not None: | 577 if self.overall_return_code is not None: |
574 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' | 578 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' |
575 'std_dev=%r)') % (self.revision_string(), self.values, | 579 'std_dev=%r)') % (self.revision_string(), self.values, |
576 self.overall_return_code, self.std_dev) | 580 self.overall_return_code, self.std_dev) |
577 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( | 581 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( |
578 self.revision_string(), self.values, self.mean_value, self.std_dev)) | 582 self.revision_string(), self.values, self.mean_value, self.std_dev)) |
OLD | NEW |