Chromium Code Reviews| 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_archived = False | |
| 17 self.build_id = None | |
| 18 if with_patch: | |
| 19 self.bucket = 'chrome-perf-tryjob' | |
| 20 else: | |
| 21 self.bucket = 'chrome-perf' | |
| 22 self.build_file_path = self._get_build_file_path(commit_hash) | |
| 23 | |
| 24 def _get_build_file_path(self, commit_hash): | |
| 25 revision_suffix = '%s.zip' % commit_hash | |
| 26 return self._get_platform_gs_prefix() + revision_suffix | |
| 27 | |
| 28 def _get_platform_gs_prefix(self): | |
| 29 bot_name = self.api.m.properties.get('buildername', '') | |
| 30 if 'win' in bot_name: | |
| 31 if any(b in bot_name for b in ['x64', 'gpu']): | |
| 32 return 'gs://%s/Win x64 Builder/full-build-win32_' % self.bucket | |
| 33 return 'gs://%s/Win Builder/full-build-win32_' % self.bucket | |
| 34 if 'android' in bot_name: | |
| 35 if 'nexus9' in bot_name: | |
| 36 return 'gs://%s/android_perf_rel_arm64/full-build-linux_' % self.bucket | |
| 37 return 'gs://%s/android_perf_rel/full-build-linux_' % self.bucket | |
| 38 if 'mac' in bot_name: | |
| 39 return 'gs://%s/Mac Builder/full-build-mac_' % self.bucket | |
| 40 return 'gs://%s/Linux Builder/full-build-linux' % self.bucket | |
| 41 | |
| 42 | |
| 43 def is_completed(self): | |
| 44 result = self.api.m.buildbucket.get_build(self.build_id) | |
| 45 return result.stdout['status'] == 'COMPLETED' | |
| 46 | |
| 47 def is_build_archived(self): | |
|
RobertoCN
2016/06/21 22:39:43
Maybe merge is_build_archived and is_completed?
Ziqi Xiong
2016/06/22 21:41:25
I am not exactly sure why they should be merged. i
| |
| 48 result = self.api.m.buildbucket.get_build(self.build_id) | |
| 49 self.build_archived = result.stdout['result'] == 'SUCCESS' | |
| 50 return self.build_archived | |
| OLD | NEW |