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

Side by Side Diff: scripts/slave/telemetry_utils.py

Issue 545803002: Update buildbots to parse new telemetry JSON format. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Switched to having telemetry output json to files. Created 6 years, 3 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
« scripts/slave/runtest.py ('K') | « scripts/slave/telemetry.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #! /usr/bin/env python
2 # Copyright (c) 2014 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 """Log parsing for telemetry tests."""
7
8 import json
9 import logging
10 import os
11 import tempfile
12
13
14 class TelemetryResultsTracker(object):
15
16 def __init__(self):
17 self._chart_filename = None
18 self._ref_chart_filename = None
19
20 def GetArguments(self):
21 if not self._chart_filename:
22 (_, self._chart_filename) = tempfile.mkstemp()
ghost stip (do not use) 2014/09/09 02:20:06 you may need to close the file handle here, I'm no
sullivan 2014/09/11 00:25:56 Done.
23 if not self._ref_chart_filename:
24 (_, self._ref_chart_filename) = tempfile.mkstemp()
25 return (['--chart-output-filename', self._chart_filename,
26 '--ref-output-filename', self._ref_chart_filename])
ghost stip (do not use) 2014/09/09 02:20:06 I'm a bit confused about the ref output filename -
sullivan 2014/09/11 00:25:56 No, only if there is a ref build in telemery._Gene
27
28 def _GetFileJson(self, filename):
29 try:
30 return json.loads(open(filename).read())
31 except (IOError, ValueError):
32 logging.error('Error reading telemetry results from %s', filename)
33 return None
34
35 def ChartJson(self):
36 return self._GetFileJson(self._chart_filename)
37
38 def RefJson(self):
39 return self._GetFileJson(self._ref_chart_filename)
40
41 def Cleanup(self):
ghost stip (do not use) 2014/09/09 02:24:16 I don't think cleanup is called by runtest.py in t
sullivan 2014/09/11 00:25:56 Done.
42 try:
43 os.remove(self._chart_filename)
44 os.remove(self._ref_chart_filename)
ghost stip (do not use) 2014/09/09 02:20:06 if the first one fails, we'll never get to the sec
sullivan 2014/09/11 00:25:56 Done.
45 except OSError:
46 pass
47
48 def IsChartJson(self):
49 """This is the new telemetry --chartjson output format."""
50 return True
51
52 def ProcessLine(self, line):
53 pass
54
55 def FailedTests(self):
56 return []
57
58 def SuppressionHashes(self): # pylint: disable=R0201
59 return []
60
61 def ParsingErrors(self): # pylint: disable=R0201
62 return []
63
64 def PerformanceSummary(self):
65 return 'TODO'
OLDNEW
« scripts/slave/runtest.py ('K') | « scripts/slave/telemetry.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698