[autotest] Optimize queries in abort_suites
abort_suites is called by buildbots.
The way it currently aborts suite is very slow.
This CL makes it faster by aborting the suite jobs
given a build name and a suite name, and rely on autotest
scheduler to aborts the subjobs.
TEST=Scheduler synchronous/asynchronous suites. Abort
them when the suite status is Queued/Running/Complete.
Confirm any Queued/Running subjobs are aborted.
BUG=chromium:444151
DEPLOY=apache
Change-Id: I182913e0dad08bcba8a4c05b904ba7a2d2a6c61b
Reviewed-on: https://chromium-review.googlesource.com/236943
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Fang Deng <fdeng@chromium.org>
Trybot-Ready: Fang Deng <fdeng@chromium.org>
Tested-by: Fang Deng <fdeng@chromium.org>
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index b9aa7ab..6c191e1 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -742,6 +742,9 @@
def abort_host_queue_entries(**filter_data):
"""\
Abort a set of host queue entries.
+
+ @return: A list of dictionaries, each contains information
+ about an aborted HQE.
"""
query = models.HostQueueEntry.query_objects(filter_data)
@@ -754,6 +757,9 @@
rpc_utils.check_abort_synchronous_jobs(host_queue_entries)
models.HostQueueEntry.abort_host_queue_entries(host_queue_entries)
+ hqe_info = [{'HostQueueEntry': hqe.id, 'Job': hqe.job_id,
+ 'Job name': hqe.job.name} for hqe in host_queue_entries]
+ return hqe_info
def abort_special_tasks(**filter_data):