From 35f40e6fae579f884a85ed95e263fe14056b1e47 Mon Sep 17 00:00:00 2001 From: "mbalakrishnan@cloudera.com" Date: Thu, 16 Jan 2025 11:40:03 -0800 Subject: [PATCH] HS2 JDBC URL for Oozie Workflow via config param --- apps/oozie/src/oozie/conf.py | 7 +++++++ apps/oozie/src/oozie/models2.py | 4 ++-- desktop/conf.dist/hue.ini | 3 +++ desktop/conf/pseudo-distributed.ini.tmpl | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/oozie/src/oozie/conf.py b/apps/oozie/src/oozie/conf.py index ef15c28f7d1..913cd30d66e 100644 --- a/apps/oozie/src/oozie/conf.py +++ b/apps/oozie/src/oozie/conf.py @@ -61,6 +61,13 @@ ), ) +OOZIE_HS2_JDBC_URL = Config( + key="oozie_hs2_jdbc_url", + help="The JDBC URL for HiveServer2 action", + type=str, + default="" +) + def get_oozie_job_count(): '''Returns the maximum of jobs fetched by the API depending on the Hue version''' diff --git a/apps/oozie/src/oozie/models2.py b/apps/oozie/src/oozie/models2.py index ab7694558ef..0801f2cbfce 100644 --- a/apps/oozie/src/oozie/models2.py +++ b/apps/oozie/src/oozie/models2.py @@ -50,7 +50,7 @@ from liboozie.oozie_api import get_oozie from liboozie.submission2 import Submission, create_directories from notebook.models import Notebook -from oozie.conf import REMOTE_SAMPLE_DIR +from oozie.conf import OOZIE_HS2_JDBC_URL, REMOTE_SAMPLE_DIR from oozie.importlib.workflows import InvalidTagWithNamespaceException, MalformedWfDefException, generate_v2_graph_nodes from oozie.utils import UTC_TIME_FORMAT, convert_to_server_timezone, utc_datetime_format @@ -830,7 +830,7 @@ def to_xml(self, mapping=None, node_mapping=None, workflow_mapping=None): workflow_mapping = {} if self.data['type'] in ('hive2', 'hive-document') and not self.data['properties']['jdbc_url']: - self.data['properties']['jdbc_url'] = _get_hiveserver2_url() + self.data['properties']['jdbc_url'] = OOZIE_HS2_JDBC_URL.get() if OOZIE_HS2_JDBC_URL.get() else _get_hiveserver2_url() if self.data['type'] == 'fork': links = [link for link in self.data['children'] if link['to'] in node_mapping] diff --git a/desktop/conf.dist/hue.ini b/desktop/conf.dist/hue.ini index 2ea02ab95b4..b24a95d4dbd 100644 --- a/desktop/conf.dist/hue.ini +++ b/desktop/conf.dist/hue.ini @@ -1689,6 +1689,9 @@ submit_to=True # Parameters are $TIME and $USER, e.g. /user/$USER/hue/workspaces/workflow-$TIME ## remote_data_dir=/user/hue/oozie/workspaces +# JDBC URL for Hive2 action +## oozie_hs2_jdbc_url=jdbc:hive2://localhost:10000/default + # Maximum of Oozie workflows or coodinators to retrieve in one API call. ## oozie_jobs_count=100 diff --git a/desktop/conf/pseudo-distributed.ini.tmpl b/desktop/conf/pseudo-distributed.ini.tmpl index 207ee8020e3..add120073c9 100644 --- a/desktop/conf/pseudo-distributed.ini.tmpl +++ b/desktop/conf/pseudo-distributed.ini.tmpl @@ -1673,6 +1673,9 @@ # Parameters are $TIME and $USER, e.g. /user/$USER/hue/workspaces/workflow-$TIME ## remote_data_dir=/user/hue/oozie/workspaces + # JDBC URL for Hive2 action + ## oozie_hs2_jdbc_url=jdbc:hive2://localhost:10000/default + # Maximum of Oozie workflows or coodinators to retrieve in one API call. ## oozie_jobs_count=100