[ARVADOS] updated: a06f0b3b73169a74151ddec1cf9a99eddd2edc4f

Git user git at public.curoverse.com
Thu Jul 14 16:32:50 EDT 2016


Summary of changes:
 .../app/controllers/work_units_controller.rb       | 27 ++++++++++------------
 apps/workbench/app/models/pipeline_instance.rb     |  2 +-
 2 files changed, 13 insertions(+), 16 deletions(-)

       via  a06f0b3b73169a74151ddec1cf9a99eddd2edc4f (commit)
      from  45fc3d3d557ed56b4e09d7ba254dc8add1211eed (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 a06f0b3b73169a74151ddec1cf9a99eddd2edc4f
Author: radhika <radhika at curoverse.com>
Date:   Thu Jul 14 16:31:55 2016 -0400

    9319: find_objects_for_index optimizations

diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index fbb0c1c..7cc095b 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -23,28 +23,25 @@ class WorkUnitsController < ApplicationController
   end
 
   def find_objects_for_index
-    @limit = 20
-
-    @filters = @next_page_filters || @filters || []
-
-    procs = {}
+    # If it's not the index rows partial display, just return
+    # The /index request will again be invoked to display the
+    # partial at which time, we will be using the objects found.
+    return if !params[:partial]
 
+    @limit = 20
+    @filters = @filters || []
     # get next page of pipeline_instances
-    filters = @filters + [%w(uuid is_a) + [%w(arvados#pipelineInstance)]]
+    filters = @filters + [["uuid", "is_a", ["arvados#pipelineInstance"]]]
     pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters)
-    pipelines.results.each { |pi| procs[pi] = pi.created_at }
 
     # get next page of jobs
-    filters = @filters + [%w(uuid is_a) + [%w(arvados#job)]]
+    filters = @filters + [["uuid", "is_a", ["arvados#job"]]]
     jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters)
-    jobs.results.each { |pi| procs[pi] = pi.created_at }
 
     # get next page of container_requests
-    filters = @filters + [%w(uuid is_a) + [%w(arvados#containerRequest)]]
+    filters = @filters + [["uuid", "is_a", ["arvados#containerRequest"]]]
     crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters)
-    crs.results.each { |c| procs[c] = c.created_at }
-
-    @objects = Hash[procs.sort_by {|key, value| value}].keys.reverse
+    @objects = (jobs.to_a + pipelines.to_a + crs.to_a).sort_by(&:created_at).reverse.first(@limit)
 
     @next_page_filters = @filters.reject do |attr,op,val|
       (attr == 'created_at') or (attr == 'uuid' and op == 'not in')
@@ -58,11 +55,11 @@ class WorkUnitsController < ApplicationController
         last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
       end
 
-      @next_page_filters += [['created_at', '<=', last_created_at]]
+      @next_page_filters += [['created_at', '<=', last_created_at.strftime("%Y-%m-%dT%H:%M:%S.%N%z")]]
       @next_page_filters += [['uuid', 'not in', last_uuids]]
       @next_page_href = url_for(partial: :all_processes_rows,
-                                limit: @limit,
                                 filters: @next_page_filters.to_json)
+      preload_links_for_objects(@objects.to_a)
     else
       @next_page_href = nil
     end
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index b51f07c..0541ce5 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -13,7 +13,7 @@ class PipelineInstance < ArvadosBase
       template = if lookup and lookup[self.pipeline_template_uuid]
                    lookup[self.pipeline_template_uuid]
                  else
-                   PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+                   PipelineTemplate.find(self.pipeline_template_uuid) if self.pipeline_template_uuid
                  end
       if template
         template.name

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list