| 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 import json | 5 import json |
| 6 import uuid | 6 import uuid |
| 7 | 7 |
| 8 # This is a wrapper class of revision that stores its build path and | 8 # This is a wrapper class of revision that stores its build path and |
| 9 # queries its status. Part of the code are adapted from the RevisionState | 9 # queries its status. Part of the code are adapted from the RevisionState |
| 10 # class from auto-bisect module | 10 # class from auto-bisect module |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return 'gs://%s/Win Builder/full-build-win32_' % self.bucket | 41 return 'gs://%s/Win Builder/full-build-win32_' % self.bucket |
| 42 if 'android' in bot_name: | 42 if 'android' in bot_name: |
| 43 if 'nexus9' in bot_name or 'nexus5x' in bot_name: | 43 if 'nexus9' in bot_name or 'nexus5x' in bot_name: |
| 44 return 'gs://%s/android_perf_rel_arm64/full-build-linux_' % self.bucket | 44 return 'gs://%s/android_perf_rel_arm64/full-build-linux_' % self.bucket |
| 45 return 'gs://%s/android_perf_rel/full-build-linux_' % self.bucket | 45 return 'gs://%s/android_perf_rel/full-build-linux_' % self.bucket |
| 46 if 'mac' in bot_name: | 46 if 'mac' in bot_name: |
| 47 return 'gs://%s/Mac Builder/full-build-mac_' % self.bucket | 47 return 'gs://%s/Mac Builder/full-build-mac_' % self.bucket |
| 48 return 'gs://%s/Linux Builder/full-build-linux' % self.bucket | 48 return 'gs://%s/Linux Builder/full-build-linux' % self.bucket |
| 49 | 49 |
| 50 def _is_completed(self): | 50 def _is_completed(self): |
| 51 result = self.api.m.buildbucket.get_build(self.build_id) | 51 result = self.api.m.buildbucket.get_build( |
| 52 self.build_id, |
| 53 step_test_data=lambda: self.api.m.json.test_api.output_stream( |
| 54 {'build': {'status': 'COMPLETED'}} |
| 55 )) |
| 52 return result.stdout['build']['status'] == 'COMPLETED' | 56 return result.stdout['build']['status'] == 'COMPLETED' |
| 53 | 57 |
| 54 def _is_build_archived(self): # pragma: no cover | 58 def _is_build_archived(self): # pragma: no cover |
| 55 result = self.api.m.buildbucket.get_build(self.build_id) | 59 result = self.api.m.buildbucket.get_build( |
| 60 self.build_id, |
| 61 step_test_data=lambda: self.api.m.json.test_api.output_stream( |
| 62 {'build': {'result': 'SUCCESS'}} |
| 63 )) |
| 56 return result.stdout['build']['result'] == 'SUCCESS' | 64 return result.stdout['build']['result'] == 'SUCCESS' |
| 57 | 65 |
| 58 # Duplicate code from auto_bisect.bisector.get_builder_bot_for_this_platform | 66 # Duplicate code from auto_bisect.bisector.get_builder_bot_for_this_platform |
| 59 def get_builder_bot_for_this_platform(self): # pragma: no cover | 67 def get_builder_bot_for_this_platform(self): # pragma: no cover |
| 60 bot_name = self.api.m.properties.get('buildername', '') | 68 bot_name = self.api.m.properties.get('buildername', '') |
| 61 if 'win' in bot_name: | 69 if 'win' in bot_name: |
| 62 if any(b in bot_name for b in ['x64', 'gpu']): | 70 if any(b in bot_name for b in ['x64', 'gpu']): |
| 63 return 'winx64_bisect_builder' | 71 return 'winx64_bisect_builder' |
| 64 return 'win_perf_bisect_builder' | 72 return 'win_perf_bisect_builder' |
| 65 | 73 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 'tags':{} | 114 'tags':{} |
| 107 } | 115 } |
| 108 result = self.api.m.buildbucket.put( | 116 result = self.api.m.buildbucket.put( |
| 109 [build_details], | 117 [build_details], |
| 110 self.api.m.service_account.get_json_path(SERVICE_ACCOUNT)) | 118 self.api.m.service_account.get_json_path(SERVICE_ACCOUNT)) |
| 111 self.build_id = result.stdout['results'][0]['build']['id'] | 119 self.build_id = result.stdout['results'][0]['build']['id'] |
| 112 | 120 |
| 113 def wait_for(self): # pragma: no cover | 121 def wait_for(self): # pragma: no cover |
| 114 while True: | 122 while True: |
| 115 if self._is_completed(): | 123 if self._is_completed(): |
| 116 if self._is_build_archived: | 124 if self._is_build_archived(): |
| 117 break | 125 break |
| 118 raise self.api.m.step.StepFailure('Build %s fails' % self.build_id) | 126 raise self.api.m.step.StepFailure('Build %s fails' % self.build_id) |
| 119 else: | 127 else: |
| 120 self.api.m.python.inline( | 128 self.api.m.python.inline( |
| 121 'sleeping', | 129 'sleeping', |
| 122 """ | 130 """ |
| 123 import sys | 131 import sys |
| 124 import time | 132 import time |
| 125 time.sleep(20*60) | 133 time.sleep(20*60) |
| 126 sys.exit(0) | 134 sys.exit(0) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 import sys | 174 import sys |
| 167 shutil.move(sys.argv[1], sys.argv[2]) | 175 shutil.move(sys.argv[1], sys.argv[2]) |
| 168 """, | 176 """, |
| 169 args=[zip_dir, build_dir]) | 177 args=[zip_dir, build_dir]) |
| 170 else: | 178 else: |
| 171 self.api.m.chromium_tests.download_and_unzip_build( | 179 self.api.m.chromium_tests.download_and_unzip_build( |
| 172 mastername, buildername, update_step, bot_db, | 180 mastername, buildername, update_step, bot_db, |
| 173 build_archive_url=self.build_file_path, | 181 build_archive_url=self.build_file_path, |
| 174 build_revision=self.commit_hash, | 182 build_revision=self.commit_hash, |
| 175 override_bot_type='tester') | 183 override_bot_type='tester') |
| OLD | NEW |