[autotest] suite-scheduler sanity check should not rely on django

Resubmit of CL:288396
This reverts commit babd70ccd5866fe5eb875e9c725a129d3c881c2c.
It also contains a fix for importing django.

TEST=Test on a ganeti
/usr/local/autotest/site_utils/suite_scheduler/suite_scheduler.py -b -d
/usr/local/autotest/logs -f /usr/local/autotest/suite_scheduler.ini
TEST=Test on a geneti
/usr/local/autotest/site_utils/suite_scheduler/suite_scheduler.py --sanity
(remove site-packages)
BUG=chromium:474671

Change-Id: I155750de1d05b6e3f2625a4ae210622f748975f7
Reviewed-on: https://chromium-review.googlesource.com/290251
Tested-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Fang Deng <fdeng@chromium.org>
diff --git a/scheduler/scheduler_lib.py b/scheduler/scheduler_lib.py
index cdd6c18..304572c 100644
--- a/scheduler/scheduler_lib.py
+++ b/scheduler/scheduler_lib.py
@@ -18,6 +18,7 @@
 from autotest_lib.database import database_connection
 from autotest_lib.frontend import setup_django_environment
 from autotest_lib.frontend.afe import readonly_connection
+from autotest_lib.server import utils as server_utils
 
 
 DB_CONFIG_SECTION = 'AUTOTEST_WEB'
@@ -42,24 +43,12 @@
     """Raised by the scheduler when an inconsistent state occurs."""
 
 
-class Singleton(type):
-    """Enforce that only one client class is instantiated per process."""
-    _instances = {}
-
-    def __call__(cls, *args, **kwargs):
-        """Fetch the instance of a class to use for subsequent calls."""
-        if cls not in cls._instances:
-            cls._instances[cls] = super(Singleton, cls).__call__(
-                    *args, **kwargs)
-        return cls._instances[cls]
-
-
 class ConnectionManager(object):
     """Manager for the django database connections.
 
     The connection is used through scheduler_models and monitor_db.
     """
-    __metaclass__ = Singleton
+    __metaclass__ = server_utils.Singleton
 
     def __init__(self, readonly=True, autocommit=True):
         """Set global django database options for correct connection handling.