[ARVADOS] created: 2.1.0-2492-gd58c2423e

Git user git at public.arvados.org
Mon May 16 20:27:10 UTC 2022


        at  d58c2423e8e038e4c47c2329299059978abc7fbf (commit)


commit d58c2423e8e038e4c47c2329299059978abc7fbf
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Mon May 16 16:22:30 2022 -0400

    19129: Select specific fields to speed up dashboard loading
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index f8c8079a1..7481575a6 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -912,7 +912,8 @@ class ApplicationController < ActionController::Base
       pipelines.results.each { |pi| procs[pi] = pi.created_at }
     end
 
-    crs = ContainerRequest.limit(lim).with_count("none").order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]])
+    crs = ContainerRequest.limit(lim).with_count("none").order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]]).select(
+      ["uuid", "name", "container_uuid", "output_uuid", "state", "created_at", "modified_at"])
     crs.results.each { |c| procs[c] = c.created_at }
 
     Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim)
@@ -1244,7 +1245,7 @@ class ApplicationController < ActionController::Base
 
   # helper method to preload objects for given dataclass and uuids
   helper_method :preload_objects_for_dataclass
-  def preload_objects_for_dataclass dataclass, uuids, by_attr=nil
+  def preload_objects_for_dataclass dataclass, uuids, by_attr=nil, select_fields=nil
     @objects_for ||= {}
 
     raise ArgumentError, 'Argument is not a data class' unless dataclass.is_a? Class
@@ -1269,7 +1270,7 @@ class ApplicationController < ActionController::Base
       end
     else
       key_prefix = "request_#{Thread.current.object_id}_#{dataclass.to_s}_"
-      dataclass.where(uuid: uuids).each do |obj|
+      dataclass.where(uuid: uuids).select(select_fields).each do |obj|
         @objects_for[obj.uuid] = obj
         if dataclass == Collection
           # The collecions#index defaults to "all attributes except manifest_text"
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index 6c58cd30f..f26d89780 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -8,7 +8,10 @@ SPDX-License-Identifier: AGPL-3.0 %>
   # preload container_uuids of any container requests
   recent_crs = recent_procs.map {|p| p if p.is_a?(ContainerRequest)}.compact.uniq
   recent_cr_containers = recent_crs.map {|cr| cr.container_uuid}.compact.uniq
-  preload_objects_for_dataclass(Container, recent_cr_containers) if recent_cr_containers.andand.any?
+  if recent_cr_containers.andand.any?
+    preload_objects_for_dataclass(Container, recent_cr_containers, nil,
+				["uuid", "started_at", "finished_at", "state", "runtime_status", "created_at", "modified_at"])
+  end
 
   wus = {}
   outputs = []

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list