| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 if not self.build_archived: | 274 if not self.build_archived: |
| 275 api = self.bisector.api | 275 api = self.bisector.api |
| 276 self.build_archived = api.gsutil_file_exists(self.build_url) | 276 self.build_archived = api.gsutil_file_exists(self.build_url) |
| 277 | 277 |
| 278 if self.bisector.dummy_builds: | 278 if self.bisector.dummy_builds: |
| 279 self.build_archived = self.in_progress | 279 self.build_archived = self.in_progress |
| 280 | 280 |
| 281 return self.build_archived | 281 return self.build_archived |
| 282 | 282 |
| 283 def _is_build_failed(self): | 283 def _is_build_failed(self): |
| 284 result = self.bisector.api.m.buildbucket.get_build( | 284 api = self.bisector.api |
| 285 result = api.m.buildbucket.get_build( |
| 285 self.build_id, | 286 self.build_id, |
| 286 step_test_data=lambda: self.bisector.api.m.json.test_api.output_stream( | 287 api.m.service_account.get_json_path(api.SERVICE_ACCOUNT), |
| 288 step_test_data=lambda: api.m.json.test_api.output_stream( |
| 287 {'build': {'result': 'SUCCESS', 'status': 'COMPLETED'}} | 289 {'build': {'result': 'SUCCESS', 'status': 'COMPLETED'}} |
| 288 )) | 290 )) |
| 289 return (result.stdout['build']['status'] == 'COMPLETED' and | 291 return (result.stdout['build']['status'] == 'COMPLETED' and |
| 290 result.stdout['build'].get('result') != 'SUCCESS') | 292 result.stdout['build'].get('result') != 'SUCCESS') |
| 291 | 293 |
| 292 def _results_available(self): | 294 def _results_available(self): |
| 293 """Checks if the results for the test job have been uploaded.""" | 295 """Checks if the results for the test job have been uploaded.""" |
| 294 api = self.bisector.api | 296 api = self.bisector.api |
| 295 result = api.gsutil_file_exists(self.test_results_url) | 297 result = api.gsutil_file_exists(self.test_results_url) |
| 296 if self.bisector.dummy_builds: | 298 if self.bisector.dummy_builds: |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 else: | 573 else: |
| 572 next_revision_to_test.retest() | 574 next_revision_to_test.retest() |
| 573 | 575 |
| 574 def __repr__(self): | 576 def __repr__(self): |
| 575 if self.overall_return_code is not None: | 577 if self.overall_return_code is not None: |
| 576 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' | 578 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' |
| 577 'std_dev=%r)') % (self.revision_string(), self.values, | 579 'std_dev=%r)') % (self.revision_string(), self.values, |
| 578 self.overall_return_code, self.std_dev) | 580 self.overall_return_code, self.std_dev) |
| 579 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)' % ( |
| 580 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 |