Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Functions for adding results to perf dashboard.""" | |
| 7 | |
| 8 import httplib | |
| 9 import json | |
| 10 import sys | |
| 11 import urllib | |
| 12 import urllib2 | |
| 13 | |
| 14 SEND_RESULTS_PATH = "/add_point" | |
| 15 RESULTS_LINK_PATH = "/report?masters=%s&bots=%s&tests=%s&rev=%s" | |
| 16 | |
| 17 | |
| 18 # TODO(sullivan): cache results to a file in case of http errors. | |
| 19 def SendResults(logname, lines, system, test, url): | |
| 20 results_to_add = [] | |
| 21 # TODO(sullivan): Where to get the master (e.g. "ChromiumPerf") from? | |
|
Mike Stip (use stip instead)
2013/02/21 23:12:49
I would pass this from the master to runtest.py as
| |
| 22 master = "master" | |
| 23 bot = system | |
| 24 if not logname.endswith("-summary.dat"): | |
| 25 return | |
| 26 graph = logname.replace("-summary.dat", "") | |
| 27 for line in lines: | |
| 28 data = json.loads(line) | |
| 29 # TODO(sullivan): This is the git rev. We want svn rev, for proper ordering. | |
| 30 revision = data["rev"] | |
| 31 for (trace, values) in data["traces"].iteritems(): | |
| 32 # TODO(sullivan): Handle special trace names: | |
| 33 # Reference builds | |
| 34 # graph == trace (main graph) | |
| 35 # by_url builds | |
| 36 result = { | |
| 37 "master": master, | |
| 38 "bot": system, | |
| 39 "test": "%s/%s/%s" % (test, graph, trace), | |
| 40 "revision": revision, | |
| 41 "value": values[0], | |
| 42 "error": values[1], | |
| 43 } | |
| 44 # TODO(sullivan): webkit_rev is set to "undefined" here even when it is | |
| 45 # available in the stdio. | |
| 46 if "webkit_rev" in data and data["webkit_rev"] != "undefined": | |
| 47 result["supplemental_columns"] = {"r_webkit_rev": data["webkit_rev"]} | |
| 48 results_to_add.append(result) | |
| 49 data = urllib.urlencode({"data": json.dumps(results_to_add)}) | |
| 50 req = urllib2.Request(url + SEND_RESULTS_PATH, data) | |
| 51 # TODO(sullivan): properly handle exceptions. | |
| 52 try: | |
| 53 urllib2.urlopen(req) | |
| 54 except urllib2.HTTPError, e: | |
| 55 sys.stderr.write("HTTPError: %d\n" % e.code) | |
| 56 except urllib2.URLError, e: | |
| 57 sys.stderr.write("URLError: %s\n", str(e.reason)) | |
| 58 except httplib.HTTPException, e: | |
| 59 sys.stderr.write("HTTPException\n") | |
| 60 | |
| 61 results_link = url + RESULTS_LINK_PATH % ( | |
| 62 urllib.quote(master), | |
| 63 urllib.quote(bot), | |
| 64 urllib.quote(test + "/" + graph), | |
| 65 revision) | |
| 66 print "@@@STEP_LINK@%s@%s@@@" % ("Results Dashboard", results_link) | |
| OLD | NEW |