Enis Afgan  committed 9ee792f

Unpack and configure Hadoop in a separate thread to speed up startup time

  • Participants
  • Parent commits aa8f9ba
  • Branches default

Comments (0)

Files changed (1)

File cm/services/apps/

+import os
+import re
+import glob
 import shutil
 import tarfile
-import os
-from import ApplicationService
-from cm.util import paths
-from import service_states
-from import ServiceRole
-from import ServiceDependency
-from cm.util import misc
+import urllib2
+import urlparse
+import threading
 from distutils.version import StrictVersion
-import urlparse
-import urllib2
-import re
-import glob
+from cm.util import misc
+from cm.util import paths
+from import ServiceRole
+from import service_states
+from import ServiceDependency
+from import ApplicationService
 import logging
 log = logging.getLogger('cloudman')
         log.debug("Configuring Hadoop")
         self.state = service_states.STARTING
+        threading.Thread(target=self.__start).start()
+    def __start(self):
+        """
+        Do the actual unpacking and configuring for Hadoop.
+        This method is intended to be called in a separate thread
+        and this is because the file download may take a while.
+        """
         if self.unpack_hadoop():
             self.state = service_states.RUNNING