[ARVADOS] created: cee8f888b442448b2bffe243da2e9cc5dcf29b04

Git user git at public.curoverse.com
Fri May 19 18:10:24 EDT 2017


        at  cee8f888b442448b2bffe243da2e9cc5dcf29b04 (commit)


commit cee8f888b442448b2bffe243da2e9cc5dcf29b04
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Fri May 19 19:07:08 2017 -0300

    11501: A work unit running time with children was only computed calculating its direct
    childs, so if a work unit child has more children, its running time could differ.

diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index 1ed9e3e..8bd04b0 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -63,7 +63,7 @@ module PipelineInstancesHelper
     timestamps << [started_at, finished_at]
   end
 
-  # Accept a list of objects with [:started_at] and [:finshed_at] keys and
+  # Accept a list of objects with [:started_at] and [:finished_at] keys and
   # merge overlapping ranges to compute the time spent running after periods of
   # overlapping execution are factored out.
   def determine_wallclock_runtime jobs
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index b7cc6a0..6da0f98 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -222,14 +222,19 @@ class ProxyWorkUnit < WorkUnit
     state_label == 'Failed'
   end
 
-  def show_runtime
-    runningtime = ApplicationController.helpers.determine_wallclock_runtime(if children.any? then children else [self] end)
-
-    walltime = 0
-    if started_at
-      walltime = if finished_at then (finished_at - started_at) else (Time.now - started_at) end
+  def all_children
+    if children.any?
+      children + children.collect{|c| c.all_children}.flatten
+    else
+      []
     end
+  end
+
+  def runningtime
+    ApplicationController.helpers.determine_wallclock_runtime(if children.any? then all_children else [self] end)
+  end
 
+  def show_runtime
     resp = '<p>'
 
     if started_at
@@ -247,7 +252,7 @@ class ProxyWorkUnit < WorkUnit
       if walltime > runningtime
         resp << ApplicationController.helpers.render_time(walltime, false)
       else
-       resp << ApplicationController.helpers.render_time(runningtime, false)
+        resp << ApplicationController.helpers.render_time(runningtime, false)
       end
 
       if finished_at
diff --git a/apps/workbench/app/views/work_units/_show_child.html.erb b/apps/workbench/app/views/work_units/_show_child.html.erb
index 03bb518..aad7d7b 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -18,10 +18,11 @@
         <% else %>
           <% walltime = current_obj.walltime %>
           <% cputime = current_obj.cputime %>
+          <% runningtime = current_obj.runningtime %>
           <div class="col-md-3">
           <% if walltime and cputime %>
-            <%= render_runtime(walltime, false) %>
-            <% if cputime > 0 %> / <%= render_runtime(cputime, false) %> (<%= (cputime/walltime).round(1) %>⨯)<% end %>
+            <%= render_runtime([walltime, runningtime].max, false) %>
+            <% if cputime > 0 %> / <%= render_runtime(cputime, false) %> (<%= (cputime/runningtime).round(1) %>⨯)<% end %>
           <% end %>
           </div>
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list