Quellcode durchsuchen

[pig] Avoid 500 error when polling logs for the first time

Move Run button to the top.
Add spinner when waiting for the first available log lines.
Romain Rigaux vor 12 Jahren
Ursprung
Commit
73a67381e1
2 geänderte Dateien mit 7 neuen und 10 gelöschten Zeilen
  1. 1 1
      apps/pig/src/pig/api.py
  2. 6 9
      apps/pig/src/pig/templates/app.mako

+ 1 - 1
apps/pig/src/pig/api.py

@@ -130,8 +130,8 @@ class OozieApi:
     workflow_actions = []
     workflow_actions = []
 
 
     # Only one Pig action
     # Only one Pig action
-    progress = get_progress(oozie_workflow, logs.get(action.name, ''))
     for action in oozie_workflow.get_working_actions():
     for action in oozie_workflow.get_working_actions():
+      progress = get_progress(oozie_workflow, logs.get(action.name, ''))
       appendable = {
       appendable = {
         'name': action.name,
         'name': action.name,
         'status': action.status,
         'status': action.status,

+ 6 - 9
apps/pig/src/pig/templates/app.mako

@@ -118,11 +118,6 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
             ##<li><a href="#createDataset">${ _('New') }</a></li>
             ##<li><a href="#createDataset">${ _('New') }</a></li>
             ##<li><a href="#createDataset">${ _('List') }</a></li>
             ##<li><a href="#createDataset">${ _('List') }</a></li>
             <li class="nav-header">${_('Actions')}</li>
             <li class="nav-header">${_('Actions')}</li>
-            <li data-bind="click: saveScript">
-              <a href="#" title="${ _('Save the script') }" rel="tooltip" data-placement="right">
-                <i class="icon-save"></i> ${ _('Save') }
-              </a>
-            </li>
             <li data-bind="click: runOrShowSubmissionModal, visible: !currentScript().isRunning()">
             <li data-bind="click: runOrShowSubmissionModal, visible: !currentScript().isRunning()">
               <a href="#" title="${ _('Run the script') }" rel="tooltip" data-placement="right">
               <a href="#" title="${ _('Run the script') }" rel="tooltip" data-placement="right">
                 <i class="icon-play"></i> ${ _('Run') }
                 <i class="icon-play"></i> ${ _('Run') }
@@ -133,6 +128,11 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
                 <i class="icon-ban-circle"></i> ${ _('Stop') }
                 <i class="icon-ban-circle"></i> ${ _('Stop') }
               </a>
               </a>
             </li>
             </li>
+            <li data-bind="click: saveScript">
+              <a href="#" title="${ _('Save the script') }" rel="tooltip" data-placement="right">
+                <i class="icon-save"></i> ${ _('Save') }
+              </a>
+            </li>
             <li data-bind="visible: currentScript().id() != -1, click: copyScript">
             <li data-bind="visible: currentScript().id() != -1, click: copyScript">
               <a href="#" title="${ _('Copy the script') }" rel="tooltip" data-placement="right">
               <a href="#" title="${ _('Copy the script') }" rel="tooltip" data-placement="right">
                 <i class="icon-retweet"></i> ${ _('Copy') }
                 <i class="icon-retweet"></i> ${ _('Copy') }
@@ -249,9 +249,6 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
 
 
       <div id="logs" class="section hide">
       <div id="logs" class="section hide">
           <div class="alert alert-info"><h3>${ _('Logs for') } '<span data-bind="text: currentScript().name"></span>'</h3></div>
           <div class="alert alert-info"><h3>${ _('Logs for') } '<span data-bind="text: currentScript().name"></span>'</h3></div>
-          <div data-bind="visible: currentScript().actions().length == 0">
-            <img src="/static/art/spinner.gif" />
-          </div>
           <div data-bind="template: {name: 'logTemplate', foreach: currentScript().actions}"></div>
           <div data-bind="template: {name: 'logTemplate', foreach: currentScript().actions}"></div>
           <script id="logTemplate" type="text/html">
           <script id="logTemplate" type="text/html">
             <div data-bind="css:{'alert-modified': name != '', 'alert': name != '', 'alert-success': status == 'SUCCEEDED' || status == 'OK', 'alert-error': status != 'RUNNING' && status != 'SUCCEEDED' && status != 'OK' && status != 'PREP' && status != 'SUSPENDED'}">
             <div data-bind="css:{'alert-modified': name != '', 'alert': name != '', 'alert-success': status == 'SUCCEEDED' || status == 'OK', 'alert-error': status != 'RUNNING' && status != 'SUCCEEDED' && status != 'OK' && status != 'PREP' && status != 'SUSPENDED'}">
@@ -264,7 +261,7 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
               </div>
               </div>
             </div>
             </div>
           </script>
           </script>
-          <pre id="withoutLogs" class="hide">${ _('No available logs.') }</pre>
+          <pre id="withoutLogs" class="hide"><img src="/static/art/spinner.gif" /> ${ _('No available logs.') }</pre>
           <pre id="withLogs" class="hide scroll"></pre>
           <pre id="withLogs" class="hide scroll"></pre>
         </div>
         </div>