Преглед изворни кода

HUE-3308 [editor] Get the output of the Java command

Romain Rigaux пре 9 година
родитељ
комит
03378b2c20

+ 1 - 1
apps/oozie/src/oozie/models2.py

@@ -2935,7 +2935,7 @@ class WorkflowBuilder():
     return workflow_doc
 
 
-  def get_hive_document_node(self, document, name, parameters, user):
+  def get_hive_document_node(self, document, name, user):
     api = get_oozie(user)
 
     credentials = [HiveDocumentAction.DEFAULT_CREDENTIALS] if api.security_enabled else []

+ 7 - 3
desktop/libs/notebook/src/notebook/connectors/oozie_batch.py

@@ -46,6 +46,7 @@ class OozieApi(Api):
   LOG_START_PATTERN = '(>>> Invoking Main class now >>>.+)'
   LOG_END_PATTERN = '<<< Invocation of Main class completed <<<'
   RESULTS_PATTERN = "(?P<results>>>> Invoking Beeline command line now >>>.+<<< Invocation of Beeline command completed <<<)"
+  RESULTS_PATTERN_GENERIC = "(?P<results>>>> Invoking Main class now >>>.+<<< Invocation of Main class completed <<<)"
 
   def __init__(self, *args, **kwargs):
     Api.__init__(self, *args, **kwargs)
@@ -89,7 +90,7 @@ class OozieApi(Api):
 
   def fetch_result(self, notebook, snippet, rows, start_over):
     log_output = self.get_log(notebook, snippet)
-    results = self._get_results(log_output)
+    results = self._get_results(log_output, snippet['type'])
 
     return {
         'data':  [[line] for line in results.split('\n')],  # hdfs_link()
@@ -175,9 +176,12 @@ class OozieApi(Api):
 
 
 
-  def _get_results(self, log_output):
+  def _get_results(self, log_output, action_type):
     results = ''
-    re_results = re.compile(self.RESULTS_PATTERN, re.M | re.DOTALL)
+
+    pattern = self.RESULTS_PATTERN if action_type == 'hive' else self.RESULTS_PATTERN_GENERIC
+
+    re_results = re.compile(pattern, re.M | re.DOTALL)
     if re_results.search(log_output):
       results = re.search(re_results, log_output).group('results').strip()
     return results