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

Unified Diff: tools/gardening/lib/src/luci_services.dart

Issue 3005443002: Additional tools for gardening. (Closed)
Patch Set: Added changes from johnniwinther 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gardening/lib/src/luci_api.dart ('k') | tools/gardening/lib/src/try.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/lib/src/luci_services.dart
diff --git a/tools/gardening/lib/src/luci_services.dart b/tools/gardening/lib/src/luci_services.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bf2adbdf57225d169eb730b2d967279aef0eaf2a
--- /dev/null
+++ b/tools/gardening/lib/src/luci_services.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'try.dart';
+import 'logger.dart';
+import 'cache_new.dart';
+import 'luci_api.dart';
+
+/// Fetches all builds for a given [commit]-hash, by searching the latest
+/// [amount] builds.
+Future<Try<List<BuildDetail>>> fetchBuildsForCommmit(LuciApi api, Logger logger,
+ String client, String commit, CreateCacheFunction createCache,
+ [int amount = 1]) async {
+ logger.debug("Finding primary bots for client $client");
+ var buildBots = await api.getPrimaryBuilders(
+ client, createCache(duration: new Duration(minutes: 30)));
+
+ var cache = createCache(duration: new Duration(minutes: 30));
+ return (await buildBots.bindAsync((List<LuciBuildBot> buildBots) async {
+ var buildBotBuilds = new List<List<BuildDetail>>();
+ for (var buildBot in buildBots) {
+ (await api.getBuildBotDetails(client, buildBot.name, cache, amount)).fold(
+ (ex, st) {
+ logger.error("Problem getting results", ex, st);
+ }, buildBotBuilds.add);
+ }
+ logger.debug("All latest $amount builds found for client $client. "
+ "Processing results...");
+ return buildBotBuilds.expand((id) => id).toList();
+ })).bind((List<BuildDetail> buildDetails) {
+ return buildDetails.where((BuildDetail buildDetail) {
+ return buildDetail.allChanges.any((change) => change.revision == commit);
+ });
+ });
+}
« no previous file with comments | « tools/gardening/lib/src/luci_api.dart ('k') | tools/gardening/lib/src/try.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698