OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 # Note: The Perf Dashboard will display these data. Any changes here should | |
6 # be updated on Perf Dashboard as well. | |
7 | |
8 _FAILED_INITIAL_CONFIDENCE_ABORT_REASON = ( | |
9 'The metric values for the initial "good" and "bad" revisions ' | |
10 'do not represent a clear regression.') | |
11 | |
12 _DIRECTION_OF_IMPROVEMENT_ABORT_REASON = ( | |
13 'The metric values for the initial "good" and "bad" revisions match the ' | |
14 'expected direction of improvement. Thus, likely represent an improvement ' | |
15 'and not a regression.') | |
16 | |
17 | |
18 def get(bisector): | |
qyearsley
2016/01/11 22:49:43
What do you think about making this a method of Bi
RobertoCN
2016/01/12 20:47:29
+1
chrisphan
2016/01/14 00:53:26
Done.
| |
19 """Returns the results as a jsonable object.""" | |
20 config = bisector.bisect_config | |
21 results_confidence = 0 | |
22 if bisector.culprit: | |
23 results_confidence = bisector.api.m.math_utils.confidence_score( | |
24 bisector.lkgr.values, bisector.fkbr.values) | |
25 | |
26 if bisector.failed: | |
27 status = 'failed' | |
28 elif bisector.bisect_over: | |
29 status = 'completed' | |
30 else: | |
31 status = 'started' | |
32 | |
33 fail_reason = None | |
34 if bisector.failed_initial_confidence: | |
35 fail_reason = _FAILED_INITIAL_CONFIDENCE_ABORT_REASON | |
36 elif bisector.failed_direction: | |
37 fail_reason = _DIRECTION_OF_IMPROVEMENT_ABORT_REASON | |
38 return { | |
39 'try_job_id': config.get('try_job_id'), | |
40 'bug_id': config.get('bug_id'), | |
41 'status': status, | |
42 'buildbot_log_url': '', # TODO(chrisphan) Get this. | |
43 'bisect_bot': bisector.get_perf_tester_name(), | |
44 'command': config['command'], | |
45 'metric': config['metric'], | |
46 'change': bisector.relative_change, | |
47 'score': results_confidence, | |
48 'good_revision': bisector.good_rev.commit_hash, | |
49 'bad_revision': bisector.bad_rev.commit_hash, | |
50 'warnings': bisector.warnings, | |
51 'fail_reason': fail_reason, | |
52 'culprit_data': _culprit_data(bisector), | |
53 'revision_data': _revision_data(bisector) | |
54 } | |
55 | |
qyearsley
2016/01/11 22:49:43
Nit: two spaces between top-level functions
chrisphan
2016/01/14 00:53:26
Done.
| |
56 def _culprit_data(bisector): | |
57 culprit = bisector.culprit | |
58 api = bisector.api | |
59 if not culprit: | |
60 return None | |
61 culprit_cl_hash = culprit.deps_revision or culprit.commit_hash | |
62 culprit_info = api.query_revision_info( | |
63 culprit_cl_hash, culprit.depot_name) | |
64 | |
65 return { | |
66 'subject': culprit_info['subject'], | |
67 'author': culprit_info['author'], | |
68 'email': culprit_info['email'], | |
69 'cl_date': culprit_info['date'], | |
70 'commit_info': culprit_info['body'], | |
71 'revisions_links': [], | |
72 'cl': culprit.deps_revision or culprit.commit_hash | |
73 } | |
74 | |
75 def _revision_data(bisector): | |
76 revision_rows = [] | |
77 for r in bisector.revisions: | |
78 if r.tested or r.aborted: | |
79 revision_rows.append({ | |
80 'depot_name': r.depot_name, | |
81 'deps_revision': r.deps_revision, | |
82 'commit_pos': r.commit_pos, | |
83 'mean_value': r.mean_value, | |
84 'std_dev': r.std_dev, | |
85 'values': r.values, | |
86 'result': 'good' if r.good else 'bad' if r.bad else 'unknown', | |
87 }) | |
88 return revision_rows | |
OLD | NEW |