[autotest] AFE child jobs table on parent job.
Add a table to list all the child jobs of a parent job on Job View tab.
One can click on and navigate between child and parent.
BUG=chromium:379959
DEPLOY=afe,apache
TEST=ran afe, viewed a job, navigated between parent and child jobs
Change-Id: Id70c41c8f7cee40bd71a206e1f3e08a68efe054f
Reviewed-on: https://chromium-review.googlesource.com/202579
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Jiaxi Luo <jiaxiluo@chromium.org>
Tested-by: Jiaxi Luo <jiaxiluo@chromium.org>
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 7a376aa..bd68425 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -37,6 +37,7 @@
from autotest_lib.frontend.afe import models, model_logic, model_attributes
from autotest_lib.frontend.afe import control_file, rpc_utils
from autotest_lib.frontend.afe import site_rpc_interface
+from autotest_lib.frontend.tko import rpc_interface as tko_rpc_interface
from autotest_lib.server.cros.dynamic_suite import tools
def get_parameterized_autoupdate_image_url(job):
@@ -711,15 +712,23 @@
def get_jobs_summary(**filter_data):
"""\
- Like get_jobs(), but adds a 'status_counts' field, which is a dictionary
- mapping status strings to the number of hosts currently with that
- status, i.e. {'Queued' : 4, 'Running' : 2}.
+ Like get_jobs(), but adds 'status_counts' and 'result_counts' field.
+
+ 'status_counts' filed is a dictionary mapping status strings to the number
+ of hosts currently with that status, i.e. {'Queued' : 4, 'Running' : 2}.
+
+ 'result_counts' field is piped to tko's rpc_interface and has the return
+ format specified under get_group_counts.
"""
jobs = get_jobs(**filter_data)
ids = [job['id'] for job in jobs]
all_status_counts = models.Job.objects.get_status_counts(ids)
for job in jobs:
job['status_counts'] = all_status_counts[job['id']]
+ job['result_counts'] = tko_rpc_interface.get_status_counts(
+ ['afe_job_id', 'afe_job_id'],
+ header_groups=[['afe_job_id'], ['afe_job_id']],
+ **{'afe_job_id': job['id']})
return rpc_utils.prepare_for_serialization(jobs)