Browse Source

HUE-5. libs/hadoop should be more lenient looking for jars

bcwalrus 15 years ago
parent
commit
b788dfd07c

+ 2 - 0
apps/jobsub/src/jobsub/management/commands/jobsub_setup.py

@@ -53,6 +53,8 @@ class Command(NoArgsCommand):
 
     # Also copy over Hadoop examples and streaming jars
     local_src = hadoop.conf.HADOOP_EXAMPLES_JAR.get()
+    if local_src is None:
+      raise Exception('Failed to locate the Hadoop example jar')
     remote_dst = posixpath.join(jobsub.conf.REMOTE_DATA_DIR.get(), "examples", "hadoop-examples.jar")
     copy_file(local_src, remote_fs, remote_dst)
 

+ 5 - 6
desktop/libs/hadoop/src/hadoop/conf.py

@@ -52,14 +52,13 @@ def find_jar(desired_glob, root=None):
   def f():
     pattern = os.path.join(root_f(), desired_glob)
     possibilities = glob.glob(pattern)
-    if len(possibilities) == 1:
-      return possibilities[0]
-    elif len(possibilities) >= 1:
-      logging.warning("Found multiple jars matching %s: %s" % (pattern, possibilities))
+    if len(possibilities) == 0:
+      logging.error("Trouble finding jars matching %s" % (pattern,))
       return None
     else:
-      logging.warning("Trouble finding jars matching %s" % (pattern,))
-      return None
+      if len(possibilities) != 1:
+        logging.warning("Found multiple jars matching %s: %s" % (pattern, possibilities))
+      return possibilities[0]
   if root is None:
     root_str = "$HADOOP_HOME"
   else: