[autotest] Use the metrics_mock object in case chromite is not set up.
BUG=chromium:688166
TEST=unittest
Change-Id: Ic0077cb2dba75a8d820f229060f3f70f507850a1
Reviewed-on: https://chromium-review.googlesource.com/438754
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/scheduler/drone_manager.py b/scheduler/drone_manager.py
index b296b65..ae331e6 100644
--- a/scheduler/drone_manager.py
+++ b/scheduler/drone_manager.py
@@ -2,15 +2,21 @@
import os
import logging
-from chromite.lib import metrics
-
import common
-from autotest_lib.client.common_lib import error, global_config, utils
-from autotest_lib.scheduler import drone_utility, drones
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.common_lib import global_config
+from autotest_lib.client.common_lib import utils
+from autotest_lib.scheduler import drones
+from autotest_lib.scheduler import drone_utility
from autotest_lib.scheduler import drone_task_queue
from autotest_lib.scheduler import scheduler_config
from autotest_lib.scheduler import thread_lib
+try:
+ from chromite.lib import metrics
+except ImportError:
+ metrics = utils.metrics_mock
+
# results on drones will be placed under the drone_installation_directory in a
# directory with this name