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

Unified Diff: dashboard/dashboard/pinpoint/models/quest/read_value.py

Issue 3000303002: [pinpoint] Support multiple Swarming tasks. (Closed)
Patch Set: Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/models/quest/read_value_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/pinpoint/models/quest/read_value.py
diff --git a/dashboard/dashboard/pinpoint/models/quest/read_value.py b/dashboard/dashboard/pinpoint/models/quest/read_value.py
index e61bfc56fd955877d4b7349369c87c4370fd11f5..b06eeef598bac341e9048edbd2d6c8ef20ce962d 100644
--- a/dashboard/dashboard/pinpoint/models/quest/read_value.py
+++ b/dashboard/dashboard/pinpoint/models/quest/read_value.py
@@ -23,30 +23,35 @@ class ReadChartJsonValue(quest.Quest):
def __str__(self):
return 'Value of ' + self._metric
- def Start(self, isolate_hash):
- return _ReadChartJsonValueExecution(self._metric, self._test, isolate_hash)
+ def Start(self, isolate_hashes):
+ return _ReadChartJsonValueExecution(self._metric, self._test,
+ isolate_hashes)
class _ReadChartJsonValueExecution(execution.Execution):
- def __init__(self, metric, test, isolate_hash):
+ def __init__(self, metric, test, isolate_hashes):
super(_ReadChartJsonValueExecution, self).__init__()
self._metric = metric
self._test = test or 'summary'
- self._isolate_hash = isolate_hash
+ self._isolate_hashes = isolate_hashes
def _Poll(self):
- test_output = isolate_service.Retrieve(self._isolate_hash)
- chartjson_isolate_hash = test_output['files']['chartjson-output.json']['h']
- chartjson = json.loads(isolate_service.Retrieve(chartjson_isolate_hash))
- chart = chartjson['charts'][self._metric][self._test]
- if chart['type'] == 'list_of_scalar_values':
- result_values = tuple(chart['values'])
- elif chart['type'] == 'histogram':
- result_values = _ResultValuesFromHistogram(chart['buckets'])
- elif chart['type'] == 'scalar':
- result_values = (chart['value'],)
- self._Complete(result_values=result_values)
+ result_values = []
+
+ for isolate_hash in self._isolate_hashes:
+ output = isolate_service.Retrieve(isolate_hash)
+ chartjson_isolate_hash = output['files']['chartjson-output.json']['h']
+ chartjson = json.loads(isolate_service.Retrieve(chartjson_isolate_hash))
+ chart = chartjson['charts'][self._metric][self._test]
+ if chart['type'] == 'list_of_scalar_values':
+ result_values += chart['values']
+ elif chart['type'] == 'histogram':
+ result_values += _ResultValuesFromHistogram(chart['buckets'])
+ elif chart['type'] == 'scalar':
+ result_values.append(chart['value'])
+
+ self._Complete(result_values=tuple(result_values))
def _ResultValuesFromHistogram(buckets):
@@ -79,21 +84,27 @@ class ReadGraphJsonValue(quest.Quest):
def __str__(self):
return 'Value'
- def Start(self, isolate_hash):
- return _ReadGraphJsonValueExecution(self._chart, self._trace, isolate_hash)
+ def Start(self, isolate_hashes):
+ return _ReadGraphJsonValueExecution(self._chart, self._trace,
+ isolate_hashes)
class _ReadGraphJsonValueExecution(execution.Execution):
- def __init__(self, chart, trace, isolate_hash):
+ def __init__(self, chart, trace, isolate_hashes):
super(_ReadGraphJsonValueExecution, self).__init__()
self._chart = chart
self._trace = trace
- self._isolate_hash = isolate_hash
+ self._isolate_hashes = isolate_hashes
def _Poll(self):
- test_output = isolate_service.Retrieve(self._isolate_hash)
- graphjson_isolate_hash = test_output['files']['chartjson-output.json']['h']
- graphjson = json.loads(isolate_service.Retrieve(graphjson_isolate_hash))
- result_values = (float(graphjson[self._chart]['traces'][self._trace][0]),)
- self._Complete(result_values=result_values)
+ result_values = []
+
+ for isolate_hash in self._isolate_hashes:
+ output = isolate_service.Retrieve(isolate_hash)
+ graphjson_isolate_hash = output['files']['chartjson-output.json']['h']
+ graphjson = json.loads(isolate_service.Retrieve(graphjson_isolate_hash))
+ result_value = float(graphjson[self._chart]['traces'][self._trace][0])
+ result_values.append(result_value)
+
+ self._Complete(result_values=tuple(result_values))
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/models/quest/read_value_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698