| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 | 7 |
| 8 """Generate new bench expectations from results of trybots on a code review.""" | 8 """Generate new bench expectations from results of trybots on a code review.""" |
| 9 | 9 |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 codereview_url: URL of the codereview in question. | 34 codereview_url: URL of the codereview in question. |
| 35 | 35 |
| 36 Returns: | 36 Returns: |
| 37 List of NamedTuples: (builder_name, build_number, is_finished) | 37 List of NamedTuples: (builder_name, build_number, is_finished) |
| 38 """ | 38 """ |
| 39 results = compare_codereview.CodeReviewHTMLParser().parse(codereview_url) | 39 results = compare_codereview.CodeReviewHTMLParser().parse(codereview_url) |
| 40 try_builds = [] | 40 try_builds = [] |
| 41 for builder, data in results.iteritems(): | 41 for builder, data in results.iteritems(): |
| 42 if builder.startswith('Perf'): | 42 if builder.startswith('Perf'): |
| 43 build_num = data.url.split('/')[-1] if data.url else None | 43 build_num = data.url.split('/')[-1] if data.url else None |
| 44 try_builds.append(TryBuild(builder, build_num, | 44 is_finished = (data.status not in ('pending', 'try-pending') and |
| 45 data.status != 'pending')) | 45 build_num is not None) |
| 46 try_builds.append(TryBuild(builder_name=builder, |
| 47 build_number=build_num, |
| 48 is_finished=is_finished)) |
| 46 return try_builds | 49 return try_builds |
| 47 | 50 |
| 48 | 51 |
| 49 def _all_trybots_finished(try_builds): | 52 def _all_trybots_finished(try_builds): |
| 50 """Return True iff all of the given try jobs have finished. | 53 """Return True iff all of the given try jobs have finished. |
| 51 | 54 |
| 52 Args: | 55 Args: |
| 53 try_builds: list of TryBuild instances. | 56 try_builds: list of TryBuild instances. |
| 54 | 57 |
| 55 Returns: | 58 Returns: |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if failed_gen_expectations: | 174 if failed_gen_expectations: |
| 172 failure += 'Failed to generate expectations for: %s\n\n' % ','.join( | 175 failure += 'Failed to generate expectations for: %s\n\n' % ','.join( |
| 173 failed_gen_expectations) | 176 failed_gen_expectations) |
| 174 if failure: | 177 if failure: |
| 175 raise Exception(failure) | 178 raise Exception(failure) |
| 176 | 179 |
| 177 | 180 |
| 178 if __name__ == '__main__': | 181 if __name__ == '__main__': |
| 179 gen_bench_expectations_from_codereview(sys.argv[1]) | 182 gen_bench_expectations_from_codereview(sys.argv[1]) |
| 180 | 183 |
| OLD | NEW |