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

Unified Diff: scripts/slave/results_dashboard.py

Issue 12317053: Sends test results to new perf dashboard (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Moves the code to call results_dashboard.SendResults() to its own function and cleans up some small… Created 7 years, 10 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 | « no previous file | scripts/slave/runtest.py » ('j') | scripts/slave/runtest.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/results_dashboard.py
diff --git a/scripts/slave/results_dashboard.py b/scripts/slave/results_dashboard.py
new file mode 100644
index 0000000000000000000000000000000000000000..504cd098c7cb79b07aa60b2e00b31fd72a92ab52
--- /dev/null
+++ b/scripts/slave/results_dashboard.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Functions for adding results to perf dashboard."""
+
+import httplib
+import json
+import sys
+import urllib
+import urllib2
+
+SEND_RESULTS_PATH = "/add_point"
+RESULTS_LINK_PATH = "/report?masters=%s&bots=%s&tests=%s&rev=%s"
+
+
+# TODO(sullivan): cache results to a file in case of http errors.
+def SendResults(logname, lines, master, system, test, url):
+ results_to_add = []
+ bot = system
+ if not logname.endswith("-summary.dat"):
+ return
+ graph = logname.replace("-summary.dat", "")
+ for line in lines:
+ data = json.loads(line)
+ revision = data["rev"]
+ for (trace, values) in data["traces"].iteritems():
+ # TODO(sullivan): Handle special trace names:
+ # Reference builds
+ # by_url builds
+ test_path = "%s/%s/%s" % (test, graph, trace)
+ if graph == trace:
+ test_path = "%s/%s" % (test, graph)
+ result = {
+ "master": master,
+ "bot": system,
+ "test": test_path,
+ "revision": revision,
+ "value": values[0],
+ "error": values[1],
+ }
+ if "webkit_rev" in data and data["webkit_rev"] != "undefined":
+ result["supplemental_columns"] = {"r_webkit_rev": data["webkit_rev"]}
+ results_to_add.append(result)
+ data = urllib.urlencode({"data": json.dumps(results_to_add)})
+ req = urllib2.Request(url + SEND_RESULTS_PATH, data)
+ # TODO(sullivan): properly handle exceptions.
+ try:
+ urllib2.urlopen(req)
+ except urllib2.HTTPError, e:
+ sys.stderr.write("HTTPError: %d\n" % e.code)
+ except urllib2.URLError, e:
+ sys.stderr.write("URLError: %s\n" % str(e.reason))
+ except httplib.HTTPException, e:
+ sys.stderr.write("HTTPException\n")
+
+ results_link = url + RESULTS_LINK_PATH % (
+ urllib.quote(master),
+ urllib.quote(bot),
+ urllib.quote(test + "/" + graph),
+ revision)
+ print "@@@STEP_LINK@%s@%s@@@" % ("Results Dashboard", results_link)
« no previous file with comments | « no previous file | scripts/slave/runtest.py » ('j') | scripts/slave/runtest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698