[benchmarking] Avoid KeyError when no bot returned from swarming query
When making query to swarming for bots with dimension values, it is possible that no bot is returned. Normally, the return JSON looks like this: { "death_timeout": "xxx", "items": ["list","of","bots"] "now": "xxx" } When there's no bot, the "items" key is gone: { "death_timeout": "xxx", "now": "xxx" } In this case, we will see a KeyError in pre_run stage because we try to read values using "items" key in perf_device_trigger.py: for bot in query_result['items']: ... KeyError doesn't tell what is actually happening. To fix, we check this key before using it. Then when no bot exists, we will see a message saying there's not enough machines. Bug: chromium:1027147 Change-Id: I38fe0e1a015e29d9b223515f49c527641bcebf60 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929871Reviewed-by:Caleb Rouleau <crouleau@chromium.org> Commit-Queue: Caleb Rouleau <crouleau@chromium.org> Cr-Commit-Position: refs/heads/master@{#718356}
Showing
Please register or sign in to comment