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

Side by Side Diff: mojo/devtools/common/devtoolslib/perf_dashboard.py

Issue 1420503007: Improve the command line interface for perf dashboard upload. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/tools/get_test_list.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Disable the line-too-long warning. 5 # Disable the line-too-long warning.
6 # pylint: disable=C0301 6 # pylint: disable=C0301
7 """This module implements the Chromium Performance Dashboard JSON v1.0 data 7 """This module implements the Chromium Performance Dashboard JSON v1.0 data
8 format. 8 format.
9 9
10 See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending -data-to-the-performance-dashboard. 10 See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending -data-to-the-performance-dashboard.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 def add_argparse_server_arguments(parser): 53 def add_argparse_server_arguments(parser):
54 """Adds argparse arguments needed to upload the chart data to a performance 54 """Adds argparse arguments needed to upload the chart data to a performance
55 dashboard to the given parser. 55 dashboard to the given parser.
56 """ 56 """
57 dashboard_group = parser.add_argument_group('Performance dashboard server', 57 dashboard_group = parser.add_argument_group('Performance dashboard server',
58 'These arguments allow to specify the performance dashboard server ' 58 'These arguments allow to specify the performance dashboard server '
59 'to upload the results to.') 59 'to upload the results to.')
60 60
61 dashboard_group.add_argument( 61 dashboard_group.add_argument(
62 '--upload', action='store_true',
63 help='Upload the results to performance dashboard. Further arguments '
64 'in this group are relevant only if --upload is passed.')
65 dashboard_group.add_argument(
62 '--server-url', 66 '--server-url',
63 help='Url of the server instance to upload the results to. By default a ' 67 help='Url of the server instance to upload the results to. By default a '
64 'local instance is assumed to be running on port 8080.') 68 'local instance is assumed to be running on port 8080.')
65 dashboard_group.add_argument( 69 dashboard_group.add_argument(
66 '--master-name', 70 '--master-name',
67 help='Buildbot master name, used to construct link to buildbot log by ' 71 help='Buildbot master name, used to construct link to buildbot log by '
68 'the dashboard, and also as the top-level category for the data.') 72 'the dashboard, and also as the top-level category for the data.')
69 dashboard_group.add_argument( 73 dashboard_group.add_argument(
70 '--perf-id', 74 '--bot-name',
71 help='Used as the second-level category for the data, usually the ' 75 help='Used as the second-level category for the data.')
72 'platform type.')
73 dashboard_group.add_argument( 76 dashboard_group.add_argument(
74 '--test-name', 77 '--test-name',
75 help='Name of the test that the perf data was generated from.') 78 help='Name of the test that the perf data was generated from.')
76 dashboard_group.add_argument( 79 dashboard_group.add_argument(
77 '--builder-name', 80 '--builder-name',
78 help='Buildbot builder name, used to construct link to buildbot log by ' 81 help='Buildbot builder name, used to construct link to buildbot log by '
79 'the dashboard.') 82 'the dashboard.')
80 dashboard_group.add_argument( 83 dashboard_group.add_argument(
81 '--build-number', type=int, 84 '--build-number', type=int,
82 help='Build number, used to construct link to buildbot log by the ' 85 help='Build number, used to construct link to buildbot log by the '
83 'dashboard.') 86 'dashboard.')
84 dashboard_group.add_argument( 87 dashboard_group.add_argument(
85 '--dry-run', action='store_true', default=False, 88 '--dry-run', action='store_true', default=False,
86 help='Display the server URL and the data to upload, but do not actually ' 89 help='Display the server URL and the data to upload, but do not actually '
87 'upload the data.') 90 'upload the data.')
88 91
89 92
90 def upload_chart_data(master_name, perf_id, test_name, builder_name, 93 def upload_chart_data(master_name, bot_name, test_name, builder_name,
91 build_number, revision, chart_data, point_id, 94 build_number, revision, chart_data, point_id,
92 server_url=None, dry_run=False): 95 server_url=None, dry_run=False):
93 """Uploads the provided chart data to an instance of performance dashboard. 96 """Uploads the provided chart data to an instance of performance dashboard.
94 See the argparse help above for description of the arguments. 97 See the argparse help above for description of the arguments.
95 98
96 99
97 Returns: 100 Returns:
98 A boolean value indicating whether the operation succeeded or not. 101 A boolean value indicating whether the operation succeeded or not.
99 """ 102 """
100 class _UploadException(Exception): 103 class _UploadException(Exception):
(...skipping 20 matching lines...) Expand all
121 "JSON: %s\n" % (e.code, e.read(), json_data)) 124 "JSON: %s\n" % (e.code, e.read(), json_data))
122 except urllib2.URLError as e: 125 except urllib2.URLError as e:
123 raise _UploadException("URLError: %s for JSON %s\n" % 126 raise _UploadException("URLError: %s for JSON %s\n" %
124 (str(e.reason), json_data)) 127 (str(e.reason), json_data))
125 except httplib.HTTPException as e: 128 except httplib.HTTPException as e:
126 raise _UploadException("HTTPException for JSON %s\n" % json_data) 129 raise _UploadException("HTTPException for JSON %s\n" % json_data)
127 130
128 # Wrap the |chart_data| with meta data as required by the spec. 131 # Wrap the |chart_data| with meta data as required by the spec.
129 formatted_data = { 132 formatted_data = {
130 "master": master_name, 133 "master": master_name,
131 "bot": perf_id, 134 "bot": bot_name,
132 "masterid": master_name, 135 "masterid": master_name,
133 "buildername": builder_name, 136 "buildername": builder_name,
134 "buildnumber": build_number, 137 "buildnumber": build_number,
135 "versions": { 138 "versions": {
136 "mojo": revision 139 "mojo": revision
137 }, 140 },
138 "point_id": point_id, 141 "point_id": point_id,
139 "supplemental": {}, 142 "supplemental": {},
140 "chart_data": chart_data 143 "chart_data": chart_data
141 } 144 }
(...skipping 10 matching lines...) Expand all
152 try: 155 try:
153 _upload(upload_url, json.dumps(formatted_data)) 156 _upload(upload_url, json.dumps(formatted_data))
154 except _UploadException as e: 157 except _UploadException as e:
155 print e 158 print e
156 return False 159 return False
157 160
158 print "Done." 161 print "Done."
159 162
160 dashboard_params = urllib.urlencode({ 163 dashboard_params = urllib.urlencode({
161 "masters": master_name, 164 "masters": master_name,
162 "bots": perf_id, 165 "bots": bot_name,
163 "tests": test_name, 166 "tests": test_name,
164 "rev": point_id 167 "rev": point_id
165 }) 168 })
166 print "Results Dashboard: %s/report?%s" % (upload_url, dashboard_params) 169 print "Results Dashboard: %s/report?%s" % (upload_url, dashboard_params)
167 170
168 return True 171 return True
OLDNEW
« no previous file with comments | « no previous file | mojo/tools/get_test_list.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698