[ARVADOS] created: 776885d3a1e4a188fb7ed5191b377a49aa5909a9

Git user git at public.curoverse.com
Wed May 10 12:48:19 EDT 2017


        at  776885d3a1e4a188fb7ed5191b377a49aa5909a9 (commit)


commit 776885d3a1e4a188fb7ed5191b377a49aa5909a9
Author: radhika <radhika at curoverse.com>
Date:   Wed May 10 12:47:57 2017 -0400

    10645: preload child crs and they containers

diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 84fc1f8..afdc91e 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -6,7 +6,7 @@ class ContainerWorkUnit < ProxyWorkUnit
     if @proxied.is_a?(ContainerRequest)
       container_uuid = get(:container_uuid)
       if container_uuid
-        @container = Container.where(uuid: container_uuid).first
+        @container = Container.find(container_uuid)
       end
     end
   end
diff --git a/apps/workbench/app/views/work_units/_component_detail.html.erb b/apps/workbench/app/views/work_units/_component_detail.html.erb
index 82cd42b..55abc75 100644
--- a/apps/workbench/app/views/work_units/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_units/_component_detail.html.erb
@@ -3,9 +3,28 @@
   collections_pdhs = collections.select {|x| !CollectionsHelper.match(x).nil?}.uniq.compact
   collections_uuids = collections - collections_pdhs
   preload_collections_for_objects collections_uuids if collections_uuids.any?
-  preload_for_pdhs collections_pdhs if collections_pdhs.any?
+  preload_links_for_objects collections_uuids if collections_uuids.any?
 
   preload_objects_for_dataclass(Repository, [current_obj.repository], :name) if current_obj.repository
+
+  # if container_X, preload mounted collections
+  if @object.is_a? Container or @object.is_a? ContainerRequest
+    # get any collections in mounts
+    mounts = current_obj.send(:mounts) if current_obj.respond_to?(:mounts)
+    input_obj = mounts.andand[:"/var/lib/cwl/cwl.input.json"].andand[:content]
+    if input_obj
+      input_obj.to_s.scan(/([0-9a-f]{32}\+\d+)/).each {|cs| collections_pdhs += cs}
+    end
+
+    command = current_obj.send(:command) if current_obj.respond_to?(:command)
+    if command
+      command.to_s.scan(/([0-9a-f]{32}\+\d+)/).each {|cs| collections_pdhs += cs}
+    end
+  end
+
+  collections_pdhs.compact.uniq
+  preload_for_pdhs collections_pdhs if collections_pdhs.any?
+  preload_links_for_objects collections_pdhs if collections_pdhs.any?
 %>
 
       <div class="container">
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..ea6920c 100644
--- a/apps/workbench/app/views/work_units/_show_status.html.erb
+++ b/apps/workbench/app/views/work_units/_show_status.html.erb
@@ -1,3 +1,16 @@
+<%
+    container_uuid = if @object.is_a?(Container) then @object.uuid else @object.container_uuid end
+    if container_uuid
+      reqs = ContainerRequest.where(requesting_container_uuid: container_uuid).results
+      child_crs = reqs.map(&:uuid).uniq
+      preload_objects_for_dataclass(ContainerRequest, child_crs)
+
+      child_cs = reqs.map(&:requesting_container_uuid).uniq
+      child_cs += reqs.map(&:container_uuid).uniq
+      preload_objects_for_dataclass(Container, child_cs)
+    end
+%>
+
 <div class="arv-log-refresh-control"
      data-load-throttle="86486400000" <%# 1001 nights %>
      ></div>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list