Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: Tools/GardeningServer/model/ct-failures.html

Issue 476903004: [sheriff-o-matic]: Basic trooper display for sheriff-o-matic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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-sheriff-failure-group-data.html">
12 <link rel="import" href="ct-trooper-failure-group-data.html">
11 <link rel="import" href="ct-commit-list.html"> 13 <link rel="import" href="ct-commit-list.html">
12 14
13 <script> 15 <script>
14 function CTFailures(commitLog) { 16 function CTFailures(commitLog) {
15 this.commitLog = commitLog; 17 this.commitLog = commitLog;
16 this.builderLatestRevisions = null; 18 this.builderLatestRevisions = null;
17 this.failures = null; 19 this.failures = {}
18 this.lastUpdateDate = null; 20 this.lastUpdateDate = null;
19 21
20 // FIXME: Get this from 22 // FIXME: Get this from
21 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla ve/gatekeeper_trees.json?format=text. 23 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla ve/gatekeeper_trees.json?format=text.
22 this._trees = { 24 this._trees = {
23 blink: [ 25 blink: [
24 "https://build.chromium.org/p/chromium.webkit", 26 "https://build.chromium.org/p/chromium.webkit",
25 ], 27 ],
26 chromium: [ 28 chromium: [
27 "https://build.chromium.org/p/chromium", 29 "https://build.chromium.org/p/chromium",
28 "https://build.chromium.org/p/chromium.chrome", 30 "https://build.chromium.org/p/chromium.chrome",
29 "https://build.chromium.org/p/chromium.chromiumos", 31 "https://build.chromium.org/p/chromium.chromiumos",
30 "https://build.chromium.org/p/chromium.gpu", 32 "https://build.chromium.org/p/chromium.gpu",
31 "https://build.chromium.org/p/chromium.linux", 33 "https://build.chromium.org/p/chromium.linux",
32 "https://build.chromium.org/p/chromium.mac", 34 "https://build.chromium.org/p/chromium.mac",
33 "https://build.chromium.org/p/chromium.memory", 35 "https://build.chromium.org/p/chromium.memory",
34 "https://build.chromium.org/p/chromium.win" 36 "https://build.chromium.org/p/chromium.win"
35 ], 37 ],
36 }; 38 };
37 } 39 }
38 40
41 // FIXME: This could potentially move onto CTSheriffFailureGroupData as it isn't relevant to
42 // trooper failures.
39 // Reverse sorting order, if a > b, return a negative number. 43 // Reverse sorting order, if a > b, return a negative number.
40 CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { 44 CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) {
41 if (tree === undefined) 45 if (tree === undefined)
42 tree = 'chromium'; 46 tree = 'chromium';
43 47
44 var rev_a = a.commitList.revisions; 48 var rev_a = a.data.commitList.revisions;
45 var rev_b = b.commitList.revisions; 49 var rev_b = b.data.commitList.revisions;
46 50
47 if (!rev_a || !Object.keys(rev_a).length) { 51 if (!rev_a || !Object.keys(rev_a).length) {
48 if (!rev_b || !Object.keys(rev_b).length) 52 if (!rev_b || !Object.keys(rev_b).length)
49 return 0; 53 return 0;
50 return 1; 54 return 1;
51 } else if (!rev_b || !Object.keys(rev_b).length) { 55 } else if (!rev_b || !Object.keys(rev_b).length) {
52 return -1; 56 return -1;
53 } 57 }
54 58
55 // Prioritize the tree's revision, if they are unequal (else, fallback below) 59 // Prioritize the tree's revision, if they are unequal (else, fallback below)
(...skipping 14 matching lines...) Expand all
70 return -1; 74 return -1;
71 75
72 if (a_list.last() != b_list.last()) 76 if (a_list.last() != b_list.last())
73 return b_list.last() - a_list.last(); 77 return b_list.last() - a_list.last();
74 } 78 }
75 return 0; 79 return 0;
76 }; 80 };
77 81
78 CTFailures.prototype.update = function() { 82 CTFailures.prototype.update = function() {
79 var annotationPromise = CTFailureGroup.fetchAnnotations(); 83 var annotationPromise = CTFailureGroup.fetchAnnotations();
80 net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(data) { 84 Promise.all([annotationPromise, net.json('http://sheriff-o-matic.appspot.com/a lerts'),
81 annotationPromise.then(function(annotations) { 85 net.json('http://trooper-o-matic.appspot.com/alerts')]).then(function(data _array) {
82 // FIXME: Don't special-case the blink master. 86 var annotations = data_array[0];
83 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_builder_i nfo['chromium.webkit']); 87 var sheriff_data = data_array[1];
84 this.failures = {}; 88 var trooper_data = data_array[2];
85 this.lastUpdateDate = new Date(data.date * 1000); 89
86 // Update |failures| with the appropriate CTFailureGroup's for each 90 // FIXME: Don't special-case the blink master.
87 // tree. 91 this.builderLatestRevisions = new CTBuilderRevisions(sheriff_data.latest_bui lder_info['chromium.webkit']);
88 data.range_groups.forEach(function(rangeGroup) { 92 this.lastUpdateDate = new Date(sheriff_data.date * 1000);
89 this._processFailuresForRangeGroup(rangeGroup, data.alerts, annotations) ; 93 // Update |failures| with the appropriate CTFailureGroup's for each
90 }.bind(this)); 94 // tree.
91 // Sort failure groups so that newer failures are shown at the top 95 sheriff_data.range_groups.forEach(function(rangeGroup) {
92 // of the UI. 96 this._processFailuresForRangeGroup(rangeGroup, sheriff_data.alerts, annota tions);
93 Object.keys(this.failures, function (tree, failuresByTree) {
94 this.failures[tree].sort(this._failureByTreeListComparator.bind(this, tr ee));
95 }.bind(this));
96 }.bind(this)); 97 }.bind(this));
98 // Sort failure groups so that newer failures are shown at the top
99 // of the UI.
100 Object.keys(this.failures, function (tree, failuresByTree) {
101 this.failures[tree].sort(this._failureByTreeListComparator.bind(this, tree ));
102 }.bind(this));
103 this._processTrooperFailures(trooper_data);
97 }.bind(this)); 104 }.bind(this));
98 }; 105 };
99 106
100 CTFailures.prototype._failureComparator = function(a, b) { 107 CTFailures.prototype._failureComparator = function(a, b) {
101 if (a.step > b.step) 108 if (a.step > b.step)
102 return 1; 109 return 1;
103 if (a.step < b.step) 110 if (a.step < b.step)
104 return -1 111 return -1
105 if (a.testName > b.testName) 112 if (a.testName > b.testName)
106 return 1; 113 return 1;
107 if (a.testName < b.testName) 114 if (a.testName < b.testName)
108 return -1 115 return -1
109 return 0; 116 return 0;
110 }; 117 };
111 118
119
120 CTFailures.prototype._processTrooperFailures = function(data) {
121 var trooper_failures = [];
122 Object.keys(data, function(failureType, failuresByTree) {
123 Object.keys(failuresByTree, function(tree, failure) {
124 if (failure.should_alert)
ojan 2014/09/04 02:58:43 Put curlies.
shans 2014/09/05 00:08:19 Done.
125 trooper_failures.push(new CTFailureGroup(
126 new CTTrooperFailureGroupData(failure.details, failure.url, failure, failureType, tree)));
127 });
128 });
129 this.failures['trooper'] = trooper_failures;
130 };
131
112 CTFailures.prototype._processFailuresForRangeGroup = function(rangeGroup, alerts , annotations) { 132 CTFailures.prototype._processFailuresForRangeGroup = function(rangeGroup, alerts , annotations) {
113 var masterToTree = {}; 133 var masterToTree = {};
114 Object.keys(this._trees, function(tree, masters) { 134 Object.keys(this._trees, function(tree, masters) {
115 masters.forEach(function(master) { 135 masters.forEach(function(master) {
116 masterToTree[master] = tree; 136 masterToTree[master] = tree;
117 }); 137 });
118 }); 138 });
119 139
120 // A rangeGroup may be related to multiple alerts (via |failure_keys|). Catego rize 140 // 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 141 // these failures by reason (cause of failure), so that they can be grouped in the UI
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 new CTFailure(failure.step, failure.reason, resultsByBuilder)); 196 new CTFailure(failure.step, failure.reason, resultsByBuilder));
177 }) 197 })
178 }); 198 });
179 199
180 Object.keys(groupedFailures, function(tree, failures) { 200 Object.keys(groupedFailures, function(tree, failures) {
181 failures.sort(this._failureComparator); 201 failures.sort(this._failureComparator);
182 202
183 if (!this.failures[tree]) 203 if (!this.failures[tree])
184 this.failures[tree] = []; 204 this.failures[tree] = [];
185 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision s); 205 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision s);
186 this.failures[tree].push(new CTFailureGroup(failures, commitList)); 206 this.failures[tree].push(new CTFailureGroup(new CTSheriffFailureGroupData(fa ilures, commitList)));
187 }.bind(this)); 207 }.bind(this));
188 }; 208 };
189 209
190 </script> 210 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698