فهرست منبع

[oozie] Jars of MapReduce and Java actions are not copied to the lib directory

The copy is not happening automatically. Currently users need to put the jars
in the subdirectory lib in the workspace as the Jar input has no effect.
Romain Rigaux 10 سال پیش
والد
کامیت
8735bf8
2فایلهای تغییر یافته به همراه14 افزوده شده و 15 حذف شده
  1. 5 4
      desktop/libs/liboozie/src/liboozie/submission2.py
  2. 9 11
      desktop/libs/liboozie/src/liboozie/submittion2_tests.py

+ 5 - 4
desktop/libs/liboozie/src/liboozie/submission2.py

@@ -280,10 +280,11 @@ class Submission(object):
     # List jar files
     files = []
     lib_path = self.fs.join(deployment_dir, 'lib')
-    if hasattr(self.job, 'node_list'):
-      for node in self.job.node_list:
-        if hasattr(node, 'jar_path') and not node.jar_path.startswith(lib_path):
-          files.append(node.jar_path)
+    if hasattr(self.job, 'nodes'):
+      for node in self.job.nodes:
+        jar_path = node.data['properties'].get('jar_path')
+        if jar_path and not jar_path.startswith(lib_path):
+          files.append(jar_path)
 
     # Copy the jar files to the workspace lib
     if files:

+ 9 - 11
desktop/libs/liboozie/src/liboozie/submittion2_tests.py

@@ -24,9 +24,11 @@ from nose.tools import assert_equal, assert_true, assert_not_equal
 from hadoop import cluster, pseudo_hdfs4
 from hadoop.conf import HDFS_CLUSTERS, MR_CLUSTERS, YARN_CLUSTERS
 
-from liboozie.submission2 import Submission
-from oozie.tests import OozieMockBase
 from desktop.lib.django_test_util import make_logged_in_client
+from oozie.models2 import Node
+from oozie.tests import OozieMockBase
+
+from liboozie.submission2 import Submission
 
 
 LOG = logging.getLogger(__name__)
@@ -59,19 +61,15 @@ def test_copy_files():
     cluster.fs.create(jar_3)
     cluster.fs.create(jar_4)
 
-    class MockNode():
-      def __init__(self, jar_path):
-        self.jar_path = jar_path
-
     class MockJob():
       XML_FILE_NAME = 'workflow.xml'
 
       def __init__(self):
-        self.node_list = [
-            MockNode(jar_1),
-            MockNode(jar_2),
-            MockNode(jar_3),
-            MockNode(jar_4),
+        self.nodes = [
+            Node({'id': '1', 'type': 'mapreduce', 'properties': {'jar_path': jar_1}}),
+            Node({'id': '2', 'type': 'mapreduce', 'properties': {'jar_path': jar_2}}),
+            Node({'id': '3', 'type': 'java', 'properties': {'jar_path': jar_3}}),
+            Node({'id': '4', 'type': 'java', 'properties': {'jar_path': jar_4}})
         ]
 
     submission = Submission(user, job=MockJob(), fs=cluster.fs, jt=cluster.jt)