Chromium Code Reviews| 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 """API for the bisect recipe module. | 5 """API for the bisect recipe module. |
| 6 | 6 |
| 7 This API is meant to enable the bisect recipe to bisect any chromium-supported | 7 This API is meant to enable the bisect recipe to bisect any chromium-supported |
| 8 platform for any test that can be run via buildbot, perf or otherwise. | 8 platform for any test that can be run via buildbot, perf or otherwise. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 from slave import recipe_api | 11 from slave import recipe_api |
| 12 from . import bisector | 12 from . import bisector |
| 13 from . import perf_revision_state | 13 from . import perf_revision_state |
| 14 | 14 |
| 15 | 15 |
| 16 class AutoBisectApi(recipe_api.RecipeApi): | 16 class AutoBisectApi(recipe_api.RecipeApi): |
| 17 """A module for bisect specific functions.""" | 17 """A module for bisect specific functions.""" |
| 18 | 18 |
| 19 POLLING_INTERVAL = 60 | 19 POLLING_INTERVAL = 60 |
| 20 BUCKET = 'chrome-perf' | 20 BUCKET = 'chrome-perf' |
| 21 RESULTS_GS_DIR = 'bisect-results' | 21 RESULTS_GS_DIR = 'bisect-results' |
| 22 GS_RESULTS_URL = 'gs://%s/%s/' % (BUCKET, RESULTS_GS_DIR) | 22 GS_RESULTS_URL = 'gs://%s/%s/' % (BUCKET, RESULTS_GS_DIR) |
| 23 SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' | 23 SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' |
| 24 BOT_EMAIL = 'chrome_bot@chromium.org' | |
|
qyearsley
2015/03/10 23:20:48
Note: Just looking at the names, I can't tell what
RobertoCN
2015/03/13 20:55:58
Done.
| |
| 24 | 25 |
| 25 def __init__(self, *args, **kwargs): | 26 def __init__(self, *args, **kwargs): |
| 26 super(AutoBisectApi, self).__init__(*args, **kwargs) | 27 super(AutoBisectApi, self).__init__(*args, **kwargs) |
| 27 self.override_poll_interval = None | 28 self.override_poll_interval = None |
| 28 | 29 |
| 29 def create_bisector(self, bisect_config): | 30 def create_bisector(self, bisect_config): |
| 30 """Passes the api and the config dictionary to the Bisector constructor.""" | 31 """Passes the api and the config dictionary to the Bisector constructor.""" |
| 31 bisect_config_dict = bisect_config | 32 bisect_config_dict = bisect_config |
|
qyearsley
2015/03/10 23:20:48
Could you just call the argument bisect_config_dic
RobertoCN
2015/03/13 20:55:58
Done.
| |
| 32 self.override_poll_interval = bisect_config_dict.get('poll_sleep', None) | 33 self.override_poll_interval = bisect_config_dict.get('poll_sleep', None) |
| 33 revision_class = self._get_revision_class(bisect_config_dict['test_type']) | 34 revision_class = self._get_revision_class(bisect_config_dict['test_type']) |
| 34 return bisector.Bisector(self, bisect_config_dict, revision_class) | 35 return bisector.Bisector(self, bisect_config_dict, revision_class) |
| 35 | 36 |
| 36 def _get_revision_class(self, test_type): | 37 def _get_revision_class(self, test_type): |
| 37 """Gets the particular subclass of Revision needed for the test type.""" | 38 """Gets the particular subclass of Revision needed for the test type.""" |
| 38 if test_type == 'perf': | 39 if test_type == 'perf': |
| 39 return perf_revision_state.PerfRevisionState | 40 return perf_revision_state.PerfRevisionState |
| 40 else: #pragma: no cover | 41 else: #pragma: no cover |
| 41 raise NotImplementedError() | 42 raise NotImplementedError() |
| 42 | 43 |
| 43 def gsutil_file_exists(self, path): | 44 def gsutil_file_exists(self, path): |
| 44 """Returns True if a file exists at the given GS path.""" | 45 """Returns True if a file exists at the given GS path.""" |
| 45 try: | 46 try: |
| 46 self.m.gsutil(['ls', path]) | 47 self.m.gsutil(['ls', path]) |
| 47 except self.m.step.StepFailure: #pragma: no cover | 48 except self.m.step.StepFailure: #pragma: no cover |
| 48 return False | 49 return False |
| 49 return True | 50 return True |
| OLD | NEW |