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

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

Issue 3000493002: Improve output of current-summary gardening tool. (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/current_summary.dart ('k') | tools/gardening/lib/src/buildbot_data.dart » ('j') | 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';
11 11
12 class Bot { 12 class Bot {
13 final bool usesLogdog; 13 final bool usesLogdog;
14 final BuildbotClient _client; 14 final BuildbotClient _client;
15 15
16 /// Instantiates a Bot. 16 /// Instantiates a Bot.
17 /// 17 ///
18 /// Bots must be [close]d when they aren't needed anymore. 18 /// Bots must be [close]d when they aren't needed anymore.
19 Bot({bool logdog = false}) 19 Bot({bool logdog = false})
20 : usesLogdog = logdog, 20 : usesLogdog = logdog,
21 _client = 21 _client =
22 logdog ? new LogdogBuildbotClient() : new HttpBuildbotClient(); 22 logdog ? new LogdogBuildbotClient() : new HttpBuildbotClient();
23 23
24 int get mostRecentBuildNumber => _client.mostRecentBuildNumber;
25
24 /// Reads the build result of [buildUri] and the [previousCount] earlier 26 /// Reads the build result of [buildUri] and the [previousCount] earlier
25 /// builds. 27 /// builds.
26 Future<List<BuildResult>> readHistoricResults(BuildUri buildUri, 28 Future<List<BuildResult>> readHistoricResults(BuildUri buildUri,
27 {int previousCount = 0}) { 29 {int previousCount = 0}) {
28 log("Fetching $buildUri and $previousCount previous builds in parallel"); 30 log("Fetching $buildUri and $previousCount previous builds in parallel");
29 var uris = [buildUri]; 31 var uris = [buildUri];
30 for (int i = 0; i < previousCount; i++) { 32 for (int i = 0; i < previousCount; i++) {
31 buildUri = buildUri.prev(); 33 buildUri = buildUri.prev();
32 uris.add(buildUri); 34 uris.add(buildUri);
33 } 35 }
(...skipping 26 matching lines...) Expand all
60 }))); 62 })));
61 i = end + 1; 63 i = end + 1;
62 } 64 }
63 return result; 65 return result;
64 } 66 }
65 67
66 /// Returns uris for the most recent build of all build groups. 68 /// Returns uris for the most recent build of all build groups.
67 List<BuildUri> get mostRecentUris { 69 List<BuildUri> get mostRecentUris {
68 List<BuildUri> result = []; 70 List<BuildUri> result = [];
69 for (BuildGroup group in buildGroups) { 71 for (BuildGroup group in buildGroups) {
70 result.addAll(group.createUris(_client.mostRecentBuildNumber)); 72 result.addAll(group.createUris(mostRecentBuildNumber));
71 } 73 }
72 return result; 74 return result;
73 } 75 }
74 76
75 /// Closes the bot. 77 /// Closes the bot.
76 void close() => _client.close(); 78 void close() => _client.close();
77 } 79 }
OLDNEW
« no previous file with comments | « tools/gardening/bin/current_summary.dart ('k') | tools/gardening/lib/src/buildbot_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698