[ARVADOS] updated: a51e045712142d6bcfd0377eefa1e716925b0f68

Git user git at public.curoverse.com
Tue Oct 11 14:24:10 EDT 2016


Summary of changes:
 apps/workbench/app/controllers/application_controller.rb     | 11 ++++++++---
 apps/workbench/app/views/work_units/_show_component.html.erb | 11 ++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

       via  a51e045712142d6bcfd0377eefa1e716925b0f68 (commit)
      from  10db502ac06ae4566895cf2b5ffdf52db94181eb (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 a51e045712142d6bcfd0377eefa1e716925b0f68
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 11 14:22:30 2016 -0400

    10144: Preload children during (main) component display. The Job.where in pipeline_instance_work_unit is fetching all jobs even if they are not readable.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index d8dc852..3591199 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -526,16 +526,21 @@ class ApplicationController < ActionController::Base
     begin
       if not model_class
         @object = nil
+      elsif params[:uuid].nil? or params[:uuid].empty?
+        @object = nil
       elsif not params[:uuid].is_a?(String)
         @object = object_for_dataclass(model_class, params[:uuid])
-      elsif params[:uuid].empty?
-        @object = nil
       elsif (model_class != Link and
              resource_class_for_uuid(params[:uuid]) == Link)
         @name_link = Link.find(params[:uuid])
         @object = model_class.find(@name_link.head_uuid)
       else
-        @object = object_for_dataclass(model_class, params[:uuid])
+        if resource_class_for_uuid(params[:uuid]) == Collection
+          @object = model_class.find(params[:uuid])
+          load_preloaded_objects [@object]
+        else
+          @object = object_for_dataclass(model_class, params[:uuid])
+        end
       end
     rescue ArvadosApiClient::NotFoundException, ArvadosApiClient::NotLoggedInException, RuntimeError => error
       if error.is_a?(RuntimeError) and (error.message !~ /^argument to find\(/)
diff --git a/apps/workbench/app/views/work_units/_show_component.html.erb b/apps/workbench/app/views/work_units/_show_component.html.erb
index 08405b3..4feb292 100644
--- a/apps/workbench/app/views/work_units/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -39,7 +39,16 @@
 <%# Work unit children %>
 
 <%
-  load_preloaded_objects(wu.children.collect {|j| j})
+  uuids = wu.children.collect {|c| c.uuid}.compact
+  if uuids.any?
+    resource_class = resource_class_for_uuid(uuids.first, friendly_name: true)
+
+    start = 0; inc = 200
+    while start < uuids.length
+      preload_objects_for_dataclass resource_class, uuids[start, inc]
+      start += inc
+    end
+  end
 
   collections = wu.outputs.flatten.uniq
   collections << wu.log_collection if wu.log_collection

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list