Эх сурвалжийг харах

HUE-7941 [impala] Reset the status of the query link for new queries

jdesjean 7 жил өмнө
parent
commit
ed09de0

+ 3 - 1
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -430,11 +430,13 @@ class HS2Api(Api):
       } for job in jobs_with_state]
     elif snippet['type'] == 'impala' and ENABLE_QUERY_BROWSER.get():
       query_id = "%x:%x" % struct.unpack(b"QQ", snippet['result']['handle']['guid'])
+      progress = min(self.progress(snippet, logs), 99) if snippet['status'] != 'available' and snippet['status'] != 'success' else 100
       jobs = [{
         'name': query_id,
         'url': '/hue/jobbrowser#!id=%s' % query_id,
         'started': True,
-        'finished': False
+        'finished': False,
+        'percentJob': progress
       }]
 
     return jobs

+ 7 - 1
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1805,7 +1805,6 @@ var EditorViewModel = (function() {
         if (self.statusForButtons() == 'canceling' || self.status() == 'canceled') {
           // Query was canceled in the meantime, do nothing
         } else {
-          self.getLogs();
           self.result.endTime(new Date());
 
           if (data.status === 0) {
@@ -1862,6 +1861,7 @@ var EditorViewModel = (function() {
             self._ajaxError(data);
             notebook.isExecutingAll(false);
           }
+          self.getLogs(); // Need to execute at the end, because updating the status impacts log progress results
         }
       }).fail(function (xhr, textStatus, errorThrown) {
         if (xhr.status !== 502) {
@@ -1985,8 +1985,14 @@ var EditorViewModel = (function() {
               if (_found.length === 0) {
                 if (typeof job.percentJob === 'undefined') {
                   job.percentJob = ko.observable(-1);
+                } else {
+                  job.percentJob = ko.observable(job.percentJob);
                 }
                 self.jobs.push(job);
+              } else if (typeof job.percentJob !== 'undefined') {
+                for (var i = 0; i < _found.length; i++) {
+                  _found[i].percentJob(job.percentJob)
+                }
               }
             });
             self.jobs().forEach(function (job) {

+ 4 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -3788,6 +3788,10 @@ function togglePresentation(value) {};
       }, HUE_PUB_SUB_EDITOR_ID);
 
       huePubSub.subscribe('jobbrowser.data', function (jobs) {
+        var snippet = viewModel.selectedNotebook().snippets()[0];
+        if (snippet.type() === 'impala') {
+          return;
+        }
         if (jobs.length > 0) {
           jobs.forEach(function (job) {
             if ($("#" + job.shortId).length > 0) {