浏览代码

[core] Yarn check config should not depend on test code

In particular nose.tools
Romain Rigaux 11 年之前
父节点
当前提交
819ef4d
共有 2 个文件被更改,包括 19 次插入20 次删除
  1. 19 2
      desktop/libs/hadoop/src/hadoop/conf.py
  2. 0 18
      desktop/libs/hadoop/src/hadoop/yarn/tests.py

+ 19 - 2
desktop/libs/hadoop/src/hadoop/conf.py

@@ -142,7 +142,6 @@ def config_validator(user):
   """
   from hadoop.fs import webhdfs
   from hadoop import job_tracker
-  from hadoop.yarn import tests
 
   res = []
   submit_to = []
@@ -172,7 +171,7 @@ def config_validator(user):
   for name in YARN_CLUSTERS.keys():
     cluster = YARN_CLUSTERS[name]
     if cluster.SUBMIT_TO.get():
-      res.extend(tests.test_yarn_configurations())
+      res.extend(test_yarn_configurations())
       submit_to.append('yarn_clusters.' + name)
 
   if not submit_to:
@@ -180,3 +179,21 @@ def config_validator(user):
                 "Yarn clusters with `submit_to=true' in order to run jobs."))
 
   return res
+
+
+def test_yarn_configurations():
+  # Single cluster for now
+  from hadoop.yarn.resource_manager_api import get_resource_manager
+
+  result = []
+
+  try:
+    url = ''
+    api = get_resource_manager()
+    url = api._url
+    api.apps()
+  except Exception, e:
+    msg = 'Failed to contact Resource Manager at %s: %s' % (url, e)
+    result.append(('Resource Manager', msg))
+
+  return result

+ 0 - 18
desktop/libs/hadoop/src/hadoop/yarn/tests.py

@@ -19,30 +19,12 @@ import logging
 
 from nose.tools import assert_true, assert_equal, assert_not_equal
 
-from hadoop.yarn.resource_manager_api import get_resource_manager
 from hadoop.yarn import clients
 
 
 LOG = logging.getLogger(__name__)
 
 
-def test_yarn_configurations():
-  # Single cluster for now
-
-  result = []
-
-  try:
-    url = ''
-    api = get_resource_manager()
-    url = api._url
-    api.apps()
-  except Exception, e:
-    msg = 'Failed to contact Resource Manager at %s: %s' % (url, e)
-    result.append(('Resource Manager', msg))
-
-  return result
-
-
 def test_get_log_client():
   old_max_heap_size = clients.MAX_HEAP_SIZE
   clients.MAX_HEAP_SIZE = 2