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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 | 30 |
31 class _ReadChartJsonValueExecution(execution.Execution): | 31 class _ReadChartJsonValueExecution(execution.Execution): |
32 | 32 |
33 def __init__(self, metric, test, isolate_hashes): | 33 def __init__(self, metric, test, isolate_hashes): |
34 super(_ReadChartJsonValueExecution, self).__init__() | 34 super(_ReadChartJsonValueExecution, self).__init__() |
35 self._metric = metric | 35 self._metric = metric |
36 self._test = test or 'summary' | 36 self._test = test or 'summary' |
37 self._isolate_hashes = isolate_hashes | 37 self._isolate_hashes = isolate_hashes |
38 | 38 |
| 39 def _AsDict(self): |
| 40 return { |
| 41 'isolate_hash': self._isolate_hash |
| 42 } |
| 43 |
39 def _Poll(self): | 44 def _Poll(self): |
40 result_values = [] | 45 result_values = [] |
41 | 46 |
42 for isolate_hash in self._isolate_hashes: | 47 for isolate_hash in self._isolate_hashes: |
43 output = isolate_service.Retrieve(isolate_hash) | 48 output = isolate_service.Retrieve(isolate_hash) |
44 chartjson_isolate_hash = output['files']['chartjson-output.json']['h'] | 49 chartjson_isolate_hash = output['files']['chartjson-output.json']['h'] |
45 chartjson = json.loads(isolate_service.Retrieve(chartjson_isolate_hash)) | 50 chartjson = json.loads(isolate_service.Retrieve(chartjson_isolate_hash)) |
46 chart = chartjson['charts'][self._metric][self._test] | 51 chart = chartjson['charts'][self._metric][self._test] |
47 if chart['type'] == 'list_of_scalar_values': | 52 if chart['type'] == 'list_of_scalar_values': |
48 result_values += chart['values'] | 53 result_values += chart['values'] |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 95 |
91 | 96 |
92 class _ReadGraphJsonValueExecution(execution.Execution): | 97 class _ReadGraphJsonValueExecution(execution.Execution): |
93 | 98 |
94 def __init__(self, chart, trace, isolate_hashes): | 99 def __init__(self, chart, trace, isolate_hashes): |
95 super(_ReadGraphJsonValueExecution, self).__init__() | 100 super(_ReadGraphJsonValueExecution, self).__init__() |
96 self._chart = chart | 101 self._chart = chart |
97 self._trace = trace | 102 self._trace = trace |
98 self._isolate_hashes = isolate_hashes | 103 self._isolate_hashes = isolate_hashes |
99 | 104 |
| 105 def _AsDict(self): |
| 106 return { |
| 107 'isolate_hash': self._isolate_hash |
| 108 } |
| 109 |
100 def _Poll(self): | 110 def _Poll(self): |
101 result_values = [] | 111 result_values = [] |
102 | 112 |
103 for isolate_hash in self._isolate_hashes: | 113 for isolate_hash in self._isolate_hashes: |
104 output = isolate_service.Retrieve(isolate_hash) | 114 output = isolate_service.Retrieve(isolate_hash) |
105 graphjson_isolate_hash = output['files']['chartjson-output.json']['h'] | 115 graphjson_isolate_hash = output['files']['chartjson-output.json']['h'] |
106 graphjson = json.loads(isolate_service.Retrieve(graphjson_isolate_hash)) | 116 graphjson = json.loads(isolate_service.Retrieve(graphjson_isolate_hash)) |
107 result_value = float(graphjson[self._chart]['traces'][self._trace][0]) | 117 result_value = float(graphjson[self._chart]['traces'][self._trace][0]) |
108 result_values.append(result_value) | 118 result_values.append(result_value) |
109 | 119 |
110 self._Complete(result_values=tuple(result_values)) | 120 self._Complete(result_values=tuple(result_values)) |
OLD | NEW |