Move prefer local devserver check

BUG=chromium:672348
TEST=None

Change-Id: I12725fbee9118a7d6ed19dd5b6f0fdbfa0e94cda
Reviewed-on: https://chromium-review.googlesource.com/418250
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 3ff81cd..58fa4fb 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -19,6 +19,7 @@
 from autotest_lib.client.common_lib import control_data, error
 from autotest_lib.client.common_lib import global_config, priorities
 from autotest_lib.client.common_lib import time_utils
+from autotest_lib.client.common_lib.cros import dev_server
 # TODO(akeshet): Replace with monarch once we know how to instrument rpc server
 # with ts_mon.
 from autotest_lib.client.common_lib.cros.graphite import autotest_stats
@@ -1361,7 +1362,7 @@
 
     @return: Name of a dut with the given board and pool.
     """
-    if not board or not pool:
+    if not (dev_server.PREFER_LOCAL_DEVSERVER and pool and board):
         return None
 
     hosts = get_host_query(