Explorar o código

HUE-7395 [editor] Add built-in link to the mini query job browser

Romain Rigaux %!s(int64=8) %!d(string=hai) anos
pai
achega
50d7a155e6

+ 2 - 2
desktop/core/src/desktop/lib/thrift_util.py

@@ -499,8 +499,8 @@ def _unpack_guid_secret_in_handle(str_args):
 
         str_args = str_args.replace(secret.group(1), "%x:%x" % struct.unpack(b"QQ", encoded_secret))
         str_args = str_args.replace(guid.group(1), "%x:%x" % struct.unpack(b"QQ", encoded_guid))
-      except Exception:
-        logging.warn("Unable to unpack the secret and guid in Thrift Handle.")
+      except Exception, e:
+        logging.warn("Unable to unpack the secret and guid in Thrift Handle: %s" % e)
 
   return str_args
 

+ 9 - 0
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -68,6 +68,7 @@ except ImportError, e:
 
 try:
   from jobbrowser.views import get_job
+  from jobbrowser.conf import ENABLE_QUERY_BROWSER
 except (AttributeError, ImportError), e:
   LOG.warn("Job Browser app is not enabled")
 
@@ -413,6 +414,14 @@ class HS2Api(Api):
         'started': job.get('started', False),
         'finished': job.get('finished', False)
       } 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'])
+      jobs = [{
+        'name': query_id,
+        'url': '/hue/jobbrowser/api/job#id=%s' % query_id,
+        'started': True,
+        'finished': False
+      }]
 
     return jobs