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

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

Issue 3001043002: [pinpoint] Add ReadGraphJsonValue. (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
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 8599cf48d14d2ce94e2ba30193375b091729faec..e61bfc56fd955877d4b7349369c87c4370fd11f5 100644
--- a/dashboard/dashboard/pinpoint/models/quest/read_value.py
+++ b/dashboard/dashboard/pinpoint/models/quest/read_value.py
@@ -63,3 +63,37 @@ def _ResultValuesFromHistogram(buckets):
result_values += [bucket_mean] * bucket_count
return tuple(result_values)
+
+
+class ReadGraphJsonValue(quest.Quest):
+
+ def __init__(self, chart, trace):
+ self._chart = chart
+ self._trace = trace
+
+ def __eq__(self, other):
+ return (isinstance(other, type(self)) and
+ self._chart == other._chart and
+ self._trace == other._trace)
+
+ def __str__(self):
+ return 'Value'
+
+ def Start(self, isolate_hash):
+ return _ReadGraphJsonValueExecution(self._chart, self._trace, isolate_hash)
+
+
+class _ReadGraphJsonValueExecution(execution.Execution):
+
+ def __init__(self, chart, trace, isolate_hash):
+ super(_ReadGraphJsonValueExecution, self).__init__()
+ self._chart = chart
+ self._trace = trace
+ self._isolate_hash = isolate_hash
+
+ 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)

Powered by Google App Engine
This is Rietveld 408576698