Browse Source

[compute] fixes to handle no available compute and other options

Change-Id: I2b9b408e0f342a2134da7c2f65ee6b9cdcc4d340
Amit Srivastava 2 years ago
parent
commit
3a042f36f0
2 changed files with 10 additions and 6 deletions
  1. 4 4
      apps/beeswax/src/beeswax/common.py
  2. 6 2
      apps/beeswax/src/beeswax/server/dbms.py

+ 4 - 4
apps/beeswax/src/beeswax/common.py

@@ -121,14 +121,14 @@ def find_compute(cluster=None, user=None, dialect=None, namespace_id=None):
     # If found, we will attempt to reload it, first by id then by name
     if selected_compute:
       if selected_compute.get('id'):
-        c = Compute.objects.filter(id=selected_compute['id']).first().to_dict()
+        c = Compute.objects.filter(id=selected_compute['id']).first()
         if c:
-          return c
+          return c.to_dict()
 
       if selected_compute.get('name'):
-        c = Compute.objects.filter(name=selected_compute['name']).first().to_dict()
+        c = Compute.objects.filter(name=selected_compute['name']).first()
         if c:
-          return c
+          return c.to_dict()
 
       # If we could not load by id or name, then we want to pick a default compute based on dialect
       dialect = selected_compute['dialect'] if selected_compute.get('dialect') else dialect

+ 6 - 2
apps/beeswax/src/beeswax/server/dbms.py

@@ -339,8 +339,8 @@ def get_query_server_config_via_connector(connector):
       # For connectors/computes, the auth details are not available
       # from configs and needs patching before submitting requests
       'principal': 'TODO',
-      'auth_username': None,
-      'auth_password': '',
+      'auth_username': compute['options'].get('auth_username'),
+      'auth_password': compute['options'].get('auth_password', 'hue'),
 
       'impersonation_enabled': impersonation_enabled,
       'use_sasl': str(compute['options'].get('use_sasl', True)).upper() == 'TRUE',
@@ -349,6 +349,10 @@ def get_query_server_config_via_connector(connector):
       'QUERY_TIMEOUT_S': 15 * 60,
       'transport_mode': compute['options'].get('transport_mode', 'http'),
       'http_url': compute['options'].get('http_url', 'http://%s:%s/cliservice' % (server_host, server_port)),
+
+      'close_sessions': str(compute['options'].get('close_sessions', True)).upper() == 'TRUE',
+      'has_session_pool': str(compute['options'].get('has_session_pool', True)).upper() == 'TRUE',
+      'max_number_of_sessions': compute['options'].get('has_session_pool', -1)
   }