OLD | NEW |
---|---|
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 <link href="../model/ct-builder-revisions.html" rel="import"> | 6 <link href="../model/ct-builder-revisions.html" rel="import"> |
7 | 7 |
8 <link rel="import" href="../lib/net.html"> | 8 <link rel="import" href="../lib/net.html"> |
9 <link rel="import" href="../model/ct-failure.html"> | 9 <link rel="import" href="../model/ct-failure.html"> |
10 <link rel="import" href="../model/ct-failure-group.html"> | 10 <link rel="import" href="../model/ct-failure-group.html"> |
(...skipping 14 matching lines...) Expand all Loading... | |
25 ], | 25 ], |
26 chromium: [ | 26 chromium: [ |
27 "https://build.chromium.org/p/chromium", | 27 "https://build.chromium.org/p/chromium", |
28 "https://build.chromium.org/p/chromium.chrome", | 28 "https://build.chromium.org/p/chromium.chrome", |
29 "https://build.chromium.org/p/chromium.chromiumos", | 29 "https://build.chromium.org/p/chromium.chromiumos", |
30 "https://build.chromium.org/p/chromium.gpu", | 30 "https://build.chromium.org/p/chromium.gpu", |
31 "https://build.chromium.org/p/chromium.linux", | 31 "https://build.chromium.org/p/chromium.linux", |
32 "https://build.chromium.org/p/chromium.mac", | 32 "https://build.chromium.org/p/chromium.mac", |
33 "https://build.chromium.org/p/chromium.memory", | 33 "https://build.chromium.org/p/chromium.memory", |
34 "https://build.chromium.org/p/chromium.win" | 34 "https://build.chromium.org/p/chromium.win" |
35 ], | 35 ] |
36 }, | 36 }, |
37 | 37 |
38 _failureListComparator: function(tree, a, b) { | 38 _failureListComparator: function(tree, a, b) { |
39 if (tree === undefined) | 39 if (tree === undefined) |
40 tree = 'chromium'; | 40 tree = 'chromium'; |
41 | 41 |
42 var rev_a = a[0].firstFailingRevisions; | 42 var rev_a = a[0].firstFailingRevisions; |
43 var rev_b = b[0].firstFailingRevisions; | 43 var rev_b = b[0].firstFailingRevisions; |
44 | 44 |
45 // Handle missing revision. | 45 // Handle missing revision. |
(...skipping 16 matching lines...) Expand all Loading... | |
62 if (rev_a[keys[i]] != rev_b[keys[i]]) | 62 if (rev_a[keys[i]] != rev_b[keys[i]]) |
63 return rev_b[keys[i]] - rev_a[keys[i]]; | 63 return rev_b[keys[i]] - rev_a[keys[i]]; |
64 } | 64 } |
65 return 0; | 65 return 0; |
66 }, | 66 }, |
67 | 67 |
68 update: function() { | 68 update: function() { |
69 var annotationPromise = CTFailureGroup.fetchAnnotations(); | 69 var annotationPromise = CTFailureGroup.fetchAnnotations(); |
70 net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(data ) { | 70 net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(data ) { |
71 annotationPromise.then(function(annotations) { | 71 annotationPromise.then(function(annotations) { |
72 // FIXME: Don't special-case the blink master. | 72 net.json('http://localhost:8123/builder_alerts.json').then(function( trooper_data) { |
73 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_rev isions['chromium.webkit']); | 73 trooper_data = JSON.parse(trooper_data.content); |
74 this.failures = {}; | 74 // FIXME: Don't special-case the blink master. |
75 this.lastUpdateDate = new Date(data.date * 1000); | 75 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_r evisions['chromium.webkit']); |
76 data.range_groups.forEach(function(group) { | 76 this.failures = {}; |
77 this._processFailuresForGroup(group, data.alerts, annotations); | 77 this.lastUpdateDate = new Date(data.date * 1000); |
78 }.bind(this)); | 78 data.range_groups.forEach(function(group) { |
79 Object.keys(this.failures, function (tree, failuresByTree) { | 79 this._processFailuresForGroup(group, data.alerts, annotations); |
80 this.failures[tree].sort(this._failureListComparator.bind(this, tr ee)); | 80 }.bind(this)); |
81 trooper_data.range_groups.forEach(function(group) { | |
82 this._processFailuresForGroup(group, trooper_data.alerts, annota tions, 'trooper'); | |
83 }.bind(this)); | |
84 Object.keys(this.failures, function (tree, failuresByTree) { | |
85 this.failures[tree].sort(this._failureListComparator.bind(this, tree)); | |
86 }.bind(this)); | |
81 }.bind(this)); | 87 }.bind(this)); |
82 }.bind(this)); | 88 }.bind(this)); |
83 }.bind(this)); | 89 }.bind(this)); |
84 }, | 90 }, |
85 | 91 |
86 _failureComparator: function(a, b) { | 92 _failureComparator: function(a, b) { |
87 if (a.step > b.step) | 93 if (a.step > b.step) |
88 return 1; | 94 return 1; |
89 if (a.step < b.step) | 95 if (a.step < b.step) |
90 return -1 | 96 return -1 |
91 if (a.testName > b.testName) | 97 if (a.testName > b.testName) |
92 return 1; | 98 return 1; |
93 if (a.testName < b.testName) | 99 if (a.testName < b.testName) |
94 return -1 | 100 return -1 |
95 return 0; | 101 return 0; |
96 }, | 102 }, |
97 | 103 |
98 _processFailuresForGroup: function(group, failures, annotations) { | 104 _processFailuresForGroup: function(group, failures, annotations, tree) { |
ojan
2014/08/16 02:15:39
Nit: I typically annotate optional arguments with
| |
99 var failuresByReason = {}; | 105 var failuresByReason = {}; |
100 | 106 |
101 var masterToTree = {}; | 107 var masterToTree = {}; |
102 Object.keys(this._trees, function(tree, masters) { | 108 Object.keys(this._trees, function(tree, masters) { |
103 masters.forEach(function(master) { | 109 masters.forEach(function(master) { |
104 masterToTree[master] = tree; | 110 masterToTree[master] = tree; |
105 }); | 111 }); |
106 }); | 112 }); |
107 | 113 |
108 group.failure_keys.forEach(function(failure_key) { | 114 group.failure_keys.forEach(function(failure_key) { |
109 var failure = failures.find(function(item) { return item.key == failur e_key; }); | 115 var failure = failures.find(function(item) { return item.key == failur e_key; }); |
110 var reason, failureType; | 116 var reason, failureType; |
111 if (failure.reason) { | 117 if (failure.reason) { |
112 // FIXME: Store the actual failure type in a different field instead of smashing it into the reason. | 118 // FIXME: Store the actual failure type in a different field instead of smashing it into the reason. |
113 var parts = failure.reason.split(':'); | 119 var parts = failure.reason.split(':'); |
114 reason = parts[0]; | 120 reason = parts[0]; |
115 failureType = parts[1] || 'FAIL'; | 121 failureType = parts[1] || 'FAIL'; |
116 } else { | 122 } else { |
117 reason = null; | 123 reason = null; |
118 failureType = 'UNKNOWN'; | 124 failureType = 'UNKNOWN'; |
119 } | 125 } |
120 | 126 |
121 var failureKey = JSON.stringify({ | 127 var failureKey = JSON.stringify({ |
122 step: failure.step_name, | 128 step: failure.step_name, |
123 reason: reason, | 129 reason: reason, |
124 }); | 130 }); |
125 | 131 |
126 var tree = masterToTree[failure.master_url]; | 132 tree = tree || masterToTree[failure.master_url]; |
127 | 133 |
128 // FIXME: Use a model class instead of a dumb object. | 134 // FIXME: Use a model class instead of a dumb object. |
129 if (!failuresByReason[failureKey]) | 135 if (!failuresByReason[failureKey]) |
130 failuresByReason[failureKey] = {}; | 136 failuresByReason[failureKey] = {}; |
131 if (!failuresByReason[failureKey][tree]) | 137 if (!failuresByReason[failureKey][tree]) |
132 failuresByReason[failureKey][tree] = {}; | 138 failuresByReason[failureKey][tree] = {}; |
133 failuresByReason[failureKey][tree][failure.builder_name] = { | 139 failuresByReason[failureKey][tree][failure.builder_name] = { |
134 // FIXME: Rename to failureType. | 140 // FIXME: Rename to failureType. |
135 actual: failureType, | 141 actual: failureType, |
136 lastFailingBuild: failure.last_failing_build, | 142 lastFailingBuild: failure.last_failing_build, |
(...skipping 18 matching lines...) Expand all Loading... | |
155 if (!this.failures[tree]) | 161 if (!this.failures[tree]) |
156 this.failures[tree] = []; | 162 this.failures[tree] = []; |
157 // FIXME: Need a better identifier for a failure group; | 163 // FIXME: Need a better identifier for a failure group; |
158 var key = group.sort_key; | 164 var key = group.sort_key; |
159 this.failures[tree].push(new CTFailureGroup(key, failures, annotations [key])); | 165 this.failures[tree].push(new CTFailureGroup(key, failures, annotations [key])); |
160 }.bind(this)); | 166 }.bind(this)); |
161 }, | 167 }, |
162 }); | 168 }); |
163 </script> | 169 </script> |
164 </polymer-element> | 170 </polymer-element> |
OLD | NEW |