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

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="../lib/update-util.html"> 8 <link rel="import" href="../lib/update-util.html">
9 <link rel="import" href="ct-builder-revisions.html"> 9 <link rel="import" href="ct-builder-revisions.html">
10 <link rel="import" href="ct-failure.html"> 10 <link rel="import" href="ct-failure.html">
11 <link rel="import" href="ct-failure-group.html"> 11 <link rel="import" href="ct-failure-group.html">
12 <link rel="import" href="ct-sheriff-failure-group-data.html">
13 <link rel="import" href="ct-trooper-failure-group-data.html">
12 <link rel="import" href="ct-commit-list.html"> 14 <link rel="import" href="ct-commit-list.html">
13 15
14 <script> 16 <script>
15 function CTFailures(commitLog) { 17 function CTFailures(commitLog) {
16 this.commitLog = commitLog; 18 this.commitLog = commitLog;
17 this.builderLatestRevisions = null; 19 this.builderLatestRevisions = null;
18 // Maps a tree id to an array of CTFailureGroups within that tree. 20 // Maps a tree id to an array of CTFailureGroups within that tree.
19 this.failures = {}; 21 this.failures = {};
20 this.lastUpdateDate = null; 22 this.lastUpdateDate = null;
21 23
22 // FIXME: Get this from 24 // FIXME: Get this from
23 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla ve/gatekeeper_trees.json?format=text. 25 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla ve/gatekeeper_trees.json?format=text.
24 this._trees = { 26 this._trees = {
25 blink: [ 27 blink: [
26 "https://build.chromium.org/p/chromium.webkit", 28 "https://build.chromium.org/p/chromium.webkit",
27 ], 29 ],
28 chromium: [ 30 chromium: [
29 "https://build.chromium.org/p/chromium", 31 "https://build.chromium.org/p/chromium",
30 "https://build.chromium.org/p/chromium.chrome", 32 "https://build.chromium.org/p/chromium.chrome",
31 "https://build.chromium.org/p/chromium.chromiumos", 33 "https://build.chromium.org/p/chromium.chromiumos",
32 "https://build.chromium.org/p/chromium.gpu", 34 "https://build.chromium.org/p/chromium.gpu",
33 "https://build.chromium.org/p/chromium.linux", 35 "https://build.chromium.org/p/chromium.linux",
34 "https://build.chromium.org/p/chromium.mac", 36 "https://build.chromium.org/p/chromium.mac",
35 "https://build.chromium.org/p/chromium.memory", 37 "https://build.chromium.org/p/chromium.memory",
36 "https://build.chromium.org/p/chromium.win" 38 "https://build.chromium.org/p/chromium.win"
37 ], 39 ],
38 }; 40 };
39 } 41 }
40 42
43 // FIXME: This could potentially move onto CTSheriffFailureGroupData as it isn't relevant to
44 // trooper failures.
41 // Reverse sorting order, if a > b, return a negative number. 45 // Reverse sorting order, if a > b, return a negative number.
42 CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { 46 CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) {
43 if (tree === undefined) 47 if (tree === undefined)
44 tree = 'chromium'; 48 tree = 'chromium';
45 49
46 var rev_a = a.commitList.revisions; 50 var rev_a = a.data.commitList.revisions;
47 var rev_b = b.commitList.revisions; 51 var rev_b = b.data.commitList.revisions;
48 52
49 if (!rev_a || !Object.keys(rev_a).length) { 53 if (!rev_a || !Object.keys(rev_a).length) {
50 if (!rev_b || !Object.keys(rev_b).length) 54 if (!rev_b || !Object.keys(rev_b).length)
51 return 0; 55 return 0;
52 return 1; 56 return 1;
53 } else if (!rev_b || !Object.keys(rev_b).length) { 57 } else if (!rev_b || !Object.keys(rev_b).length) {
54 return -1; 58 return -1;
55 } 59 }
56 60
57 // Prioritize the tree's revision, if they are unequal (else, fallback below) 61 // Prioritize the tree's revision, if they are unequal (else, fallback below)
(...skipping 14 matching lines...) Expand all
72 return -1; 76 return -1;
73 77
74 if (a_list.last() != b_list.last()) 78 if (a_list.last() != b_list.last())
75 return b_list.last() - a_list.last(); 79 return b_list.last() - a_list.last();
76 } 80 }
77 return 0; 81 return 0;
78 }; 82 };
79 83
80 CTFailures.prototype.update = function() { 84 CTFailures.prototype.update = function() {
81 var annotationPromise = CTFailureGroup.fetchAnnotations(); 85 var annotationPromise = CTFailureGroup.fetchAnnotations();
86 return Promise.all([annotationPromise, net.json('http://sheriff-o-matic.appspo t.com/alerts'),
87 net.json('http://trooper-o-matic.appspot.com/alerts')]).then(function(data _array) {
88 var annotations = data_array[0];
89 var sheriff_data = data_array[1];
90 var trooper_data = data_array[2];
82 91
83 return net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(dat a) { 92 // FIXME: Don't special-case the blink master.
84 return annotationPromise.then(function(annotations) { 93 this.builderLatestRevisions = new CTBuilderRevisions(sheriff_data.latest_bui lder_info['chromium.webkit']);
85 // FIXME: Don't special-case the blink master. 94 var newFailures = {};
86 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_builder_i nfo['chromium.webkit']); 95 this.lastUpdateDate = new Date(sheriff_data.date * 1000);
87 var newFailures = {}; 96 // Update |failures| with the appropriate CTFailureGroup's for each
88 this.lastUpdateDate = new Date(data.date * 1000); 97 // tree.
89 // Update |failures| with the appropriate CTFailureGroup's for each 98 sheriff_data.range_groups.forEach(function(rangeGroup) {
90 // tree. 99 this._processFailuresForRangeGroup(newFailures, rangeGroup, sheriff_data.a lerts, annotations);
91 data.range_groups.forEach(function(rangeGroup) {
92 this._processFailuresForRangeGroup(newFailures, rangeGroup, data.alerts, annotations);
93 }.bind(this));
94 // Sort failure groups so that newer failures are shown at the top
95 // of the UI.
96 Object.keys(newFailures, function (tree, failuresByTree) {
97 failuresByTree.sort(this._failureByTreeListComparator.bind(this, tree));
98 }.bind(this));
99 this.failures = updateUtil.updateLeft(this.failures, newFailures);
100 }.bind(this)); 100 }.bind(this));
101 // Sort failure groups so that newer failures are shown at the top
102 // of the UI.
103 Object.keys(newFailures, function (tree, failuresByTree) {
104 failuresByTree.sort(this._failureByTreeListComparator.bind(this, tree));
105 }.bind(this));
106 this.failures = updateUtil.updateLeft(this.failures, newFailures);
107 this._processTrooperFailures(trooper_data);
101 }.bind(this)); 108 }.bind(this));
102 }; 109 };
103 110
104 CTFailures.prototype._failureComparator = function(a, b) { 111 CTFailures.prototype._failureComparator = function(a, b) {
105 if (a.step > b.step) 112 if (a.step > b.step)
106 return 1; 113 return 1;
107 if (a.step < b.step) 114 if (a.step < b.step)
108 return -1 115 return -1
109 if (a.testName > b.testName) 116 if (a.testName > b.testName)
110 return 1; 117 return 1;
111 if (a.testName < b.testName) 118 if (a.testName < b.testName)
112 return -1 119 return -1
113 return 0; 120 return 0;
114 }; 121 };
115 122
123 CTFailures.prototype._processTrooperFailures = function(data) {
124 var trooper_failures = [];
125 Object.keys(data, function(failureType, failuresByTree) {
126 Object.keys(failuresByTree, function(tree, failure) {
127 if (failure.should_alert) {
128 trooper_failures.push(new CTFailureGroup('',
129 new CTTrooperFailureGroupData(failure.details, failure.url, failure, failureType, tree)));
130 }
131 });
132 });
133 this.failures['trooper'] = trooper_failures;
134 };
135
116 CTFailures.prototype._processFailuresForRangeGroup = function(newFailures, range Group, alerts, annotations) { 136 CTFailures.prototype._processFailuresForRangeGroup = function(newFailures, range Group, alerts, annotations) {
117 var masterToTree = {}; 137 var masterToTree = {};
118 Object.keys(this._trees, function(tree, masters) { 138 Object.keys(this._trees, function(tree, masters) {
119 masters.forEach(function(master) { 139 masters.forEach(function(master) {
120 masterToTree[master] = tree; 140 masterToTree[master] = tree;
121 }); 141 });
122 }); 142 });
123 143
124 // A rangeGroup may be related to multiple alerts (via |failure_keys|). Catego rize 144 // A rangeGroup may be related to multiple alerts (via |failure_keys|). Catego rize
125 // these failures by reason (cause of failure), so that they can be grouped in the UI 145 // these failures by reason (cause of failure), so that they can be grouped in the UI
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 new CTFailure(failure.step, failure.reason, resultsByBuilder)); 201 new CTFailure(failure.step, failure.reason, resultsByBuilder));
182 }) 202 })
183 }); 203 });
184 204
185 Object.keys(groupedFailures, function(tree, failures) { 205 Object.keys(groupedFailures, function(tree, failures) {
186 failures.sort(this._failureComparator); 206 failures.sort(this._failureComparator);
187 207
188 if (!newFailures[tree]) 208 if (!newFailures[tree])
189 newFailures[tree] = []; 209 newFailures[tree] = [];
190 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision s); 210 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision s);
191 newFailures[tree].push(new CTFailureGroup(rangeGroup.sort_key, failures, com mitList)); 211 newFailures[tree].push(new CTFailureGroup(rangeGroup.sort_key, new CTSheriff FailureGroupData(failures, commitList)));
192 }.bind(this)); 212 }.bind(this));
193 }; 213 };
194 214
195 </script> 215 </script>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/model/ct-failure-group.html ('k') | Tools/GardeningServer/model/ct-sheriff-failure-group-data.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698