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 | 6 |
7 <link rel="import" href="../lib/net.html"> | 7 <link rel="import" href="../lib/net.html"> |
8 <link rel="import" href="ct-builder-revisions.html"> | 8 <link rel="import" href="ct-builder-revisions.html"> |
9 <link rel="import" href="ct-failure.html"> | 9 <link rel="import" href="ct-failure.html"> |
10 <link rel="import" href="ct-failure-group.html"> | 10 <link rel="import" href="ct-failure-group.html"> |
11 <link rel="import" href="ct-commit-list.html"> | 11 <link rel="import" href="ct-commit-list.html"> |
12 | 12 |
13 <script> | 13 <script> |
14 function CTFailures(commitLog) { | 14 function CTFailures(commitLog) { |
15 this.commitLog = commitLog; | 15 this.commitLog = commitLog; |
16 this.builderLatestRevisions = null; | 16 this.builderLatestRevisions = null; |
17 this.failures = null; | 17 this.failures = {} |
ojan
2014/09/02 02:35:11
This won't update right until https://codereview.c
shans
2014/09/04 01:59:42
Acknowledged.
| |
18 this.lastUpdateDate = null; | 18 this.lastUpdateDate = null; |
19 | 19 |
20 // FIXME: Get this from | 20 // FIXME: Get this from |
21 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla ve/gatekeeper_trees.json?format=text. | 21 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla ve/gatekeeper_trees.json?format=text. |
22 this._trees = { | 22 this._trees = { |
23 blink: [ | 23 blink: [ |
24 "https://build.chromium.org/p/chromium.webkit", | 24 "https://build.chromium.org/p/chromium.webkit", |
25 ], | 25 ], |
26 chromium: [ | 26 chromium: [ |
27 "https://build.chromium.org/p/chromium", | 27 "https://build.chromium.org/p/chromium", |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 if (a_list.last() != b_list.last()) | 72 if (a_list.last() != b_list.last()) |
73 return b_list.last() - a_list.last(); | 73 return b_list.last() - a_list.last(); |
74 } | 74 } |
75 return 0; | 75 return 0; |
76 }; | 76 }; |
77 | 77 |
78 CTFailures.prototype.update = function() { | 78 CTFailures.prototype.update = function() { |
79 var annotationPromise = CTFailureGroup.fetchAnnotations(); | 79 var annotationPromise = CTFailureGroup.fetchAnnotations(); |
80 net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(data) { | 80 net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(data) { |
81 annotationPromise.then(function(annotations) { | 81 annotationPromise.then(function(annotations) { |
82 // FIXME: Don't special-case the blink master. | 82 net.json('http://trooper-o-matic.appspot.com/alerts').then(function(troope r_data) { |
ojan
2014/09/02 02:35:11
These two requests should be done in parallel. You
shans
2014/09/04 01:59:42
Done.
| |
83 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_builder_i nfo['chromium.webkit']); | 83 // FIXME: Don't special-case the blink master. |
84 this.failures = {}; | 84 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_builder _info['chromium.webkit']); |
85 this.lastUpdateDate = new Date(data.date * 1000); | 85 this.lastUpdateDate = new Date(data.date * 1000); |
86 // Update |failures| with the appropriate CTFailureGroup's for each | 86 // Update |failures| with the appropriate CTFailureGroup's for each |
87 // tree. | 87 // tree. |
88 data.range_groups.forEach(function(rangeGroup) { | 88 data.range_groups.forEach(function(rangeGroup) { |
89 this._processFailuresForRangeGroup(rangeGroup, data.alerts, annotations) ; | 89 this._processFailuresForRangeGroup(rangeGroup, data.alerts, annotation s); |
90 }.bind(this)); | 90 }.bind(this)); |
91 // Sort failure groups so that newer failures are shown at the top | 91 // Sort failure groups so that newer failures are shown at the top |
92 // of the UI. | 92 // of the UI. |
93 Object.keys(this.failures, function (tree, failuresByTree) { | 93 Object.keys(this.failures, function (tree, failuresByTree) { |
94 this.failures[tree].sort(this._failureByTreeListComparator.bind(this, tr ee)); | 94 this.failures[tree].sort(this._failureByTreeListComparator.bind(this, tree)); |
95 }.bind(this)); | |
96 this._processTrooperFailures(trooper_data); | |
95 }.bind(this)); | 97 }.bind(this)); |
96 }.bind(this)); | 98 }.bind(this)); |
97 }.bind(this)); | 99 }.bind(this)); |
98 }; | 100 }; |
99 | 101 |
100 CTFailures.prototype._failureComparator = function(a, b) { | 102 CTFailures.prototype._failureComparator = function(a, b) { |
101 if (a.step > b.step) | 103 if (a.step > b.step) |
102 return 1; | 104 return 1; |
103 if (a.step < b.step) | 105 if (a.step < b.step) |
104 return -1 | 106 return -1 |
105 if (a.testName > b.testName) | 107 if (a.testName > b.testName) |
106 return 1; | 108 return 1; |
107 if (a.testName < b.testName) | 109 if (a.testName < b.testName) |
108 return -1 | 110 return -1 |
109 return 0; | 111 return 0; |
110 }; | 112 }; |
111 | 113 |
114 | |
115 CTFailures.prototype._processTrooperFailures = function(data) { | |
116 var trooper_failures = []; | |
117 for (var key in data) { | |
ojan
2014/09/02 02:35:11
Use Object.keys http://sugarjs.com/api/Object/keys
shans
2014/09/04 01:59:42
Done.
| |
118 for (var tree in data[key]) { | |
119 if (data[key][tree].should_alert) | |
120 trooper_failures.push(new CTTrooperFailureGroup(data[key][tree], key, tr ee)); | |
ojan
2014/09/02 02:35:11
Don't store the raw data object we get from the se
shans
2014/09/04 01:59:42
Done.
| |
121 } | |
122 } | |
123 this.failures['trooper'] = trooper_failures; | |
124 }; | |
125 | |
112 CTFailures.prototype._processFailuresForRangeGroup = function(rangeGroup, alerts , annotations) { | 126 CTFailures.prototype._processFailuresForRangeGroup = function(rangeGroup, alerts , annotations) { |
113 var masterToTree = {}; | 127 var masterToTree = {}; |
114 Object.keys(this._trees, function(tree, masters) { | 128 Object.keys(this._trees, function(tree, masters) { |
115 masters.forEach(function(master) { | 129 masters.forEach(function(master) { |
116 masterToTree[master] = tree; | 130 masterToTree[master] = tree; |
117 }); | 131 }); |
118 }); | 132 }); |
119 | 133 |
120 // A rangeGroup may be related to multiple alerts (via |failure_keys|). Catego rize | 134 // A rangeGroup may be related to multiple alerts (via |failure_keys|). Catego rize |
121 // these failures by reason (cause of failure), so that they can be grouped in the UI | 135 // these failures by reason (cause of failure), so that they can be grouped in the UI |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 failures.sort(this._failureComparator); | 195 failures.sort(this._failureComparator); |
182 | 196 |
183 if (!this.failures[tree]) | 197 if (!this.failures[tree]) |
184 this.failures[tree] = []; | 198 this.failures[tree] = []; |
185 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision s); | 199 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision s); |
186 this.failures[tree].push(new CTFailureGroup(failures, commitList)); | 200 this.failures[tree].push(new CTFailureGroup(failures, commitList)); |
187 }.bind(this)); | 201 }.bind(this)); |
188 }; | 202 }; |
189 | 203 |
190 </script> | 204 </script> |
OLD | NEW |