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

HUE-1389 [oozie] Schedule a hive query automatically

Romain Rigaux 9 éve
szülő
commit
630431573f

+ 1 - 1
apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js

@@ -492,7 +492,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
     loadLayout(self, layout_json);
     self.workflow.loadNodes(workflow_json);
 
-    $.get('/desktop/api2/docs/?type=query-hive&limit=50', function(data) {
+    $.get('/desktop/api2/docs/?type=query-hive&sort=last_modified&limit=100', function(data) {
       $.each(data.documents, function(index, query) {
         self.hiveQueries.push(ko.mapping.fromJS(query));
       });

+ 2 - 2
apps/oozie/src/oozie/templates/editor2/common_workflow.mako

@@ -940,7 +940,7 @@
       <!-- ko if: $root.getHiveQueryById(properties.uuid()) -->
       <!-- ko with: $root.getHiveQueryById(properties.uuid()) -->
         <a data-bind="attr: {href: absoluteUrl()}" target="_blank"><span data-bind='text: name'></span></a>
-        </br>
+        <br/>
         <span data-bind='text: description'></span>
       <!-- /ko -->
       <!-- /ko -->
@@ -951,7 +951,7 @@
         <!-- ko if: $root.getHiveQueryById(properties.uuid()) -->
         <!-- ko with: $root.getHiveQueryById(properties.uuid()) -->
           <span data-bind='text: name'></span>
-          </br>
+          <br/>
           <span data-bind='text: description'></span>
         <!-- /ko -->
         <!-- /ko -->

+ 1 - 1
apps/oozie/src/oozie/templates/editor2/gen/workflow-hive-document.xml.mako

@@ -27,7 +27,7 @@
               <job-xml>${ node['properties']['job_xml'] }</job-xml>
             % endif
             ${ common.configuration(node['properties']['job_properties']) }
-            
+
             <jdbc-url>${ node['properties']['jdbc_url'] }</jdbc-url>
             % if node['properties']['password']:
             <password>${ node['properties']['password'] }</password>

+ 1 - 0
apps/oozie/src/oozie/templates/editor2/workflow_editor.mako

@@ -43,6 +43,7 @@ ${ commonheader(_("Workflow Editor"), "Oozie", user, "40px") | n,unicode }
     <a title="${ _('Submit') }" rel="tooltip" data-placement="bottom" data-bind="click: showSubmitPopup, css: {'btn': true, 'disabled': workflow.isDirty()}, visible: workflow.id() != null">
       <i class="fa fa-fw fa-play"></i>
     </a>
+
     <a title="${ _('Schedule') }" rel="tooltip" data-placement="bottom" data-bind="click: schedule, css: {'btn': true, 'disabled': workflow.isDirty()}, visible: workflow.id() != null">
       <i class="fa fa-fw fa-calendar"></i>
     </a>

+ 2 - 0
apps/oozie/src/oozie/urls.py

@@ -103,6 +103,8 @@ urlpatterns += patterns(
   url(r'^editor/bundle/save/$', 'save_bundle', name='save_bundle'),
   url(r'^editor/bundle/submit/(?P<doc_id>\d+)$', 'submit_bundle', name='editor_submit_bundle'),
   url(r'^editor/bundle/open_v1/$', 'open_old_bundle', name='open_old_bundle'),
+
+  url(r'^editor/document/schedule/$', 'schedule_document', name='schedule_document'),
 )
 
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 18 - 1
apps/oozie/src/oozie/views/editor2.py


+ 1 - 1
desktop/libs/liboozie/src/liboozie/submission2.py

@@ -187,7 +187,7 @@ class Submission(object):
         elif action.data['type'] == 'hive-document':
           from notebook.models import Notebook
           notebook = Notebook(document=Document2.objects.get_by_uuid(uuid=action.data['properties']['uuid']))
-          
+
           self._create_file(deployment_dir, action.data['name'] + '.sql', notebook.get_str())
           #self.data['properties']['script_path'] = _generate_hive_script(self.data['uuid']) #'workspace_%s' % workflow.uui
 

+ 14 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1160,6 +1160,7 @@
     };
 
     self.save = function () {
+      logGA('save');
       $.post("/notebook/api/notebook/save", {
         "notebook": ko.mapping.toJSON(self, NOTEBOOK_MAPPING),
         "editorMode": vm.editorMode
@@ -1183,6 +1184,7 @@
     };
 
     self.close = function () {
+      logGA('close');
       $.post("/notebook/api/notebook/close", {
         "notebook": ko.mapping.toJSON(self, NOTEBOOK_MAPPING),
         "editorMode": vm.editorMode
@@ -1267,7 +1269,19 @@
       }
     });
 
+    self.schedule = function() {
+      logGA('schedule');
+      $.post("/oozie/editor/document/schedule/", {
+        uuid: self.uuid()
+      }, function (data) {
+        window.location.href = data.url;
+      }).fail(function (xhr) {
+        $(document).trigger("error", xhr.responseText);
+      });
+    };
+
     self.clearHistory = function (type) {
+      logGA('clearHistory');
       $.post("/notebook/api/clear_history", {
         notebook: ko.mapping.toJSON(self.getContext()),
         doc_type: self.selectedSnippet()

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

@@ -202,6 +202,12 @@ ${ hueIcons.symbols() }
           <i class="fa fa-cogs"></i>
         </a>
 
+        % if mode == 'editor':
+        <a class="btn pointer" title="${ _('Schedule') }" rel="tooltip" data-placement="bottom" data-bind="click: function() { $root.selectedNotebook().schedule() }, css: {'disabled': ! $root.selectedNotebook() || ! $root.selectedNotebook().id() }">
+          <i class="fa fa-fw fa-calendar"></i>
+        </a>
+        % endif
+
         <a class="btn pointer" title="${ _('Player mode') }" rel="tooltip" data-placement="bottom" data-bind="click: function(){ hueUtils.goFullScreen(); $root.isEditing(false); $root.isPlayerMode(true); }">
           <i class="fa fa-expand"></i>
         </a>

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott