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 22 matching lines...) Expand all Loading... | |
33 Args: | 33 Args: |
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 print data | |
borenet
2014/05/29 15:43:47
Will remove this before submitting.
| |
43 build_num = data.url.split('/')[-1] if data.url else None | 44 build_num = data.url.split('/')[-1] if data.url else None |
44 try_builds.append(TryBuild(builder, build_num, | 45 is_finished = (data.status not in ('pending', 'try-pending') and |
45 data.status != 'pending')) | 46 build_num is not None) |
47 try_builds.append(TryBuild(builder_name=builder, | |
48 build_number=build_num, | |
49 is_finished=is_finished)) | |
46 return try_builds | 50 return try_builds |
47 | 51 |
48 | 52 |
49 def _all_trybots_finished(try_builds): | 53 def _all_trybots_finished(try_builds): |
50 """Return True iff all of the given try jobs have finished. | 54 """Return True iff all of the given try jobs have finished. |
51 | 55 |
52 Args: | 56 Args: |
53 try_builds: list of TryBuild instances. | 57 try_builds: list of TryBuild instances. |
54 | 58 |
55 Returns: | 59 Returns: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 if failed_gen_expectations: | 175 if failed_gen_expectations: |
172 failure += 'Failed to generate expectations for: %s\n\n' % ','.join( | 176 failure += 'Failed to generate expectations for: %s\n\n' % ','.join( |
173 failed_gen_expectations) | 177 failed_gen_expectations) |
174 if failure: | 178 if failure: |
175 raise Exception(failure) | 179 raise Exception(failure) |
176 | 180 |
177 | 181 |
178 if __name__ == '__main__': | 182 if __name__ == '__main__': |
179 gen_bench_expectations_from_codereview(sys.argv[1]) | 183 gen_bench_expectations_from_codereview(sys.argv[1]) |
180 | 184 |
OLD | NEW |