Forráskód Böngészése

HUE-8738 [docs] Mention NGINX settings with queries timeout

Romain 5 éve
szülő
commit
a3bed20bd8

+ 2 - 2
desktop/libs/notebook/src/notebook/connectors/sql_alchemy_tests.py

@@ -193,7 +193,7 @@ class TestApi(object):
     with patch('notebook.connectors.sql_alchemy.create_engine') as create_engine:
       engine = SqlAlchemyApi(self.user, interpreter)._create_engine()
 
-      create_engine.assert_called_with('presto://hue:8080/hue')
+      create_engine.assert_called_with('presto://hue:8080/hue', pool_pre_ping=True)
 
 
     interpreter['options']['has_impersonation'] = True  # On
@@ -201,7 +201,7 @@ class TestApi(object):
     with patch('notebook.connectors.sql_alchemy.create_engine') as create_engine:
       engine = SqlAlchemyApi(self.user, interpreter)._create_engine()
 
-      create_engine.assert_called_with('presto://test@hue:8080/hue')
+      create_engine.assert_called_with('presto://test@hue:8080/hue', pool_pre_ping=True)
 
 
   def test_check_status(self):

+ 3 - 2
desktop/libs/notebook/src/notebook/tasks.py

@@ -183,7 +183,7 @@ def run_sync_query(doc_id, user):
   editor_type = snippet['type']
   sql = _get_statement(notebook)
   request = MockedDjangoRequest(user=user)
-  last_executed=time.mktime(datetime.datetime.now().timetuple()) * 1000
+  last_executed = time.mktime(datetime.datetime.now().timetuple()) * 1000
 
   notebook = make_notebook(
       name='Scheduled query %s at %s' % (query_document.name, last_executed),
@@ -229,7 +229,8 @@ def download(*args, **kwargs):
 
 # Why we need this:
 # 1) There is no way in celery to differentiate between a task that was submitted, but not yet started and a task that has been GCed.
-# 2) The client will keep checking for data until the query is expired. The new definition for expired in this case is a task that has been GCed.
+# 2) The client will keep checking for data until the query is expired. The new definition for expired in this case is a task
+#    that has been GCed.
 def _patch_status(notebook):
   result = download_to_file.AsyncResult(notebook['uuid'])
   result.backend.store_result(notebook['uuid'], None, "SUBMITTED")

+ 9 - 3
docs/docs-site/content/administrator/configuration/server/_index.md

@@ -611,16 +611,22 @@ If set, limits the number of concurrent user sessions. 1 represents 1 browser se
 
 [Read more about it here](http://gethue.com/restrict-number-of-concurrent-sessions-per-user/).
 
-## Task Server
-
-Execute long blocking or resource intensive operations in tasks outside of the server. This is particularly useful for querying databases other than Hive or Impala that uses the SqlAlchemy interface which is blocking until the query actually finishes.
+## Query execution timeouts
 
 i.e. if the SQL query takes more than 30 seconds, it might timeout without it:
 
     504 Gateway Time-out 504 Gateway Time-out nginx/1.17.10
 
+One solution is to  execute long blocking or resource intensive operations in tasks outside of the server. This is particularly useful for querying databases other than Hive or Impala that uses the SqlAlchemy interface which is blocking until the query actually finishes.
+
 Read more in the [Task Server section](/administrator/administration/reference/#task-server) of the Reference Guide.
 
+An alternative is to increase the NGINX timeouts from 30s to more minutes:
+
+    nginx.ingress.kubernetes.io/proxy-connect-timeout: '900'
+    nginx.ingress.kubernetes.io/proxy-read-timeout: '900'
+    nginx.ingress.kubernetes.io/proxy-send-timeout: '900'
+
 ## Customize the UI
 
 ### Maps look and feel