| 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)
|
|
|