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

Unified Diff: infra/tools/builder_alerts/__main__.py

Issue 508873005: Reimplemented tree_for_master, which now uses gatekeeper config files to map master URLs to the tre… (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 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
Index: infra/tools/builder_alerts/__main__.py
diff --git a/infra/tools/builder_alerts/__main__.py b/infra/tools/builder_alerts/__main__.py
index 79d9fb3d217288c06448103c2448f0cd4da7c1d1..ae89ba31f8fe4972baf345ea68d8f0f7f9d22ac2 100755
--- a/infra/tools/builder_alerts/__main__.py
+++ b/infra/tools/builder_alerts/__main__.py
@@ -32,11 +32,10 @@ from slave import gatekeeper_ng_config
CACHE_PATH = 'build_cache'
-def apply_gatekeeper_rules(alerts, gatekeeper):
+def apply_gatekeeper_rules(alerts, gatekeeper, gatekeeper_trees):
filtered_alerts = []
for alert in alerts:
master_url = alert['master_url']
- master_name = buildbot.master_name_from_url(master_url)
config = gatekeeper.get(master_url)
if not config:
# Unclear if this should be set or not?
@@ -46,11 +45,11 @@ def apply_gatekeeper_rules(alerts, gatekeeper):
excluded_builders = gatekeeper_extras.excluded_builders(config)
if alert['builder_name'] in excluded_builders:
continue
- alert['would_close_tree'] = \
- gatekeeper_extras.would_close_tree(config,
- alert['builder_name'], alert['step_name'])
+ alert['would_close_tree'] = gatekeeper_extras.would_close_tree(
+ config, alert['builder_name'], alert['step_name'])
+ tree_name = gatekeeper_extras.tree_for_master(master_url, gatekeeper_trees)
+ alert['tree_name'] = tree_name or buildbot.master_name_from_url(master_url)
ojan 2014/08/28 03:34:15 Nit: can we just call this tree instead of tree_na
Sergiy Byelozyorov 2014/08/28 17:45:58 Done.
filtered_alerts.append(alert)
- alert['tree_name'] = gatekeeper_extras.tree_for_master(master_name)
return filtered_alerts
@@ -87,6 +86,13 @@ def main(args):
gatekeeper_path = os.path.abspath(args.gatekeeper)
print "Processsing gatekeeper json: %s" % (gatekeeper_path)
gatekeeper = gatekeeper_ng_config.load_gatekeeper_config(gatekeeper_path)
+
+ gatekeeper_trees_path = os.path.join(os.path.dirname(gatekeeper_path),
+ 'gatekeeper_trees.json')
+ print 'Processing gatekeeper trees json: %s' % (gatekeeper_trees_path)
ojan 2014/08/28 03:34:15 These two prints seem unneccessary to me. Lets eit
Sergiy Byelozyorov 2014/08/28 17:45:58 Done.
+ gatekeeper_trees = gatekeeper_ng_config.load_gatekeeper_tree_config(
+ gatekeeper_trees_path)
+
master_urls = fetch_master_urls(gatekeeper, args)
start_time = datetime.datetime.now()
@@ -111,7 +117,7 @@ def main(args):
print "Fetch took: %s" % (datetime.datetime.now() - start_time)
- alerts = apply_gatekeeper_rules(alerts, gatekeeper)
+ alerts = apply_gatekeeper_rules(alerts, gatekeeper, gatekeeper_trees)
alerts = analysis.assign_keys(alerts)
reason_groups = analysis.group_by_reason(alerts)
« no previous file with comments | « no previous file | infra/tools/builder_alerts/gatekeeper_extras.py » ('j') | infra/tools/builder_alerts/gatekeeper_extras.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698