|
|
@@ -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
|