Преглед изворни кода

HUE-9482 [ui] Add queries interface in Job Browser

sreenaths пре 5 година
родитељ
комит
739cc9e746

+ 7 - 0
apps/jobbrowser/src/jobbrowser/conf.py

@@ -72,6 +72,13 @@ ENABLE_HIVE_QUERY_BROWSER = Config(
   default=False
 )
 
+ENABLE_QUERIES_LIST = Config(
+  key="enable_queries_list",
+  help=_("Show the Queries section for listing Hive/Impala query history and providing more troubleshooting information."),
+  type=coerce_bool,
+  default=False
+)
+
 ENABLE_HISTORY_V2 = Config(
   key="enable_history_v2",
   help=_("Show the version 2 of job/query History which unifies the all into one."),

+ 21 - 4
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -22,7 +22,7 @@ from desktop.webpack_utils import get_hue_bundles
 from metadata.conf import PROMETHEUS
 from notebook.conf import ENABLE_QUERY_SCHEDULING
 
-from jobbrowser.conf import DISABLE_KILLING_JOBS, MAX_JOB_FETCH, ENABLE_QUERY_BROWSER, ENABLE_HIVE_QUERY_BROWSER, ENABLE_HISTORY_V2
+from jobbrowser.conf import DISABLE_KILLING_JOBS, MAX_JOB_FETCH, ENABLE_QUERY_BROWSER, ENABLE_HIVE_QUERY_BROWSER, ENABLE_QUERIES_LIST, ENABLE_HISTORY_V2
 
 from webpack_loader.templatetags.webpack_loader import render_bundle
 %>
@@ -328,7 +328,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
               <div data-bind="template: { name: 'breadcrumbs${ SUFFIX }' }"></div>
               <!-- /ko -->
 
-              <!-- ko if: interface() !== 'slas' && interface() !== 'oozie-info' -->
+              <!-- ko if: interface() !== 'slas' && interface() !== 'oozie-info' && interface() !== 'queries'-->
               <!-- ko if: !$root.job() -->
               <form class="form-inline">
                 <!-- ko if: !$root.isMini() && interface() == 'queries-impala' -->
@@ -480,6 +480,10 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
               <!-- /ko -->
               <div id="slas" data-bind="visible: interface() === 'slas'"></div>
 
+              <div id="queries" data-bind="visible: interface() === 'queries'">
+                <queries-list></queries-list>
+              </div>
+
               <!-- ko if: interface() === 'oozie-info' -->
                 <!-- ko hueSpinner: { spin: oozieInfoLoading(), center: true, size: 'xlarge' } --><!-- /ko -->
               <!-- /ko -->
@@ -3686,6 +3690,10 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
       });
 
       self.fetchJobs = function () {
+        if(vm.interface() === 'queries') {
+          return;
+        }
+
         vm.apiHelper.cancelActiveRequest(lastUpdateJobsRequest);
         vm.apiHelper.cancelActiveRequest(lastFetchJobsRequest);
 
@@ -3706,6 +3714,10 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
       }
 
       self.updateJobs = function () {
+        if(vm.interface() === 'queries') {
+          return;
+        }
+
         vm.apiHelper.cancelActiveRequest(lastUpdateJobsRequest);
 
         lastFetchJobsRequest = self._fetchJobs(function(data) {
@@ -3920,6 +3932,9 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
         var scheduleHiveInterfaceCondition = function () {
           return '${ ENABLE_QUERY_SCHEDULING.get() }' == 'True';
         };
+        var queriesInterfaceCondition = function () {
+          return '${ ENABLE_QUERIES_LIST.get() }' == 'True';
+        };
 
         var interfaces = [
           {'interface': 'jobs', 'label': '${ _ko('Jobs') }', 'condition': jobsInterfaceCondition},
@@ -3938,6 +3953,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
           {'interface': 'bundles', 'label': '${ _ko('Bundles') }', 'condition': schedulerExtraInterfaceCondition},
           {'interface': 'slas', 'label': '${ _ko('SLAs') }', 'condition': schedulerExtraInterfaceCondition},
           {'interface': 'livy-sessions', 'label': '${ _ko('Livy') }', 'condition': livyInterfaceCondition},
+          {'interface': 'queries', 'label': '${ _ko('Queries') }', 'condition': queriesInterfaceCondition},
         ];
 
         return interfaces.filter(function (i) {
@@ -4025,7 +4041,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
             self.loadOozieInfoPage();
           % endif
         }
-        else {
+        else if(interface !== 'queries'){
           self.jobs.fetchJobs();
         }
       };
@@ -4052,7 +4068,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
       self.monitorJob = function(job) {
         window.clearTimeout(updateJobTimeout);
         window.clearTimeout(updateJobsTimeout);
-        if (self.interface() && self.interface() !== 'slas' && self.interface() !== 'oozie-info'){
+        if (self.interface() && self.interface() !== 'slas' && self.interface() !== 'oozie-info' && self.interface !== 'queries'){
           if (job) {
             if (job.apiStatus() === 'RUNNING') {
               var _updateJob = function () {
@@ -4134,6 +4150,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
           case 'engines':
           case 'dataeng-jobs':
           case 'livy-sessions':
+          case 'queries':
             self.selectInterface(h);
             break;
           default:

+ 3 - 1
desktop/conf.dist/hue.ini

@@ -1034,7 +1034,7 @@
     # ## Presto Session properties along with HTTPS.
     # # options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\", \"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
     # ## Presto Session properties when HTTPS is not enabled.
-    # # options='{"url": "presto://username:password@localhost:8080/tpch/default","connect_args":"{\"session_props\": {\"query_max_run_time\": \"1m\"}}"}' 
+    # # options='{"url": "presto://username:password@localhost:8080/tpch/default","connect_args":"{\"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
 
     # [[[clickhouse]]]
     #   name=ClickHouse
@@ -1648,6 +1648,8 @@
   # Show the Hive section for listing the query history and providing more troubleshooting information.
   ## enable_hive_query_browser=false
 
+  # Show the Queries section for listing Hive/Impala query history and providing more troubleshooting information.
+  ## enable_queries_list=false
 
 ###########################################################################
 # Settings to configure Sentry / Security App.

+ 3 - 1
desktop/conf/pseudo-distributed.ini.tmpl

@@ -1467,7 +1467,7 @@
   ## redirect_download=false
 
   # Optionally set this if you want a different home directory path. e.g. s3a://gethue.
-  ## remote_storage_home=s3a://gethue 
+  ## remote_storage_home=s3a://gethue
 
 
 ###########################################################################
@@ -1634,6 +1634,8 @@
   # Show the Hive section for listing the query history and providing more troubleshooting information.
   ## enable_hive_query_browser=false
 
+  # Show the Queries section for listing Hive/Impala query history and providing more troubleshooting information.
+  ## enable_queries_list=false
 
 ###########################################################################
 # Settings to configure Sentry / Security App.

+ 1 - 0
desktop/core/src/desktop/js/apps/jobBrowser/app.js

@@ -16,6 +16,7 @@
 
 import huePubSub from 'utils/huePubSub';
 import './components/hiveQueryPlan/webcomp';
+import './components/queriesList/webcomp';
 
 huePubSub.subscribe('app.dom.loaded', app => {
   if (app !== 'jobbrowser') {

+ 29 - 0
desktop/core/src/desktop/js/apps/jobBrowser/components/queriesList/queries-list.vue

@@ -0,0 +1,29 @@
+<!--
+  Licensed to Cloudera, Inc. under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  Cloudera, Inc. licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<template>
+  <h1>Queries List!</h1>
+</template>
+
+<script lang="ts">
+  import Vue from 'vue';
+  import Component from 'vue-class-component';
+
+  @Component
+  export default class QueriesList extends Vue {}
+</script>

+ 24 - 0
desktop/core/src/desktop/js/apps/jobBrowser/components/queriesList/webcomp.ts

@@ -0,0 +1,24 @@
+/**
+ * Licensed to Cloudera, Inc. under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  Cloudera, Inc. licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { wrap } from 'vue/webComponentWrapper';
+import QueriesList from './queries-list.vue';
+
+export const COMPONENT_NAME = 'queries-list';
+
+wrap(COMPONENT_NAME, QueriesList);