소스 검색

HUE-6691 [oozie] Support Pig parameters and files in drag and dropped Pig script

Romain Rigaux 8 년 전
부모
커밋
e12a054dfa
2개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 3
      apps/oozie/src/oozie/models2.py
  2. 2 1
      desktop/libs/liboozie/src/liboozie/submission2.py

+ 7 - 3
apps/oozie/src/oozie/models2.py

@@ -799,14 +799,18 @@ class Node():
 
       name = '%s-%s' % (self.data['type'].split('-')[0], self.data['id'][:4])
       self.data['properties']['script_path'] = "${wf:appPath()}/" + name + ".pig"
-      self.data['properties']['parameters'] = [{'value': prop} for prop in action['properties']['parameters']]
-      self.data['properties']['arguments'] = []
+      if 'parameters' not in self.data['properties']:
+        self.data['properties']['parameters'] = []
+      for param in action['variables']:
+        self.data['properties']['parameters'].insert(0, {'value': '%(name)s=%(value)s' % param})
+      self.data['properties']['arguments'] = [] # Not Picked yet
+
       job_properties = []
       for prop in action['properties']['hadoopProperties']:
         name, value = prop.split('=', 1)
         job_properties.append({'name': name, 'value': value})
       self.data['properties']['job_properties'] = job_properties
-      self.data['properties']['files'] = [{'value': prop} for prop in action['properties']['parameters']]
+      self.data['properties']['files'] = [{'value': prop} for prop in action['properties']['resources']]
 
     elif self.data['type'] == SqoopDocumentAction.TYPE:
       notebook = Notebook(document=Document2.objects.get_by_uuid(user=self.user, uuid=self.data['properties']['uuid']))

+ 2 - 1
desktop/libs/liboozie/src/liboozie/submission2.py

@@ -40,6 +40,7 @@ from liboozie.credentials import Credentials
 
 LOG = logging.getLogger(__name__)
 
+
 def submit_dryrun(run_func):
   def decorate(self, deployment_dir=None):
     if self.oozie_id is not None:
@@ -283,7 +284,7 @@ STORED AS TEXTFILE %s""" % (self.properties.get('send_result_path'), '\n\n\n'.jo
         elif action.data['type'] == 'pig-document':
           from notebook.models import Notebook
           notebook = Notebook(document=Document2.objects.get_by_uuid(user=self.user, uuid=action.data['properties']['uuid']))
-          statements = notebook.get_data()['snippets'][0]['statement']
+          statements = notebook.get_data()['snippets'][0]['statement_raw']
 
           self._create_file(deployment_dir, action.data['name'] + '.pig', statements)