[ARVADOS] updated: ee69f7031612132f0b27fb9b05d24bc1201ead69

git at public.curoverse.com git at public.curoverse.com
Tue Jun 17 15:05:18 EDT 2014


Summary of changes:
 .../app/views/application/_job_progress.html.erb   | 50 +++++++++++++---------
 1 file changed, 30 insertions(+), 20 deletions(-)

       via  ee69f7031612132f0b27fb9b05d24bc1201ead69 (commit)
      from  4b8a53c9cfc81a942f985f1799dbc6e27deb3bc2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit ee69f7031612132f0b27fb9b05d24bc1201ead69
Author: Tim Pierce <twp at curoverse.com>
Date:   Tue Jun 17 15:03:07 2014 -0400

    2936: fix job progress bars
    
    Add edge case settings for when a crunch job could not be started, or
    when no tasks were ever created.
    
    Calculate percent_total_tasks as a float, to ensure that it will be
    nonzero even if there are more than 100 tasks altogether. Calculate
    percentages of individual task progress with .ceil to ensure that there
    will be at least 1% shown for each nonzero task status.
    
    Refs #2936

diff --git a/apps/workbench/app/views/application/_job_progress.html.erb b/apps/workbench/app/views/application/_job_progress.html.erb
index d25baba..5c19779 100644
--- a/apps/workbench/app/views/application/_job_progress.html.erb
+++ b/apps/workbench/app/views/application/_job_progress.html.erb
@@ -1,31 +1,41 @@
-<% failed = j[:tasks_summary][:failed] rescue 0 %>
-<% done = j[:tasks_summary][:done] rescue 0 %>
-<% running = j[:tasks_summary][:running] rescue 0 %>
-<% todo = j[:tasks_summary][:todo] rescue 0 %>
+<%
+   failed = j[:tasks_summary][:failed] || 0 rescue 0
+   done = j[:tasks_summary][:done] || 0 rescue 0
+   running = j[:tasks_summary][:running] || 0 rescue 0
+   todo = j[:tasks_summary][:todo] || 0 rescue 0
 
-<% if j[:success] == false and failed == 0 %>
-  <% failed = 1 # job failed, so show as though at least one task failed %>
-<% else %>
-
-<% if done + running + failed + todo == 0 %>
-  <% failed = 1 # no tasks ran; show as though one task ran and failed %>
-<% end %>
-
-<% percent_total_tasks = 100 / (done + running + failed + todo) %>
-
-<% if defined? scaleby %>
-  <% percent_total_tasks *= scaleby %>
-<% end %>
+   if j[:success] == false and done + running + failed == 0
+     # The job failed but no tasks were ever started (i.e. crunch-dispatch
+     # was unable to start the job). Display a full 100% failed progress bar.
+     failed_percent = 100
+     success_percent = 0
+     running_percent = 0
+   elsif done + running + failed + todo == 0
+     # No tasks were ever created for this job;
+     # render an empty progress bar.
+     failed_percent = 0
+     success_percent = 0
+     running_percent = 0
+   else
+     percent_total_tasks = 100.0 / (done + running + failed + todo)
+     if defined? scaleby
+       percent_total_tasks *= scaleby
+     end
+     failed_percent = (failed * percent_total_tasks).ceil
+     success_percent = (done * percent_total_tasks).ceil
+     running_percent = (running * percent_total_tasks).ceil
+   end
+%>
 
 <% if not defined? scaleby %>
   <div class="progress">
 <% end %>
 
-<span class="progress-bar progress-bar-success" style="width: <%= done * percent_total_tasks %>%;">
+<span class="progress-bar progress-bar-success" style="width: <%= success_percent %>%;">
 </span>
-<span class="progress-bar progress-bar-danger" style="width: <%= failed * percent_total_tasks %>%;">
+<span class="progress-bar progress-bar-danger" style="width: <%= failed_percent %>%;">
 </span>
-<span class="progress-bar" style="width: <%= running * percent_total_tasks %>%;">
+<span class="progress-bar" style="width: <%= running_percent %>%;">
 </span>
 
 <% if not defined? scaleby %>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list