[ARVADOS] updated: 49a9c33ea6119c42ad3d2d585ed7b2f9e4339132
Git user
git at public.curoverse.com
Fri May 19 15:34:47 EDT 2017
Summary of changes:
apps/workbench/app/models/container.rb | 4 ++--
apps/workbench/app/models/container_request.rb | 4 ++--
apps/workbench/app/models/container_work_unit.rb | 24 ++++++++++++++--------
.../app/views/work_units/_show_status.html.erb | 19 ++++++++++++++++-
4 files changed, 38 insertions(+), 13 deletions(-)
via 49a9c33ea6119c42ad3d2d585ed7b2f9e4339132 (commit)
via fe7467555e7d6843bea4ede99bd07c1476df7d0d (commit)
via 642e59798974a4c3bb0ecfebd3fa790c912d1187 (commit)
via d956fd4fa88796c80edff99d4b1dcf97cbd0011d (commit)
from c182087b563ddbb40fde2b1d0c185af481df3bc2 (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 49a9c33ea6119c42ad3d2d585ed7b2f9e4339132
Merge: c182087 fe74675
Author: radhika <radhika at curoverse.com>
Date: Fri May 19 15:34:32 2017 -0400
closes #11710
Merge branch '11710-container-request-show-perf'
commit fe7467555e7d6843bea4ede99bd07c1476df7d0d
Author: radhika <radhika at curoverse.com>
Date: Fri May 19 14:30:58 2017 -0400
11710: fix typo in finding children
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 68f8e30..ed34196 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -16,20 +16,16 @@ class ContainerWorkUnit < ProxyWorkUnit
def children
return @my_children if @my_children
- container_uuid = nil
- container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
-
items = []
+ container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
if container_uuid
- my_children = @child_proxies
cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts)
- my_children = ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results if !my_children
+ my_children = @child_proxies || ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results if !my_children
my_child_containers = my_children.map(&:container_uuid).compact.uniq
grandchildren = {}
my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers.any?
-
reqs = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).results if my_child_containers.any?
- reqs.each {|cr| grandchildren[cr.request_container_uuid] << cr} if reqs
+ reqs.each {|cr| grandchildren[cr.requesting_container_uuid] << cr} if reqs
my_children.each do |cr|
items << cr.work_unit(cr.name || 'this container', child_objects=grandchildren[cr.container_uuid])
commit 642e59798974a4c3bb0ecfebd3fa790c912d1187
Author: radhika <radhika at curoverse.com>
Date: Thu May 18 15:38:52 2017 -0400
11710: fetching requesting containers
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 73f2ee3..68f8e30 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -22,13 +22,13 @@ class ContainerWorkUnit < ProxyWorkUnit
items = []
if container_uuid
my_children = @child_proxies
- my_children = ContainerRequest.where(requesting_container_uuid: container_uuid).results if !my_children
-
+ cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts)
+ my_children = ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results if !my_children
my_child_containers = my_children.map(&:container_uuid).compact.uniq
grandchildren = {}
- my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers
+ my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers.any?
- reqs = ContainerRequest.where(requesting_container_uuid: my_child_containers).results if !my_child_containers
+ reqs = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).results if my_child_containers.any?
reqs.each {|cr| grandchildren[cr.request_container_uuid] << cr} if reqs
my_children.each do |cr|
diff --git a/apps/workbench/app/views/work_units/_show_status.html.erb b/apps/workbench/app/views/work_units/_show_status.html.erb
index c06e82a..b80d50d 100644
--- a/apps/workbench/app/views/work_units/_show_status.html.erb
+++ b/apps/workbench/app/views/work_units/_show_status.html.erb
@@ -1,7 +1,8 @@
<%
container_uuid = if @object.is_a?(Container) then @object.uuid elsif @object.is_a?(ContainerRequest) then @object.container_uuid end
if container_uuid
- reqs = ContainerRequest.where(requesting_container_uuid: container_uuid).results
+ cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts)
+ reqs = ContainerRequest.select(cols).where(requesting_container_uuid: container_uuid).results
load_preloaded_objects(reqs)
child_cs = reqs.map(&:requesting_container_uuid).uniq
commit d956fd4fa88796c80edff99d4b1dcf97cbd0011d
Author: radhika <radhika at curoverse.com>
Date: Thu May 18 11:42:25 2017 -0400
11710: preload / batch retrieval of children of a container_work_unit
diff --git a/apps/workbench/app/models/container.rb b/apps/workbench/app/models/container.rb
index e683a6e..cf1de69 100644
--- a/apps/workbench/app/models/container.rb
+++ b/apps/workbench/app/models/container.rb
@@ -3,7 +3,7 @@ class Container < ArvadosBase
false
end
- def work_unit(label=nil)
- ContainerWorkUnit.new(self, label, self.uuid)
+ def work_unit(label=nil, child_objects=nil)
+ ContainerWorkUnit.new(self, label, self.uuid, child_objects=child_objects)
end
end
diff --git a/apps/workbench/app/models/container_request.rb b/apps/workbench/app/models/container_request.rb
index aae712b..7cbd91e 100644
--- a/apps/workbench/app/models/container_request.rb
+++ b/apps/workbench/app/models/container_request.rb
@@ -11,7 +11,7 @@ class ContainerRequest < ArvadosBase
true
end
- def work_unit(label=nil)
- ContainerWorkUnit.new(self, label, self.uuid)
+ def work_unit(label=nil, child_objects=nil)
+ ContainerWorkUnit.new(self, label, self.uuid, child_objects=child_objects)
end
end
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index afdc91e..73f2ee3 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -1,14 +1,16 @@
class ContainerWorkUnit < ProxyWorkUnit
attr_accessor :container
+ attr_accessor :child_proxies
- def initialize proxied, label, parent
- super
+ def initialize proxied, label, parent, child_objects=nil
+ super proxied, label, parent
if @proxied.is_a?(ContainerRequest)
container_uuid = get(:container_uuid)
if container_uuid
@container = Container.find(container_uuid)
end
end
+ @child_proxies = child_objects
end
def children
@@ -19,12 +21,22 @@ class ContainerWorkUnit < ProxyWorkUnit
items = []
if container_uuid
- reqs = ContainerRequest.where(requesting_container_uuid: container_uuid).results
- reqs.each do |cr|
- items << cr.work_unit(cr.name || 'this container')
+ my_children = @child_proxies
+ my_children = ContainerRequest.where(requesting_container_uuid: container_uuid).results if !my_children
+
+ my_child_containers = my_children.map(&:container_uuid).compact.uniq
+ grandchildren = {}
+ my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers
+
+ reqs = ContainerRequest.where(requesting_container_uuid: my_child_containers).results if !my_child_containers
+ reqs.each {|cr| grandchildren[cr.request_container_uuid] << cr} if reqs
+
+ my_children.each do |cr|
+ items << cr.work_unit(cr.name || 'this container', child_objects=grandchildren[cr.container_uuid])
end
end
+ @child_proxies = nil #no need of this any longer
@my_children = items
end
diff --git a/apps/workbench/app/views/work_units/_show_status.html.erb b/apps/workbench/app/views/work_units/_show_status.html.erb
index f2052ef..c06e82a 100644
--- a/apps/workbench/app/views/work_units/_show_status.html.erb
+++ b/apps/workbench/app/views/work_units/_show_status.html.erb
@@ -1,6 +1,22 @@
+<%
+ container_uuid = if @object.is_a?(Container) then @object.uuid elsif @object.is_a?(ContainerRequest) then @object.container_uuid end
+ if container_uuid
+ reqs = ContainerRequest.where(requesting_container_uuid: container_uuid).results
+ load_preloaded_objects(reqs)
+
+ child_cs = reqs.map(&:requesting_container_uuid).uniq
+ child_cs += reqs.map(&:container_uuid).uniq
+ preload_objects_for_dataclass(Container, child_cs)
+
+ wu = current_obj.work_unit(name, child_objects=reqs)
+ else
+ wu = current_obj.work_unit(name)
+ end
+%>
+
<div class="arv-log-refresh-control"
data-load-throttle="86486400000" <%# 1001 nights %>
></div>
<%=
- render(partial: 'work_units/show_component', locals: {wu: current_obj.work_unit(name)})
+ render(partial: 'work_units/show_component', locals: {wu: wu})
%>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list