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 # Number of seconds to wait between polls for test results | |
| 19 POLLING_INTERVAL = 60 | 20 POLLING_INTERVAL = 60 |
| 21 # GS bucket to use for communicating results and job state between bisector | |
| 22 # and tester bots | |
| 20 BUCKET = 'chrome-perf' | 23 BUCKET = 'chrome-perf' |
| 24 # Directory within the above bucket to store results | |
| 21 RESULTS_GS_DIR = 'bisect-results' | 25 RESULTS_GS_DIR = 'bisect-results' |
| 22 GS_RESULTS_URL = 'gs://%s/%s/' % (BUCKET, RESULTS_GS_DIR) | 26 GS_RESULTS_URL = 'gs://%s/%s/' % (BUCKET, RESULTS_GS_DIR) |
| 27 # Repo for triggering build jobs | |
| 23 SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' | 28 SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' |
| 29 # Email to send on try jobs (for build requests) since git try will not | |
| 30 # necessarily rely on a local checkout for that information | |
|
qyearsley
2015/03/13 23:38:59
[Optional] Could add periods after the comments ab
| |
| 31 BOT_EMAIL = 'chrome_bot@chromium.org' | |
| 24 | 32 |
| 25 def __init__(self, *args, **kwargs): | 33 def __init__(self, *args, **kwargs): |
| 26 super(AutoBisectApi, self).__init__(*args, **kwargs) | 34 super(AutoBisectApi, self).__init__(*args, **kwargs) |
| 27 self.override_poll_interval = None | 35 self.override_poll_interval = None |
| 28 | 36 |
| 29 def create_bisector(self, bisect_config): | 37 def create_bisector(self, bisect_config_dict): |
| 30 """Passes the api and the config dictionary to the Bisector constructor.""" | 38 """Passes the api and the config dictionary to the Bisector constructor.""" |
| 31 bisect_config_dict = bisect_config | 39 self.override_poll_interval = bisect_config_dict.get('poll_sleep') |
| 32 self.override_poll_interval = bisect_config_dict.get('poll_sleep', None) | |
| 33 revision_class = self._get_revision_class(bisect_config_dict['test_type']) | 40 revision_class = self._get_revision_class(bisect_config_dict['test_type']) |
| 34 return bisector.Bisector(self, bisect_config_dict, revision_class) | 41 return bisector.Bisector(self, bisect_config_dict, revision_class) |
| 35 | 42 |
| 36 def _get_revision_class(self, test_type): | 43 def _get_revision_class(self, test_type): |
| 37 """Gets the particular subclass of Revision needed for the test type.""" | 44 """Gets the particular subclass of Revision needed for the test type.""" |
| 38 if test_type == 'perf': | 45 if test_type == 'perf': |
| 39 return perf_revision_state.PerfRevisionState | 46 return perf_revision_state.PerfRevisionState |
| 40 else: #pragma: no cover | 47 else: #pragma: no cover |
| 41 raise NotImplementedError() | 48 raise NotImplementedError() |
| 42 | 49 |
| 43 def gsutil_file_exists(self, path): | 50 def gsutil_file_exists(self, path): |
| 44 """Returns True if a file exists at the given GS path.""" | 51 """Returns True if a file exists at the given GS path.""" |
| 45 try: | 52 try: |
| 46 self.m.gsutil(['ls', path]) | 53 self.m.gsutil(['ls', path]) |
| 47 except self.m.step.StepFailure: #pragma: no cover | 54 except self.m.step.StepFailure: #pragma: no cover |
| 48 return False | 55 return False |
| 49 return True | 56 return True |
| OLD | NEW |