[autotest] offloader handle non-exist host properly
When a dut no longer exist in the inventory, simply
let get_host_queue_entries return empty list rather
than hitting KeyError. This will lead to the directory
being uploade right away. Assume when a dut is removed,
there should be no jobs running on it.
BUG=chromium:480734
TEST=Locally applied on drones. Offloader stop crashing.
Change-Id: Ie5d71df511cac30bc5aebfaff7ba2fae1f6d35f1
Reviewed-on: https://chromium-review.googlesource.com/266984
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Fang Deng <dengfang07@gmail.com>
Tested-by: Fang Deng <dengfang07@gmail.com>
diff --git a/server/frontend.py b/server/frontend.py
index 82cfcfe..dc2a31f 100644
--- a/server/frontend.py
+++ b/server/frontend.py
@@ -304,7 +304,7 @@
host_hash[host.hostname] = host
for status in job_statuses:
if status.host:
- status.host = host_hash[status.host.hostname]
+ status.host = host_hash.get(status.host.hostname)
# filter job statuses that have either host or meta_host
return [status for status in job_statuses if (status.host or
status.meta_host)]