Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """A command to fetch new baselines from try jobs for the current CL.""" | 5 """A command to fetch new baselines from try jobs for the current CL.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import optparse | 9 import optparse |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 super(RebaselineCL, self).__init__(options=[ | 29 super(RebaselineCL, self).__init__(options=[ |
| 30 optparse.make_option( | 30 optparse.make_option( |
| 31 '--dry-run', action='store_true', default=False, | 31 '--dry-run', action='store_true', default=False, |
| 32 help='Dry run mode; list actions that would be performed but do not do anything.'), | 32 help='Dry run mode; list actions that would be performed but do not do anything.'), |
| 33 optparse.make_option( | 33 optparse.make_option( |
| 34 '--only-changed-tests', action='store_true', default=False, | 34 '--only-changed-tests', action='store_true', default=False, |
| 35 help='Only download new baselines for tests that are changed in the CL.'), | 35 help='Only download new baselines for tests that are changed in the CL.'), |
| 36 optparse.make_option( | 36 optparse.make_option( |
| 37 '--no-trigger-jobs', dest='trigger_jobs', action='store_false', default=True, | 37 '--no-trigger-jobs', dest='trigger_jobs', action='store_false', default=True, |
| 38 help='Do not trigger any try jobs.'), | 38 help='Do not trigger any try jobs.'), |
| 39 optparse.make_option( | |
| 40 '--fill-missing', dest='fill_missing', action='store_true', defa ult=False, | |
| 41 help='If some builds have no results available, use results from other builds.'), | |
|
wkorman
2017/04/10 20:12:27
This reads as if the port will be the same and the
qyearsley
2017/04/10 23:52:09
Ah, yes, not just "use results from other builds",
| |
| 39 self.no_optimize_option, | 42 self.no_optimize_option, |
| 40 self.results_directory_option, | 43 self.results_directory_option, |
| 41 ]) | 44 ]) |
| 42 | 45 |
| 43 def execute(self, options, args, tool): | 46 def execute(self, options, args, tool): |
| 44 self._tool = tool | 47 self._tool = tool |
| 45 | 48 |
| 46 # TODO(qyearsley): Move this call to somewhere else. | 49 # TODO(qyearsley): Move this call to somewhere else. |
| 47 WPTManifest.ensure_manifest(tool) | 50 WPTManifest.ensure_manifest(tool) |
| 48 | 51 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 66 _log.info('There are existing pending builds for:') | 69 _log.info('There are existing pending builds for:') |
| 67 for builder in sorted(builders_with_pending_builds): | 70 for builder in sorted(builders_with_pending_builds): |
| 68 _log.info(' %s', builder) | 71 _log.info(' %s', builder) |
| 69 builders_with_no_results = self.builders_with_no_results(builds) | 72 builders_with_no_results = self.builders_with_no_results(builds) |
| 70 | 73 |
| 71 if options.trigger_jobs and builders_with_no_results: | 74 if options.trigger_jobs and builders_with_no_results: |
| 72 self.trigger_builds(builders_with_no_results) | 75 self.trigger_builds(builders_with_no_results) |
| 73 _log.info('Please re-run webkit-patch rebaseline-cl once all pending try jobs have finished.') | 76 _log.info('Please re-run webkit-patch rebaseline-cl once all pending try jobs have finished.') |
| 74 return 1 | 77 return 1 |
| 75 | 78 |
| 76 if builders_with_no_results: | 79 if builders_with_no_results and not options.fill_missing: |
| 77 # TODO(qyearsley): Support trying to continue as long as there are | 80 # TODO(qyearsley): Support trying to continue as long as there are |
| 78 # some results from some builder; see http://crbug.com/673966. | 81 # some results from some builder; see http://crbug.com/673966. |
| 79 _log.error('The following builders have no results:') | 82 _log.error('The following builders have no results:') |
| 80 for builder in builders_with_no_results: | 83 for builder in builders_with_no_results: |
| 81 _log.error(' %s', builder) | 84 _log.error(' %s', builder) |
| 82 return 1 | 85 return 1 |
| 83 | 86 |
| 84 _log.debug('Getting results for issue %d.', issue_number) | 87 _log.debug('Getting results for issue %d.', issue_number) |
| 85 builds_to_results = self._fetch_results(builds) | 88 builds_to_results = self._fetch_results(builds) |
| 86 if builds_to_results is None: | 89 if builds_to_results is None: |
| 87 return 1 | 90 return 1 |
| 88 | 91 |
| 89 test_baseline_set = TestBaselineSet(tool) | 92 test_baseline_set = TestBaselineSet(tool) |
| 90 if args: | 93 if args: |
| 91 for test in args: | 94 for test in args: |
| 92 for build in builds: | 95 for build in builds: |
| 93 test_baseline_set.add(test, build) | 96 test_baseline_set.add(test, build) |
| 94 else: | 97 else: |
| 95 test_baseline_set = self._make_test_baseline_set( | 98 test_baseline_set = self._make_test_baseline_set( |
| 96 builds_to_results, | 99 builds_to_results, |
| 97 only_changed_tests=options.only_changed_tests) | 100 only_changed_tests=options.only_changed_tests) |
| 98 | 101 |
| 102 if options.fill_missing: | |
| 103 self.fill_in_missing_results(test_baseline_set) | |
| 104 | |
| 99 _log.debug('Rebaselining: %s', test_baseline_set) | 105 _log.debug('Rebaselining: %s', test_baseline_set) |
| 100 | 106 |
| 101 if not options.dry_run: | 107 if not options.dry_run: |
| 102 self.rebaseline(options, test_baseline_set) | 108 self.rebaseline(options, test_baseline_set) |
| 103 return 0 | 109 return 0 |
| 104 | 110 |
| 105 def _get_issue_number(self): | 111 def _get_issue_number(self): |
| 106 """Returns the current CL issue number, or None.""" | 112 """Returns the current CL issue number, or None.""" |
| 107 issue = self.git_cl().get_issue_number() | 113 issue = self.git_cl().get_issue_number() |
| 108 if not issue.isdigit(): | 114 if not issue.isdigit(): |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 buildbot = self._tool.buildbot | 219 buildbot = self._tool.buildbot |
| 214 content = buildbot.fetch_retry_summary_json(build) | 220 content = buildbot.fetch_retry_summary_json(build) |
| 215 if content is None: | 221 if content is None: |
| 216 return None | 222 return None |
| 217 try: | 223 try: |
| 218 retry_summary = json.loads(content) | 224 retry_summary = json.loads(content) |
| 219 return retry_summary['failures'] | 225 return retry_summary['failures'] |
| 220 except (ValueError, KeyError): | 226 except (ValueError, KeyError): |
| 221 _log.warning('Unexpected retry summary content:\n%s', content) | 227 _log.warning('Unexpected retry summary content:\n%s', content) |
| 222 return None | 228 return None |
| 229 | |
| 230 def fill_in_missing_results(self, test_baseline_set): | |
| 231 """Modifies test_baseline_set to guarantee that there are entries for | |
| 232 all ports for all tests to rebaseline. | |
| 233 | |
| 234 For a each test prefix, if there is entry for some port, then an entry | |
| 235 should be added | |
| 236 """ | |
| 237 all_ports = {self._tool.builders.port_name_for_builder_name(b) for b in self._try_bots()} | |
| 238 for test_prefix in test_baseline_set.test_prefixes(): | |
| 239 build_port_pairs = test_baseline_set.build_port_pairs(test_prefix) | |
| 240 missing_ports = all_ports - {p for _, p in build_port_pairs} | |
| 241 for port in missing_ports: | |
| 242 # TODO(qyearsley): Decide what build to use for a given port | |
|
wkorman
2017/04/10 20:12:27
Just looking to make sure I understand, is this no
qyearsley
2017/04/10 23:52:10
Something similar, but I believe we can't entirely
wkorman
2017/04/11 20:36:49
Yes, something like this sounds correct to me. Per
qyearsley
2017/04/11 23:23:21
Sounds good, will do :-)
| |
| 243 # in a more sophisticated way, such that a build with a | |
| 244 # "similar" port will be used when available. | |
| 245 build = build_port_pairs[0][0] | |
| 246 test_baseline_set.add(test_prefix, build, port) | |
| 247 return test_baseline_set | |
| OLD | NEW |