[autotest] Consult appropriate shard AFE for special tasks
Special tasks are updated in the local DB of a shard.
RPCs hitting a master AFE that are getting special tasks
should consult an appropriate shard AFE.
BUG=chromium:461637
DEPLOY=apache
TEST=puppylab.
./site_utils/dut_status.py test_host41, where test_host41 is the dut
in master.
./site_utils/dut_status.py test_host51, where test_host51 is the dut
in lumpyshard.
Change-Id: I118ed5f4f20eba14c2e4c2c056e217c31f334aac
Reviewed-on: https://chromium-review.googlesource.com/254420
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Mungyung Ryu <mkryu@google.com>
Tested-by: Mungyung Ryu <mkryu@google.com>
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 232af52..6e2611d 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -1066,9 +1066,7 @@
start_time,
end_time,
**filter_data)
- return rpc_utils.prepare_rows_as_nested_dicts(
- models.HostQueueEntry.query_objects(filter_data),
- ('host', 'atomic_group', 'job'))
+ return rpc_utils.get_serialized_local_host_queue_entries(**filter_data)
def get_num_host_queue_entries(start_time=None, end_time=None, **filter_data):
@@ -1099,9 +1097,13 @@
# special tasks
def get_special_tasks(**filter_data):
- return rpc_utils.prepare_rows_as_nested_dicts(
- models.SpecialTask.query_objects(filter_data),
- ('host', 'queue_entry'))
+ # Task id is not universally unique, the id passed in would only be
+ # applicable to local db.
+ if 'id' in filter_data or 'id__in' in filter_data:
+ return rpc_utils.get_serialized_local_special_tasks(**filter_data)
+ else:
+ return rpc_utils.get_data(rpc_utils.get_serialized_local_special_tasks,
+ 'get_special_tasks', **filter_data)
# support for host detail view