Chromium Code Reviews| Index: scripts/slave/recipe_modules/perf_try/build_state.py |
| diff --git a/scripts/slave/recipe_modules/perf_try/build_state.py b/scripts/slave/recipe_modules/perf_try/build_state.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7f0319874d063b5a4f5d549e794f9fb3cfcdde46 |
| --- /dev/null |
| +++ b/scripts/slave/recipe_modules/perf_try/build_state.py |
| @@ -0,0 +1,47 @@ |
| +""" |
| + Most code in this class are copied or adapted from revision_state in |
| + auto_bisect module. Future refactoring is needed. |
| +""" |
| + |
| +import json |
| + |
| +class BuildState(object): |
| + |
| + SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION = range(5) |
| + |
| + def __init__(self, api, commit_hash): |
| + self.api = api |
| + self.commit_hash = str(commit_hash) |
| + self.build_file_path = self._get_build_file_path(commit_hash) |
| + self.build_archived = False |
| + self.build_id = None |
| + |
| + def _get_build_file_path(self, commit_hash): |
| + revision_suffix = '%s.zip' % commit_hash |
| + return self._get_platform_gs_prefix() + revision_suffix |
| + |
| + # Duplicate code from auto_bisect.revision_state._get_platform_gs_prefix |
| + 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.
|
| + bot_name = self.api.m.properties.get('buildername', '') |
| + if 'win' in bot_name: |
| + if any(b in bot_name for b in ['x64', 'gpu']): |
| + return 'gs://chrome-perf-tryjob/Win x64 Builder/full-build-win32_' |
| + return 'gs://chrome-perf-tryjob/Win Builder/full-build-win32_' |
| + if 'android' in bot_name: |
| + if 'nexus9' in bot_name: |
| + return 'gs://chrome-perf-tryjob/android_perf_rel_arm64/full-build-linux_' |
| + return 'gs://chrome-perf-tryjob/android_perf_rel/full-build-linux_' |
| + if 'mac' in bot_name: |
| + return 'gs://chrome-perf-tryjob/Mac Builder/full-build-mac_' |
| + return 'gs://chrome-perf-tryjob/Linux Builder/full-build-linux' |
| + |
| + |
| + def is_completed(self): |
| + result = self.api.m.buildbucket.get(self.build_id) |
| + return result.stdout['status'] == 'COMPLETED' |
| + |
| + # Duplicate code from auto_bisect.revision_state.is_build_archived |
| + def is_build_archived(self): |
| + result = self.api.m.buildbucket.get(self.build_id) |
| + self.build_archived = result.stdout['result'] == 'SUCCESS' |
| + return self.build_archived |