X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/35336cd73e444534cb2eda20e3730464cc4e6553..a3615da860d1d78d0ecb7e2890eea26963b5c01e:/apps/workbench/app/views/application/_job_progress.html.erb diff --git a/apps/workbench/app/views/application/_job_progress.html.erb b/apps/workbench/app/views/application/_job_progress.html.erb index a25acc3a04..5c19779ccc 100644 --- a/apps/workbench/app/views/application/_job_progress.html.erb +++ b/apps/workbench/app/views/application/_job_progress.html.erb @@ -1,18 +1,41 @@ -<% 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] || 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 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 %>
<% end %> - + - + - + <% if not defined? scaleby %>