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

Side by Side Diff: tools/gardening/lib/src/bot.dart

Issue 2999433002: Fix `bot summary` when URIs couldn't be read. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « tools/gardening/bin/summary.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'buildbot_data.dart'; 7 import 'buildbot_data.dart';
8 import 'buildbot_structures.dart'; 8 import 'buildbot_structures.dart';
9 import 'client.dart'; 9 import 'client.dart';
10 import 'util.dart'; 10 import 'util.dart';
(...skipping 20 matching lines...) Expand all
31 buildUri = buildUri.prev(); 31 buildUri = buildUri.prev();
32 uris.add(buildUri); 32 uris.add(buildUri);
33 } 33 }
34 return readResults(uris); 34 return readResults(uris);
35 } 35 }
36 36
37 Future<BuildResult> readResult(BuildUri buildUri) { 37 Future<BuildResult> readResult(BuildUri buildUri) {
38 return _client.readResult(buildUri); 38 return _client.readResult(buildUri);
39 } 39 }
40 40
41 /// Reads the build results of all given uris.
42 ///
43 /// Returns a list of the results. If a uri couldn't be read, then the entry
44 /// in the list is `null`.
41 Future<List<BuildResult>> readResults(List<BuildUri> buildUris) async { 45 Future<List<BuildResult>> readResults(List<BuildUri> buildUris) async {
42 var result = <BuildResult>[]; 46 var result = <BuildResult>[];
43 int i = 0; 47 int i = 0;
44 const maxParallel = 20; 48 const maxParallel = 20;
45 while (i < buildUris.length) { 49 while (i < buildUris.length) {
46 var end = i + maxParallel; 50 var end = i + maxParallel;
47 if (end > buildUris.length) end = buildUris.length; 51 if (end > buildUris.length) end = buildUris.length;
48 var parallelChunk = buildUris.sublist(i, end); 52 var parallelChunk = buildUris.sublist(i, end);
49 log("Fetching ${end - i} uris in parallel"); 53 log("Fetching ${end - i} uris in parallel");
50 result.addAll(await Future.wait(parallelChunk.map(_client.readResult))); 54 result.addAll(await Future.wait(parallelChunk.map((uri) {
55 var result = _client.readResult(uri);
56 if (result == null) {
57 log("Error while reading $uri");
58 }
59 return result;
60 })));
51 i = end + 1; 61 i = end + 1;
52 } 62 }
53 return result; 63 return result;
54 } 64 }
55 65
56 /// Returns uris for the most recent build of all build groups. 66 /// Returns uris for the most recent build of all build groups.
57 List<BuildUri> get mostRecentUris { 67 List<BuildUri> get mostRecentUris {
58 List<BuildUri> result = []; 68 List<BuildUri> result = [];
59 for (BuildGroup group in buildGroups) { 69 for (BuildGroup group in buildGroups) {
60 result.addAll(group.createUris(_client.mostRecentBuildNumber)); 70 result.addAll(group.createUris(_client.mostRecentBuildNumber));
61 } 71 }
62 return result; 72 return result;
63 } 73 }
64 74
65 /// Closes the bot. 75 /// Closes the bot.
66 void close() => _client.close(); 76 void close() => _client.close();
67 } 77 }
OLDNEW
« no previous file with comments | « tools/gardening/bin/summary.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698