OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 json | 5 import json |
6 | 6 |
7 from dashboard.pinpoint.models.quest import execution | 7 from dashboard.pinpoint.models.quest import execution |
8 from dashboard.pinpoint.models.quest import quest | 8 from dashboard.pinpoint.models.quest import quest |
9 from dashboard.services import isolate_service | 9 from dashboard.services import isolate_service |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 | 29 |
30 class _ReadChartJsonValueExecution(execution.Execution): | 30 class _ReadChartJsonValueExecution(execution.Execution): |
31 | 31 |
32 def __init__(self, metric, test, isolate_hash): | 32 def __init__(self, metric, test, isolate_hash): |
33 super(_ReadChartJsonValueExecution, self).__init__() | 33 super(_ReadChartJsonValueExecution, self).__init__() |
34 self._metric = metric | 34 self._metric = metric |
35 self._test = test or 'summary' | 35 self._test = test or 'summary' |
36 self._isolate_hash = isolate_hash | 36 self._isolate_hash = isolate_hash |
37 | 37 |
| 38 def _AsDict(self): |
| 39 return { |
| 40 'isolate_hash': self._isolate_hash |
| 41 } |
| 42 |
38 def _Poll(self): | 43 def _Poll(self): |
39 test_output = isolate_service.Retrieve(self._isolate_hash) | 44 test_output = isolate_service.Retrieve(self._isolate_hash) |
40 chartjson_isolate_hash = test_output['files']['chartjson-output.json']['h'] | 45 chartjson_isolate_hash = test_output['files']['chartjson-output.json']['h'] |
41 chartjson = json.loads(isolate_service.Retrieve(chartjson_isolate_hash)) | 46 chartjson = json.loads(isolate_service.Retrieve(chartjson_isolate_hash)) |
42 chart = chartjson['charts'][self._metric][self._test] | 47 chart = chartjson['charts'][self._metric][self._test] |
43 if chart['type'] == 'list_of_scalar_values': | 48 if chart['type'] == 'list_of_scalar_values': |
44 result_values = tuple(chart['values']) | 49 result_values = tuple(chart['values']) |
45 elif chart['type'] == 'histogram': | 50 elif chart['type'] == 'histogram': |
46 result_values = _ResultValuesFromHistogram(chart['buckets']) | 51 result_values = _ResultValuesFromHistogram(chart['buckets']) |
47 elif chart['type'] == 'scalar': | 52 elif chart['type'] == 'scalar': |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 89 |
85 | 90 |
86 class _ReadGraphJsonValueExecution(execution.Execution): | 91 class _ReadGraphJsonValueExecution(execution.Execution): |
87 | 92 |
88 def __init__(self, chart, trace, isolate_hash): | 93 def __init__(self, chart, trace, isolate_hash): |
89 super(_ReadGraphJsonValueExecution, self).__init__() | 94 super(_ReadGraphJsonValueExecution, self).__init__() |
90 self._chart = chart | 95 self._chart = chart |
91 self._trace = trace | 96 self._trace = trace |
92 self._isolate_hash = isolate_hash | 97 self._isolate_hash = isolate_hash |
93 | 98 |
| 99 def _AsDict(self): |
| 100 return { |
| 101 'isolate_hash': self._isolate_hash |
| 102 } |
| 103 |
94 def _Poll(self): | 104 def _Poll(self): |
95 test_output = isolate_service.Retrieve(self._isolate_hash) | 105 test_output = isolate_service.Retrieve(self._isolate_hash) |
96 graphjson_isolate_hash = test_output['files']['chartjson-output.json']['h'] | 106 graphjson_isolate_hash = test_output['files']['chartjson-output.json']['h'] |
97 graphjson = json.loads(isolate_service.Retrieve(graphjson_isolate_hash)) | 107 graphjson = json.loads(isolate_service.Retrieve(graphjson_isolate_hash)) |
98 result_values = (float(graphjson[self._chart]['traces'][self._trace][0]),) | 108 result_values = (float(graphjson[self._chart]['traces'][self._trace][0]),) |
99 self._Complete(result_values=result_values) | 109 self._Complete(result_values=result_values) |
OLD | NEW |