Ver Fonte

HUE-3729 [editor] Display the address of the impala of the current session

This will now be pulled up as 'http_addr' in the session response for Impala only:

{
    "status": 0,
    "session": {
        "properties": [
            {
                "multiple": true,
                "value": [],
                "nice_name": "Settings",
                "key": "settings",
                "help_text": "Impala configuration properties.",
                "type": "settings",
                "options": []
            }
        ],
        "type": "impala",
        "id": 10,
        "http_addr": "node-2.test.com:25000"
    }
}
Jenny Kim há 9 anos atrás
pai
commit
588d3a8

+ 13 - 5
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -136,6 +136,11 @@ class HS2Api(Api):
 
     session = Session.objects.get_session(self.user, application=application)
 
+    response = {
+      'type': lang,
+      'id': session.id
+    }
+
     if session is None:
       session = dbms.get(self.user, query_server=get_query_server_config(name=lang)).open_session(self.user)
 
@@ -146,11 +151,14 @@ class HS2Api(Api):
       else:
         properties = self.get_properties(lang)
 
-    return {
-        'type': lang,
-        'id': session.id,
-        'properties': properties
-    }
+    response['properties'] = properties
+
+    if lang == 'impala':
+      impala_settings = session.get_formatted_properties()
+      http_addr = next((setting['value'] for setting in impala_settings if setting['key'].lower() == 'http_addr'), None)
+      response['http_addr'] = http_addr
+
+    return response
 
 
   @query_error_handler