[ARVADOS] created: b073de9a59cf1b19ea9f3bee0274eed71cf62495
Git user
git at public.curoverse.com
Thu Jan 12 18:45:22 EST 2017
at b073de9a59cf1b19ea9f3bee0274eed71cf62495 (commit)
commit b073de9a59cf1b19ea9f3bee0274eed71cf62495
Author: radhika <radhika at curoverse.com>
Date: Thu Jan 12 18:44:18 2017 -0500
10516: compute cputime recursively using cputime of any children.
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index 771fdac..4230484 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -187,9 +187,15 @@ class ProxyWorkUnit < WorkUnit
end
def cputime
- if state_label != "Queued"
+ if children.any?
+ children.map { |c|
+ c.cputime
+ }.reduce(:+) || 0
+ else
if started_at
(runtime_constraints.andand[:min_nodes] || 1).to_i * ((finished_at || Time.now()) - started_at)
+ else
+ 0
end
end
end
@@ -272,20 +278,7 @@ class ProxyWorkUnit < WorkUnit
end
resp << " for "
- cpu_time = 0
- if children.any?
- cpu_time = children.map { |c|
- if c.started_at
- (c.runtime_constraints.andand[:min_nodes] || 1).to_i * ((c.finished_at || Time.now()) - c.started_at)
- else
- 0
- end
- }.reduce(:+) || 0
- else
- if started_at
- cpu_time = (runtime_constraints.andand[:min_nodes] || 1).to_i * ((finished_at || Time.now()) - started_at)
- end
- end
+ cpu_time = cputime
resp << ApplicationController.helpers.render_time(runningtime, false)
if (walltime - runningtime) > 0
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list