Browse Source

[editor] Update the corrdinator URL pattern in Impala mini job browser

Ying Chen 1 year ago
parent
commit
4b3e9cc97d

+ 6 - 0
apps/impala/src/impala/conf.py

@@ -73,6 +73,12 @@ IMPERSONATION_ENABLED = Config(
   type=coerce_bool,
   dynamic_default=is_impersonation_enabled)
 
+COORDINATOR_UI_SPNEGO = Config(
+  key='coordinator_ui_spnego',
+  help=_t("Impala Coordinator Web Server has Spnego enabled."),
+  type=coerce_bool,
+  default=False)
+
 QUERYCACHE_ROWS = Config(
   key='querycache_rows',
   help=_t("Number of initial rows of a resultset to ask Impala to cache in order to"

+ 8 - 1
apps/jobbrowser/src/jobbrowser/apis/query_api.py

@@ -27,7 +27,10 @@ import pytz
 from babel import localtime
 import os
 
+from urllib.parse import urlparse
+
 from desktop.lib import export_csvxls
+from impala.conf import COORDINATOR_UI_SPNEGO
 from libanalyze import analyze as analyzer, rules
 from notebook.conf import ENABLE_QUERY_ANALYSIS
 
@@ -158,12 +161,16 @@ class QueryApi(Api):
       }
     app = apps.get('apps')[0]
     progress_groups = re.search(r"([\d\.\,]+)%", app.get('progress'))
+    parsed_api_url = urlparse(self.api.url)
+
     app.update({
       'progress': float(progress_groups.group(1)) \
           if progress_groups and progress_groups.group(1) else 100 \
             if self._api_status(app.get('status')) in ['SUCCEEDED', 'FAILED'] else 1,
       'type': 'queries',
-      'doc_url': "%s/query_plan?query_id=%s" % (self.api.url, appid),
+      'doc_url': '%s/query_plan?query_id=%s' % (self.api.url, appid) if not COORDINATOR_UI_SPNEGO.get() else
+                 '%s/query_plan?scheme=%s&host=%s&port=%s&query_id=%s' %
+                   (self.api.url, parsed_api_url.scheme, parsed_api_url.hostname, parsed_api_url.port, appid),
       'properties': {
         'memory': '',
         'profile': '',

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -1506,6 +1506,9 @@ submit_to=True
 # Turn on/off impersonation mechanism when talking to Impala
 ## impersonation_enabled=False
 
+# Impala Coordinator Web Server has Spnego enabled
+## coordinator_ui_spnego=false
+
 # Number of initial rows of a result set to ask Impala to cache in order
 # to support re-fetching them for downloading them.
 # Set to 0 for disabling the option and backward compatibility.

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -1488,6 +1488,9 @@
   # Turn on/off impersonation mechanism when talking to Impala
   ## impersonation_enabled=False
 
+  # Impala Coordinator Web Server has Spnego enabled
+  ## coordinator_ui_spnego=false
+
   # Number of initial rows of a result set to ask Impala to cache in order
   # to support re-fetching them for downloading them.
   # Set to 0 for disabling the option and backward compatibility.