[ARVADOS] created: 4b8a53c9cfc81a942f985f1799dbc6e27deb3bc2

git at public.curoverse.com git at public.curoverse.com
Tue Jun 17 10:00:49 EDT 2014


        at  4b8a53c9cfc81a942f985f1799dbc6e27deb3bc2 (commit)


commit 4b8a53c9cfc81a942f985f1799dbc6e27deb3bc2
Author: Tim Pierce <twp at curoverse.com>
Date:   Tue Jun 17 09:57:00 2014 -0400

    2936: improve progress bar for failed jobs
    
    Ensure that:
    
    * All job progress bars reflect at least one task.  If a job has no
      tasks at all (done, failed, finished, or todo) that should be
      considered a failed job, so render a progress bar as though one task
      ran and failed.
    
    * A failed job (j[:success] == false) always shows at least one failed
      task.  If a job is marked as failed but has no failed tasks, then
      pretend there was one failed task so at least some red will appear in
      the progress bar.
    
    Fixes #2936.

diff --git a/apps/workbench/app/views/application/_job_progress.html.erb b/apps/workbench/app/views/application/_job_progress.html.erb
index a25acc3..d25baba 100644
--- a/apps/workbench/app/views/application/_job_progress.html.erb
+++ b/apps/workbench/app/views/application/_job_progress.html.erb
@@ -1,4 +1,17 @@
-<% percent_total_tasks = 100 / (j[:tasks_summary][:done] + j[:tasks_summary][:running] + j[:tasks_summary][:failed] + j[:tasks_summary][:todo]) rescue 0 %>
+<% 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 %>
+
+<% 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 %>
@@ -8,11 +21,11 @@
   <div class="progress">
 <% end %>
 
-<span class="progress-bar progress-bar-success" style="width: <%= j[:tasks_summary][:done] * percent_total_tasks rescue 0 %>%;">
+<span class="progress-bar progress-bar-success" style="width: <%= done * percent_total_tasks %>%;">
 </span>
-<span class="progress-bar progress-bar-danger" style="width: <%= j[:tasks_summary][:failed] * percent_total_tasks rescue 0 %>%;">
+<span class="progress-bar progress-bar-danger" style="width: <%= failed * percent_total_tasks %>%;">
 </span>
-<span class="progress-bar" style="width: <%= j[:tasks_summary][:running] * percent_total_tasks rescue 0 %>%;">
+<span class="progress-bar" style="width: <%= running * percent_total_tasks %>%;">
 </span>
 
 <% if not defined? scaleby %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list