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

Side by Side Diff: scripts/slave/recipe_modules/perf_dashboard/api.py

Issue 1782723002: Use buildername rather than slavename for "bot" with perf dashboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Allow recipe to specify bot name in skeleton point. Created 4 years, 9 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 | scripts/slave/recipe_modules/perf_dashboard/example.expected/linux.json » ('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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import urllib 5 import urllib
6 6
7 from recipe_engine import recipe_api 7 from recipe_engine import recipe_api
8 8
9 9
10 class PerfDashboardApi(recipe_api.RecipeApi): 10 class PerfDashboardApi(recipe_api.RecipeApi):
11 """Provides steps to take a list of perf points and post them to the 11 """Provides steps to take a list of perf points and post them to the
12 Chromium Perf Dashboard. Can also use the test url for testing purposes.""" 12 Chromium Perf Dashboard. Can also use the test url for testing purposes."""
13 13
14 def get_skeleton_point(self, test, revision, value): 14 def get_skeleton_point(self, test, revision, value, bot=None):
15 # TODO: masterid is really mastername 15 # TODO: masterid is really mastername
16 assert (test != '') 16 assert (test != '')
17 assert (revision != '') 17 assert (revision != '')
18 assert (value != '') 18 assert (value != '')
19 return { 19 return {
20 'master': self.m.properties['mastername'], 20 'master': self.m.properties['mastername'],
21 'bot': self.m.properties['slavename'], 21 'bot': bot or self.m.properties['buildername'],
22 'test': test, 22 'test': test,
23 'revision': revision, 23 'revision': revision,
24 'value': value, 24 'value': value,
25 'masterid': self.m.properties['mastername'], 25 'masterid': self.m.properties['mastername'],
26 'buildername': self.m.properties['buildername'], 26 'buildername': self.m.properties['buildername'],
27 'buildnumber': self.m.properties['buildnumber'] 27 'buildnumber': self.m.properties['buildnumber']
28 } 28 }
29 29
30 def add_dashboard_link(self, presentation, test, revision, bot=None): 30 def add_dashboard_link(self, presentation, test, revision, bot=None):
31 """Adds a results-dashboard link to the step presentation. 31 """Adds a results-dashboard link to the step presentation.
32 32
33 Must be called from a follow-up function of the step, to which the link 33 Must be called from a follow-up function of the step, to which the link
34 should be added. For a working link, the parameters test, revision and bot 34 should be added. For a working link, the parameters test, revision and bot
35 must match to the parameters used to upload points to the dashboard. 35 must match to the parameters used to upload points to the dashboard.
36 36
37 Args: 37 Args:
38 presentation: A step presentation object. Can be obtained by 38 presentation: A step presentation object. Can be obtained by
39 step_result.presentation from a followup_fn of a step. 39 step_result.presentation from a followup_fn of a step.
40 test: Slash-separated test path. 40 test: Slash-separated test path.
41 revision: The build revision, e.g. got_revision from the update step. 41 revision: The build revision, e.g. got_revision from the update step.
42 bot: The slave name. 42 bot: The bot name used for the data on the perf dashboard.
43 """ 43 """
44 assert presentation 44 assert presentation
45 assert test 45 assert test
46 assert revision 46 assert revision
47 params = urllib.urlencode({ 47 params = urllib.urlencode({
48 'masters': self.m.properties['mastername'], 48 'masters': self.m.properties['mastername'],
49 'bots': bot or self.m.properties['slavename'], 49 'bots': bot or self.m.properties['buildername'],
50 'tests': test, 50 'tests': test,
51 'rev': revision, 51 'rev': revision,
52 }) 52 })
53 presentation.links['Results Dashboard'] = ('%s/report?%s' % 53 presentation.links['Results Dashboard'] = ('%s/report?%s' %
54 (self.c.url, params)) 54 (self.c.url, params))
55 55
56 def set_default_config(self): 56 def set_default_config(self):
57 """If in golo, use real perf server, otherwise use testing perf server.""" 57 """If in golo, use real perf server, otherwise use testing perf server."""
58 if self.m.properties.get('use_mirror', True): # We're on a bot 58 if self.m.properties.get('use_mirror', True): # We're on a bot
59 self.set_config('production') 59 self.set_config('production')
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 self.warning(response, reason) 91 self.warning(response, reason)
92 92
93 def halt(self, step_result, reason): # pragma: no cover 93 def halt(self, step_result, reason): # pragma: no cover
94 step_result.presentation.step_text = reason 94 step_result.presentation.step_text = reason
95 step_result.presentation.status = self.m.step.FAILURE 95 step_result.presentation.status = self.m.step.FAILURE
96 raise self.m.step.StepFailure(reason) 96 raise self.m.step.StepFailure(reason)
97 97
98 def warning(self, step_result, reason): # pragma: no cover 98 def warning(self, step_result, reason): # pragma: no cover
99 step_result.presentation.step_text = reason 99 step_result.presentation.step_text = reason
100 step_result.presentation.status = self.m.step.WARNING 100 step_result.presentation.status = self.m.step.WARNING
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/perf_dashboard/example.expected/linux.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698