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

Unified Diff: frontend/tko/rpc_interface.py

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frontend/client/src/autotest/common/ui/SimplifiedList.java ('k') | frontend/tko/rpc_interface_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frontend/tko/rpc_interface.py
diff --git a/frontend/tko/rpc_interface.py b/frontend/tko/rpc_interface.py
index 491aa52161518c5db2ed886435f7dced49b52b99..f695675f12b57e84dcac0bac07705ef92ff6aaca 100644
--- a/frontend/tko/rpc_interface.py
+++ b/frontend/tko/rpc_interface.py
@@ -173,8 +173,13 @@ def _format_iteration_keyvals(test):
for index in xrange(1, max_iterations + 1)]
+def _job_keyvals_to_dict(keyvals):
+ return dict((keyval.key, keyval.value) for keyval in keyvals)
+
+
def get_detailed_test_views(**filter_data):
test_views = models.TestView.list_objects(filter_data)
+
tests_by_id = models.Test.objects.in_bulk([test_view['test_idx']
for test_view in test_views])
tests = tests_by_id.values()
@@ -186,11 +191,22 @@ def get_detailed_test_views(**filter_data):
'iteration_results')
models.Test.objects.populate_relationships(tests, models.TestLabel,
'labels')
+
+ jobs_by_id = models.Job.objects.in_bulk([test_view['job_idx']
+ for test_view in test_views])
+ jobs = jobs_by_id.values()
+ models.Job.objects.populate_relationships(jobs, models.JobKeyval,
+ 'keyvals')
+
for test_view in test_views:
test = tests_by_id[test_view['test_idx']]
test_view['attributes'] = _attributes_to_dict(test.attributes)
test_view['iterations'] = _format_iteration_keyvals(test)
test_view['labels'] = [label.name for label in test.labels]
+
+ job = jobs_by_id[test_view['job_idx']]
+ test_view['job_keyvals'] = _job_keyvals_to_dict(job.keyvals)
+
return rpc_utils.prepare_for_serialization(test_views)
# graphing view support
« no previous file with comments | « frontend/client/src/autotest/common/ui/SimplifiedList.java ('k') | frontend/tko/rpc_interface_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698