| OLD | NEW |
| (Empty) | |
| 1 """ |
| 2 Most code in this class are copied or adapted from revision_state in |
| 3 auto_bisect module. Future refactoring is needed. |
| 4 """ |
| 5 |
| 6 import json |
| 7 |
| 8 class BuildState(object): |
| 9 |
| 10 SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION = range(5) |
| 11 |
| 12 def __init__(self, api, commit_hash, with_patch): |
| 13 super(BuildState, self).__init__() |
| 14 self.api = api |
| 15 self.commit_hash = str(commit_hash) |
| 16 self.build_id = None |
| 17 if with_patch: |
| 18 self.bucket = 'chrome-perf-tryjob' |
| 19 else: |
| 20 self.bucket = 'chrome-perf' |
| 21 self.build_file_path = self._get_build_file_path(commit_hash) |
| 22 |
| 23 def _get_build_file_path(self, commit_hash): |
| 24 revision_suffix = '%s.zip' % commit_hash |
| 25 return self._get_platform_gs_prefix() + revision_suffix |
| 26 |
| 27 def _get_platform_gs_prefix(self): |
| 28 bot_name = self.api.m.properties.get('buildername', '') |
| 29 if 'win' in bot_name: |
| 30 if any(b in bot_name for b in ['x64', 'gpu']): |
| 31 return 'gs://%s/Win x64 Builder/full-build-win32_' % self.bucket |
| 32 return 'gs://%s/Win Builder/full-build-win32_' % self.bucket |
| 33 if 'android' in bot_name: |
| 34 if 'nexus9' in bot_name: |
| 35 return 'gs://%s/android_perf_rel_arm64/full-build-linux_' % self.bucket |
| 36 return 'gs://%s/android_perf_rel/full-build-linux_' % self.bucket |
| 37 if 'mac' in bot_name: |
| 38 return 'gs://%s/Mac Builder/full-build-mac_' % self.bucket |
| 39 return 'gs://%s/Linux Builder/full-build-linux' % self.bucket |
| 40 |
| 41 def is_completed(self): |
| 42 result = self.api.m.buildbucket.get_build(self.build_id) |
| 43 return result.stdout['status'] == 'COMPLETED' |
| 44 |
| 45 def is_build_archived(self): |
| 46 result = self.api.m.buildbucket.get_build(self.build_id) |
| 47 return result.stdout['result'] == 'SUCCESS' |
| OLD | NEW |