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): | |
| 13 self.api = api | |
| 14 self.commit_hash = str(commit_hash) | |
| 15 self.build_file_path = self._get_build_file_path(commit_hash) | |
| 16 self.build_archived = False | |
| 17 self.build_id = None | |
| 18 | |
| 19 def _get_build_file_path(self, commit_hash): | |
| 20 revision_suffix = '%s.zip' % commit_hash | |
| 21 return self._get_platform_gs_prefix() + revision_suffix | |
| 22 | |
| 23 # Duplicate code from auto_bisect.revision_state._get_platform_gs_prefix | |
| 24 def _get_platform_gs_prefix(self): | |
|
prasadv
2016/06/20 18:31:47
I think we can add bucket as argument to this meth
Ziqi Xiong
2016/06/21 22:21:26
Done.
| |
| 25 bot_name = self.api.m.properties.get('buildername', '') | |
| 26 if 'win' in bot_name: | |
| 27 if any(b in bot_name for b in ['x64', 'gpu']): | |
| 28 return 'gs://chrome-perf-tryjob/Win x64 Builder/full-build-win32_' | |
| 29 return 'gs://chrome-perf-tryjob/Win Builder/full-build-win32_' | |
| 30 if 'android' in bot_name: | |
| 31 if 'nexus9' in bot_name: | |
| 32 return 'gs://chrome-perf-tryjob/android_perf_rel_arm64/full-build-linux_ ' | |
| 33 return 'gs://chrome-perf-tryjob/android_perf_rel/full-build-linux_' | |
| 34 if 'mac' in bot_name: | |
| 35 return 'gs://chrome-perf-tryjob/Mac Builder/full-build-mac_' | |
| 36 return 'gs://chrome-perf-tryjob/Linux Builder/full-build-linux' | |
| 37 | |
| 38 | |
| 39 def is_completed(self): | |
| 40 result = self.api.m.buildbucket.get(self.build_id) | |
| 41 return result.stdout['status'] == 'COMPLETED' | |
| 42 | |
| 43 # Duplicate code from auto_bisect.revision_state.is_build_archived | |
| 44 def is_build_archived(self): | |
| 45 result = self.api.m.buildbucket.get(self.build_id) | |
| 46 self.build_archived = result.stdout['result'] == 'SUCCESS' | |
| 47 return self.build_archived | |
| OLD | NEW |