Jelajahi Sumber

HUE-1070 [oozie] Display all job URLs spawned by Pig

Display child job ids of Workflow Action
Display action configuration with syntax highlighting
Fix Dashboard breadcrumb links
Add tests
Romain Rigaux 12 tahun lalu
induk
melakukan
8968d22de3

+ 60 - 10
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow_action.mako

@@ -34,7 +34,7 @@ ${ layout.menubar(section='running') }
       ${ _('Bundle') } <a href="${ oozie_bundle.get_absolute_url() }">${ oozie_bundle.appName }</a> :
     % endif
     % if oozie_coordinator:
-      ${ _('Coordinator') } <a href="${ oozie_coordinator.get_absolute_url(oozie_bundle) }">${ oozie_coordinator.appName }</a> :
+      ${ _('Coordinator') } <a href="${ oozie_coordinator.get_absolute_url() }">${ oozie_coordinator.appName }</a> :
     % endif
     ${ _('Workflow') } <a href="${ workflow.get_absolute_url() }">${ workflow.appName }</a> :
     ${ _('Action') } ${ action.name }
@@ -75,6 +75,7 @@ ${ layout.menubar(section='running') }
       <ul class="nav nav-tabs">
         <li class="active"><a href="#details" data-toggle="tab">${ _('Details') }</a></li>
         <li><a href="#configuration" data-toggle="tab">${ _('Configuration') }</a></li>
+        <li><a href="#child-jobs" data-toggle="tab">${ _('Child Jobs') }</a></li>
       </ul>
 
       <div id="workflow-tab-content" class="tab-content" style="min-height:200px">
@@ -136,17 +137,40 @@ ${ layout.menubar(section='running') }
           </table>
         </div>
 
-        <div id="configuration" class="tab-pane">
-          ${ utils.display_conf(action.conf_dict) }
+        <div id="configuration" class="tab-pane" style="min-height:400px">
+          <textarea id="configurationEditor">${ action.conf }</textarea>
         </div>
 
-        % if action.externalId:
-          <div id="logs" class="tab-pane">
-            <h2>${ _('Logs') }</h2>
-
-            ${ utils.display_conf(action.conf_dict) }
-          </div>
-        % endif
+        <div id="child-jobs" class="tab-pane">
+          % if not action.externalChildIDs:
+            ${ _('No child jobs') }
+          % else:
+          <table class="table table-condensed datatables" id="jobTable">
+            <thead>
+              <tr>
+                <th>${ _('Logs') }</th>
+                <th>${ _('Ids') }</th>
+              </tr>
+            </thead>
+            <tbody>
+            % for child_id in action.externalChildIDs.split(','):
+              <tr>
+                <td>
+                  <a href="${ url('jobbrowser.views.job_single_logs', job=child_id) }" title="${ _('View the logs') }" rel="tooltip">
+                    <i class="icon-tasks"></i>
+                  </a>
+                </td>
+                <td>
+                  <a href="${ url('jobbrowser.views.single_job', job=child_id) }">
+                    ${ "_".join(child_id.split("_")[-2:]) }
+                  </a>
+                </td>
+              </tr>
+            % endfor
+              </tbody>
+            </table>
+          % endif
+        </div>
       </div>
 
       <div style="margin-bottom: 16px">
@@ -157,4 +181,30 @@ ${ layout.menubar(section='running') }
 
 </div>
 
+<script src="/static/ext/js/codemirror-3.0.js"></script>
+<link rel="stylesheet" href="/static/ext/css/codemirror.css">
+<script src="/static/ext/js/codemirror-xml.js"></script>
+
+<script type="text/javascript">
+
+  $(document).ready(function() {
+    var definitionEditor = $("#configurationEditor")[0];
+
+    var codeMirror = CodeMirror(function (elt) {
+      definitionEditor.parentNode.replaceChild(elt, definitionEditor);
+    }, {
+      value:definitionEditor.value,
+      readOnly:true,
+      lineNumbers:true
+    });
+
+    // force refresh on tab change
+    $("a[data-toggle='tab']").on("shown", function (e) {
+      if ($(e.target).attr("href") == "#configuration") {
+        codeMirror.refresh();
+      }
+    });
+  });
+</script>
+
 ${ commonfooter(messages) | n,unicode }

File diff ditekan karena terlalu besar
+ 0 - 1
apps/oozie/src/oozie/tests.py


+ 11 - 8
apps/oozie/src/oozie/views/dashboard.py

@@ -173,6 +173,11 @@ def list_oozie_workflow(request, job_id, coordinator_job_id=None, bundle_job_id=
   if bundle_job_id is not None:
     oozie_bundle = check_job_access_permission(request, bundle_job_id)
 
+  if oozie_coordinator is not None:
+    setattr(oozie_workflow, 'oozie_coordinator', oozie_coordinator)
+  if oozie_bundle is not None:
+    setattr(oozie_workflow, 'oozie_bundle', oozie_bundle)
+
   history = History.cross_reference_submission_history(request.user, job_id, coordinator_job_id)
 
   hue_coord = history and history.get_coordinator() or History.get_coordinator_from_config(oozie_workflow.conf_dict)
@@ -491,19 +496,17 @@ def _rerun_bundle(request, oozie_id, args, params, properties):
 
 def massaged_workflow_actions_for_json(workflow_actions, oozie_coordinator, oozie_bundle):
   actions = []
-  action_link_params = {}
-
-  if oozie_coordinator is not None:
-    action_link_params['coordinator_job_id'] = oozie_coordinator.id
-  if oozie_bundle is not None:
-    action_link_params['bundle_job_id'] = oozie_bundle.id
 
   for action in workflow_actions:
-    action_link_params.update({'action': action.id})
+    if oozie_coordinator is not None:
+      setattr(action, 'oozie_coordinator', oozie_coordinator.id)
+    if oozie_bundle is not None:
+      setattr(action, 'oozie_bundle', oozie_bundle.id)
+
     massaged_action = {
       'id': action.id,
       'log': action.externalId and reverse('jobbrowser.views.job_single_logs', kwargs={'job': action.externalId}) or '',
-      'url': reverse('oozie:list_oozie_workflow_action', kwargs=action_link_params),
+      'url': action.get_absolute_url(),
       'name': escapejs(action.name),
       'type': action.type,
       'status': action.status,

+ 1 - 0
desktop/libs/liboozie/src/liboozie/types.py

@@ -128,6 +128,7 @@ class WorkflowAction(Action):
     'trackerUri',
     'transition',
     'type',
+    'externalChildIDs',
   ]
 
   def _fixup(self):

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini