Bläddra i källkod

HUE-8611 [assist] Send cluster parameter with the invalidate calls

Johan Ahlen 7 år sedan
förälder
incheckning
2fe317ec8c

+ 5 - 2
apps/impala/src/impala/api.py

@@ -34,12 +34,15 @@ from impala import dbms
 
 LOG = logging.getLogger(__name__)
 
-
 @require_POST
 @error_handler
 def invalidate(request):
+  cluster = {'id': request.POST.get('cluster', 'default')}
+
+  # TODO: create cluster_config for get_query_server_config
+
   query_server = dbms.get_query_server_config()
-  db = beeswax_dbms.get(request.user, query_server=query_server)
+  db = beeswax_dbms.get(request.user, query_server=query_server, cluster=cluster)
 
   response = {'status': 0, 'message': ''}
 

+ 3 - 1
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -1265,6 +1265,7 @@ var ApiHelper = (function () {
    * @param {string} options.sourceType
    * @param {string} options.invalidate - 'invalidate' or 'invalidateAndFlush'
    * @param {string[]} [options.path]
+   * @param {ContextCompute} [options.compute]
    * @param {boolean} [options.silenceErrors]
    */
   ApiHelper.prototype.invalidateSourceMetadata = function (options) {
@@ -1273,7 +1274,8 @@ var ApiHelper = (function () {
 
     if (options.sourceType === 'impala' && (options.invalidate === 'invalidate' || options.invalidate === 'invalidateAndFlush')) {
       var data = {
-        flush_all: options.invalidate === 'invalidateAndFlush'
+        flush_all: options.invalidate === 'invalidateAndFlush',
+        cluster: options.compute && options.compute.id
       };
 
       if (options.path && options.path.length > 0) {

+ 1 - 0
desktop/core/src/desktop/static/desktop/js/dataCatalog.js

@@ -715,6 +715,7 @@ var DataCatalog = (function () {
         } else {
           invalidatePromise = ApiHelper.getInstance().invalidateSourceMetadata({
             sourceType: self.getSourceType(),
+            compute: self.compute,
             invalidate: invalidate,
             path: self.path,
             silenceErrors: options.silenceErrors