15583: Adds more with_counts to queries
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Wed, 28 Aug 2019 13:26:50 +0000 (09:26 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Wed, 11 Sep 2019 19:29:55 +0000 (15:29 -0400)
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

18 files changed:
apps/workbench/app/controllers/actions_controller.rb
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/controllers/container_requests_controller.rb
apps/workbench/app/controllers/groups_controller.rb
apps/workbench/app/controllers/jobs_controller.rb
apps/workbench/app/controllers/pipeline_instances_controller.rb
apps/workbench/app/controllers/projects_controller.rb
apps/workbench/app/controllers/repositories_controller.rb
apps/workbench/app/controllers/trash_items_controller.rb
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/controllers/virtual_machines_controller.rb
apps/workbench/app/controllers/work_unit_templates_controller.rb
apps/workbench/app/controllers/work_units_controller.rb
apps/workbench/app/helpers/pipeline_instances_helper.rb
apps/workbench/app/models/container_work_unit.rb
apps/workbench/app/models/pipeline_instance.rb
apps/workbench/app/models/pipeline_instance_work_unit.rb

index b1bbb122670dcb6b11aac21d915f26174851aed9..f769cd33ab47c5f198c12da6d40f536e39f14d4c 100644 (file)
@@ -86,7 +86,7 @@ class ActionsController < ApplicationController
               end
             end
             if resource_class == Collection
-              dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).first.manifest_text
+              dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).with_count("none").first.manifest_text
             end
           when :move
             dst = src
@@ -122,7 +122,7 @@ class ActionsController < ApplicationController
     uuids, source_paths = selected_collection_files params
 
     new_coll = Arv::Collection.new
-    Collection.where(uuid: uuids.uniq).
+    Collection.where(uuid: uuids.uniq).with_count("none").
         select([:uuid, :manifest_text]).each do |coll|
       src_coll = Arv::Collection.new(coll.manifest_text)
       src_pathlist = source_paths[coll.uuid]
index ab962711b98100105d2f2edc22172c2f20224308..a484fb9100f9d7a8895a008f8e03fa32efd92849 100644 (file)
@@ -497,7 +497,7 @@ class ApplicationController < ActionController::Base
   def is_starred
     links = Link.where(tail_uuid: current_user.uuid,
                head_uuid: @object.uuid,
-               link_class: 'star')
+               link_class: 'star').with_count("none")
 
     return links.andand.any?
   end
@@ -859,7 +859,7 @@ class ApplicationController < ActionController::Base
   helper_method :recent_jobs_and_pipelines
   def recent_jobs_and_pipelines
     (Job.limit(10) |
-     PipelineInstance.limit(10)).
+     PipelineInstance.limit(10).with_count("none")).
       sort_by do |x|
       (x.finished_at || x.started_at rescue nil) || x.modified_at || x.created_at
     end.reverse
@@ -867,7 +867,7 @@ class ApplicationController < ActionController::Base
 
   helper_method :running_pipelines
   def running_pipelines
-    pi = PipelineInstance.order(["started_at asc", "created_at asc"]).filter([["state", "in", ["RunningOnServer", "RunningOnClient"]]])
+    pi = PipelineInstance.order(["started_at asc", "created_at asc"]).with_count("none").filter([["state", "in", ["RunningOnServer", "RunningOnClient"]]])
     jobs = {}
     pi.each do |pl|
       pl.components.each do |k,v|
@@ -878,7 +878,7 @@ class ApplicationController < ActionController::Base
     end
 
     if jobs.keys.any?
-      Job.filter([["uuid", "in", jobs.keys]]).each do |j|
+      Job.filter([["uuid", "in", jobs.keys]]).with_count("none").each do |j|
         jobs[j[:uuid]] = j
       end
 
@@ -901,11 +901,11 @@ class ApplicationController < ActionController::Base
     procs = {}
     if PipelineInstance.api_exists?(:index)
       cols = %w(uuid owner_uuid created_at modified_at pipeline_template_uuid name state started_at finished_at)
-      pipelines = PipelineInstance.select(cols).limit(lim).order(["created_at desc"])
+      pipelines = PipelineInstance.select(cols).limit(lim).order(["created_at desc"]).with_count("none")
       pipelines.results.each { |pi| procs[pi] = pi.created_at }
     end
 
-    crs = ContainerRequest.limit(lim).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]])
     crs.results.each { |c| procs[c] = c.created_at }
 
     Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim)
@@ -913,9 +913,9 @@ class ApplicationController < ActionController::Base
 
   helper_method :recent_collections
   def recent_collections lim
-    c = Collection.limit(lim).order(["modified_at desc"]).results
+    c = Collection.limit(lim).with_count("none").order(["modified_at desc"]).results
     own = {}
-    Group.filter([["uuid", "in", c.map(&:owner_uuid)]]).each do |g|
+    Group.filter([["uuid", "in", c.map(&:owner_uuid)]]).with_count("none").each do |g|
       own[g[:uuid]] = g
     end
     {collections: c, owners: own}
@@ -926,9 +926,9 @@ class ApplicationController < ActionController::Base
     return if @starred_projects
     links = Link.filter([['tail_uuid', '=', user.uuid],
                          ['link_class', '=', 'star'],
-                         ['head_uuid', 'is_a', 'arvados#group']]).select(%w(head_uuid))
+                         ['head_uuid', 'is_a', 'arvados#group']]).with_count("none").select(%w(head_uuid))
     uuids = links.collect { |x| x.head_uuid }
-    starred_projects = Group.filter([['uuid', 'in', uuids]]).order('name')
+    starred_projects = Group.filter([['uuid', 'in', uuids]]).order('name').with_count("none")
     @starred_projects = starred_projects.results
   end
 
@@ -1081,7 +1081,7 @@ class ApplicationController < ActionController::Base
     end
 
     # TODO: make sure we get every page of results from API server
-    Link.filter([['head_uuid', 'in', uuids]]).each do |link|
+    Link.filter([['head_uuid', 'in', uuids]]).with_count("none").each do |link|
       @all_links_for[link.head_uuid] << link
     end
     @all_links_for
@@ -1134,7 +1134,7 @@ class ApplicationController < ActionController::Base
     end
 
     # TODO: make sure we get every page of results from API server
-    Collection.where(uuid: uuids).each do |collection|
+    Collection.where(uuid: uuids).with_count("none").each do |collection|
       @all_collections_for[collection.uuid] << collection
     end
     @all_collections_for
@@ -1184,7 +1184,7 @@ class ApplicationController < ActionController::Base
     end
 
     # TODO: make sure we get every page of results from API server
-    Collection.where(uuid: uuids).each do |collection|
+    Collection.where(uuid: uuids).with_count("none").each do |collection|
       @all_log_collections_for[collection.uuid] << collection
     end
     @all_log_collections_for
@@ -1217,7 +1217,7 @@ class ApplicationController < ActionController::Base
       @all_pdhs_for[x] = []
     end
 
-    Collection.select(%w(portable_data_hash)).where(portable_data_hash: pdhs).distinct().each do |collection|
+    Collection.select(%w(portable_data_hash)).where(portable_data_hash: pdhs).distinct().with_count("none").each do |collection|
       @all_pdhs_for[collection.portable_data_hash] << collection
     end
     @all_pdhs_for
@@ -1288,7 +1288,7 @@ class ApplicationController < ActionController::Base
     end
 
     unless link_uuids.empty?
-      Link.select([:head_uuid]).where(uuid: link_uuids).each do |link|
+      Link.select([:head_uuid]).where(uuid: link_uuids).with_count("none").each do |link|
         if ArvadosBase::resource_class_for_uuid(link.head_uuid) == Collection
           coll_ids << link.head_uuid
         end
@@ -1311,7 +1311,7 @@ class ApplicationController < ActionController::Base
     end
 
     unless pdhs.empty?
-      Collection.where(portable_data_hash: pdhs.uniq).
+      Collection.where(portable_data_hash: pdhs.uniq).with_count("none").
           select([:uuid, :portable_data_hash]).each do |coll|
         unless source_paths[coll.portable_data_hash].empty?
           uuids << coll.uuid
index 8d7e6ee332af5e3cf53dac674e6185626f43d413..64ae3521332591a419ccc4fe4f2a3dc4e98f2aa3 100644 (file)
@@ -36,7 +36,7 @@ class CollectionsController < ApplicationController
                                    ['link_class', '=', 'resources'],
                                    ['name', '=', 'wants'],
                                    ['tail_uuid', '=', current_user.uuid],
-                                   ['head_uuid', '=', @object.uuid]])
+                                   ['head_uuid', '=', @object.uuid]]).with_count("none")
       logger.debug persist_links.inspect
     else
       return unprocessable "Invalid value #{value.inspect}"
@@ -65,7 +65,7 @@ class CollectionsController < ApplicationController
     @select ||= Collection.columns.map(&:name)
     base_search = Collection.select(@select)
     if params[:search].andand.length.andand > 0
-      tags = Link.where(any: ['contains', params[:search]])
+      tags = Link.where(any: ['contains', params[:search]]).with_count("none")
       @objects = (base_search.where(uuid: tags.collect(&:head_uuid)) |
                       base_search.where(any: ['contains', params[:search]])).
         uniq { |c| c.uuid }
@@ -84,7 +84,7 @@ class CollectionsController < ApplicationController
 
       @objects = base_search.limit(limit).offset(offset)
     end
-    @links = Link.where(head_uuid: @objects.collect(&:uuid))
+    @links = Link.where(head_uuid: @objects.collect(&:uuid)).with_count("none")
     @collection_info = {}
     @objects.each do |c|
       @collection_info[c.uuid] = {
@@ -196,19 +196,19 @@ class CollectionsController < ApplicationController
       else
         if Job.api_exists?(:index)
           jobs_with = lambda do |conds|
-            Job.limit(RELATION_LIMIT).where(conds)
+            Job.limit(RELATION_LIMIT).with_count("none").where(conds)
               .results.sort_by { |j| j.finished_at || j.created_at }
           end
           @output_of = jobs_with.call(output: @object.portable_data_hash)
           @log_of = jobs_with.call(log: @object.portable_data_hash)
         end
 
-        @project_links = Link.limit(RELATION_LIMIT).order("modified_at DESC")
+        @project_links = Link.limit(RELATION_LIMIT).with_count("none").order("modified_at DESC")
           .where(head_uuid: @object.uuid, link_class: 'name').results
-        project_hash = Group.where(uuid: @project_links.map(&:tail_uuid)).to_hash
+        project_hash = Group.where(uuid: @project_links.map(&:tail_uuid)).with_count("none").to_hash
         @projects = project_hash.values
 
-        @permissions = Link.limit(RELATION_LIMIT).order("modified_at DESC")
+        @permissions = Link.limit(RELATION_LIMIT).with_count("none").order("modified_at DESC")
           .where(head_uuid: @object.uuid, link_class: 'permission',
                  name: 'can_read').results
         @search_sharing = search_scopes
index d5627076f5e1d0b0dee23531fbe884dacb16aa64..0a1af3619300cef01f8db770efc9ebc08cde09e9 100644 (file)
@@ -20,7 +20,7 @@ class ContainerRequestsController < ApplicationController
 
     # Search for child CRs
     if cr[:container_uuid]
-      child_crs = ContainerRequest.where(requesting_container_uuid: cr[:container_uuid])
+      child_crs = ContainerRequest.where(requesting_container_uuid: cr[:container_uuid]).with_count("none")
 
       child_crs.each do |child|
         nodes[child[:uuid]] = child
@@ -35,14 +35,14 @@ class ContainerRequestsController < ApplicationController
 
     # Batch requests to get all related collections
     # First fetch output collections by UUID.
-    Collection.filter([['uuid', 'in', col_uuids.uniq]]).each do |c|
+    Collection.filter([['uuid', 'in', col_uuids.uniq]]).with_count("none").each do |c|
       output_cols[c[:uuid]] = c
       output_pdhs << c[:portable_data_hash]
     end
     # Then, get only input collections by PDH. There could be more than one collection
     # per PDH: the number of collections is used on the collection node label.
     Collection.filter(
-      [['portable_data_hash', 'in', col_pdhs - output_pdhs]]).each do |c|
+      [['portable_data_hash', 'in', col_pdhs - output_pdhs]]).with_count("none").each do |c|
       if input_cols[c[:portable_data_hash]]
         input_cols[c[:portable_data_hash]] << c
       else
@@ -78,7 +78,7 @@ class ContainerRequestsController < ApplicationController
 
   def cancel
     if @object.container_uuid
-      c = Container.select(['state']).where(uuid: @object.container_uuid).first
+      c = Container.select(['state']).where(uuid: @object.container_uuid).with_count("none").first
       if c && c.state != 'Running'
         # If the container hasn't started yet, setting priority=0
         # leaves our request in "Committed" state and doesn't cancel
index aa78feb9a06f821e1390ab7fbea062d22b497410..5da55be0b5d69a10e5519ac710822ba297aca1ab 100644 (file)
@@ -6,8 +6,8 @@ class GroupsController < ApplicationController
   def index
     @groups = Group.filter [['group_class', '!=', 'project']]
     @group_uuids = @groups.collect &:uuid
-    @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids
-    @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids
+    @links_from = Link.where(link_class: 'permission', tail_uuid: @group_uuids).with_count("none")
+    @links_to = Link.where(link_class: 'permission', head_uuid: @group_uuids).with_count("none")
     render_index
   end
 
index e38d3ba87b3e40e6df08e4d6150a2a3c392220a7..fd5e208d6c4bcdc8f904a1481a8649f8ea0f4e0d 100644 (file)
@@ -24,11 +24,11 @@ class JobsController < ApplicationController
       nodes[j[:script_version]] = {:uuid => j[:script_version]}
     end
 
-    Collection.where(uuid: collections).each do |c|
+    Collection.where(uuid: collections).with_count("none").each do |c|
       nodes[c[:portable_data_hash]] = c
     end
 
-    Collection.where(portable_data_hash: hashes).each do |c|
+    Collection.where(portable_data_hash: hashes).with_count("none").each do |c|
       nodes[c[:portable_data_hash]] = c
     end
 
index 26a9f85d4e4e890b85ab722151737afe12d2dd12..27719fde13de5087231188515f3e2ed5e72913d8 100644 (file)
@@ -134,7 +134,7 @@ class PipelineInstancesController < ApplicationController
 
       jobs = jobs.compact.uniq
       if jobs.any?
-        Job.where(uuid: jobs).each do |j|
+        Job.where(uuid: jobs).with_count("none").each do |j|
           job_uuid = j.uuid
 
           provenance[job_uuid] = j
@@ -158,7 +158,7 @@ class PipelineInstancesController < ApplicationController
 
       hashes = hashes.compact.uniq
       if hashes.any?
-        Collection.where(portable_data_hash: hashes).each do |c|
+        Collection.where(portable_data_hash: hashes).with_count("none").each do |c|
           hash_uuid = c.portable_data_hash
           provenance[hash_uuid] = c
           pips[hash_uuid] = 0 unless pips[hash_uuid] != nil
@@ -168,7 +168,7 @@ class PipelineInstancesController < ApplicationController
 
       collections = collections.compact.uniq
       if collections.any?
-        Collection.where(uuid: collections).each do |c|
+        Collection.where(uuid: collections).with_count("none").each do |c|
           collection_uuid = c.uuid
           provenance[collection_uuid] = c
           pips[collection_uuid] = 0 unless pips[collection_uuid] != nil
index cc657cbad92406d9887eb5f0a2173415aa8ff51e..6108ac687cd9ae2ed1de9ff6feb5cab3e0aa9543 100644 (file)
@@ -164,7 +164,7 @@ class ProjectsController < ApplicationController
 
   def destroy
     while (objects = Link.filter([['owner_uuid','=',@object.uuid],
-                                  ['tail_uuid','=',@object.uuid]])).any?
+                                  ['tail_uuid','=',@object.uuid]]).with_count("none")).any?
       objects.each do |object|
         object.destroy
       end
index 6ef541ebab23a23159d834ef117692812daa5f9e..953ee1dd2190ee02b7a5a651176ea8a162dbc928 100644 (file)
@@ -50,7 +50,7 @@ class RepositoriesController < ApplicationController
 
     if !owner_filter.andand.any?
       filters = @filters + [["owner_uuid", "=", current_user.uuid]]
-      my_repos = Repository.all.order("name ASC").limit(limit).offset(offset).filter(filters).results
+      my_repos = Repository.all.order("name ASC").limit(limit).with_count("none").offset(offset).filter(filters).results
     else      # done fetching all owned repositories
       my_repos = []
     end
@@ -64,7 +64,7 @@ class RepositoriesController < ApplicationController
     end
 
     filters = @filters + [["owner_uuid", "!=", current_user.uuid]]
-    other_repos = Repository.all.order("name ASC").limit(limit).offset(offset).filter(filters).results
+    other_repos = Repository.all.order("name ASC").limit(limit).with_count("none").offset(offset).filter(filters).results
 
     @objects = (my_repos + other_repos).first(limit)
   end
index 7d6e1431ce2f8f26c2a569d4702a14de1d02abe5..12ef20aa664a337998c1fc5980cea350ece1e982 100644 (file)
@@ -78,10 +78,10 @@ class TrashItemsController < ApplicationController
         base_search = base_search.filter([["modified_at", "<=", last_mod_at], ["uuid", "not in", last_uuids]])
       end
 
-      base_search = base_search.include_trash(true).limit(limit).offset(offset)
+      base_search = base_search.include_trash(true).limit(limit).with_count("none").offset(offset)
 
       if params[:filters].andand.length.andand > 0
-        tags = Link.filter(params[:filters])
+        tags = Link.filter(params[:filters]).with_count("none")
         tagged = []
         if tags.results.length > 0
           tagged = query_on.include_trash(true).where(uuid: tags.collect(&:head_uuid))
@@ -95,14 +95,14 @@ class TrashItemsController < ApplicationController
         owner_uuids = @objects.collect(&:owner_uuid).uniq
         @owners = {}
         @not_trashed = {}
-        Group.filter([["uuid", "in", owner_uuids]]).include_trash(true).each do |grp|
+        Group.filter([["uuid", "in", owner_uuids]]).with_count("none").include_trash(true).each do |grp|
           @owners[grp.uuid] = grp
         end
-        User.filter([["uuid", "in", owner_uuids]]).include_trash(true).each do |grp|
+        User.filter([["uuid", "in", owner_uuids]]).with_count("none").include_trash(true).each do |grp|
           @owners[grp.uuid] = grp
           @not_trashed[grp.uuid] = true
         end
-        Group.filter([["uuid", "in", owner_uuids]]).select([:uuid]).each do |grp|
+        Group.filter([["uuid", "in", owner_uuids]]).with_count("none").select([:uuid]).each do |grp|
           @not_trashed[grp.uuid] = true
         end
       else
index 0e86575b2ecdab360993aedec8db977b6fb64816..ed5ae282dcfbe335bcaafb7a22ffc24fed3f5a40 100644 (file)
@@ -43,7 +43,7 @@ class UsersController < ApplicationController
 
   def activity
     @breadcrumb_page_name = nil
-    @users = User.limit(params[:limit])
+    @users = User.limit(params[:limit]).with_count("none")
     @user_activity = {}
     @activity = {
       logins: {},
@@ -64,13 +64,13 @@ class UsersController < ApplicationController
         filter([[:event_type, '=', 'login'],
                 [:object_kind, '=', 'arvados#user'],
                 [:created_at, '>=', threshold_start],
-                [:created_at, '<', threshold_end]])
+                [:created_at, '<', threshold_end]]).with_count("none")
       @activity[:jobs][span] = Job.select(%w(uuid modified_by_user_uuid)).
         filter([[:created_at, '>=', threshold_start],
-                [:created_at, '<', threshold_end]])
+                [:created_at, '<', threshold_end]]).with_count("none")
       @activity[:pipeline_instances][span] = PipelineInstance.select(%w(uuid modified_by_user_uuid)).
         filter([[:created_at, '>=', threshold_start],
-                [:created_at, '<', threshold_end]])
+                [:created_at, '<', threshold_end]]).with_count("none")
       @activity.each do |type, act|
         records = act[span]
         @users.each do |u|
@@ -96,7 +96,7 @@ class UsersController < ApplicationController
 
   def storage
     @breadcrumb_page_name = nil
-    @users = User.limit(params[:limit])
+    @users = User.limit(params[:limit]).with_count("none")
     @user_storage = {}
     total_storage = {}
     @log_date = {}
@@ -170,7 +170,7 @@ class UsersController < ApplicationController
     end
 
     Link.filter([['head_uuid', 'in', collection_uuids],
-                             ['link_class', 'in', ['tag', 'resources']]]).
+                             ['link_class', 'in', ['tag', 'resources']]]).with_count("none")
       each do |link|
       case link.link_class
       when 'tag'
@@ -267,14 +267,14 @@ class UsersController < ApplicationController
     @my_vm_logins = {}
     Link.where(tail_uuid: @object.uuid,
                link_class: 'permission',
-               name: 'can_login').
+               name: 'can_login').with_count("none").
           each do |perm_link|
             if perm_link.properties.andand[:username]
               @my_vm_logins[perm_link.head_uuid] ||= []
               @my_vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
             end
           end
-    @my_virtual_machines = VirtualMachine.where(uuid: @my_vm_logins.keys)
+    @my_virtual_machines = VirtualMachine.where(uuid: @my_vm_logins.keys).with_count("none")
   end
 
   def ssh_keys
@@ -338,7 +338,7 @@ class UsersController < ApplicationController
     oid_login_perms = Link.where(tail_uuid: user.email,
                                    head_kind: 'arvados#user',
                                    link_class: 'permission',
-                                   name: 'can_login')
+                                   name: 'can_login').with_count("none")
 
     if oid_login_perms.any?
       prefix_properties = oid_login_perms.first.properties
@@ -349,10 +349,10 @@ class UsersController < ApplicationController
     repo_perms = Link.where(tail_uuid: user.uuid,
                             head_kind: 'arvados#repository',
                             link_class: 'permission',
-                            name: 'can_write')
+                            name: 'can_write').with_count("none")
     if repo_perms.any?
       repo_uuid = repo_perms.first.head_uuid
-      repos = Repository.where(head_uuid: repo_uuid)
+      repos = Repository.where(head_uuid: repo_uuid).with_count("none")
       if repos.any?
         repo_name = repos.first.name
         current_selections[:repo_name] = repo_name
@@ -363,7 +363,7 @@ class UsersController < ApplicationController
     vm_login_perms = Link.where(tail_uuid: user.uuid,
                               head_kind: 'arvados#virtualMachine',
                               link_class: 'permission',
-                              name: 'can_login')
+                              name: 'can_login').with_count("none")
     if vm_login_perms.any?
       vm_perm = vm_login_perms.first
       vm_uuid = vm_perm.head_uuid
index 19763b926c78077b97de261d49714d37c0c6b7bb..785a70303840412a1e2edc6d56135735120d8629 100644 (file)
@@ -10,7 +10,7 @@ class VirtualMachinesController < ApplicationController
       Link.where(tail_uuid: current_user.uuid,
                  head_uuid: @objects.collect(&:uuid),
                  link_class: 'permission',
-                 name: 'can_login').
+                 name: 'can_login').with_count("none").
         each do |perm_link|
         if perm_link.properties.andand[:username]
           @vm_logins[perm_link.head_uuid] ||= []
index 1dba520a7a8bd69cc415929608c0bcc34ccce0d5..0376590a556d49bd34569828ce7d4ab1e8f9065f 100644 (file)
@@ -12,12 +12,12 @@ class WorkUnitTemplatesController < ApplicationController
     # get next page of pipeline_templates
     if PipelineTemplate.api_exists?(:index)
       filters = @filters + [["uuid", "is_a", ["arvados#pipelineTemplate"]]]
-      pipelines = PipelineTemplate.limit(@limit).order(["created_at desc"]).filter(filters)
+      pipelines = PipelineTemplate.limit(@limit).with_count("none").order(["created_at desc"]).filter(filters)
     end
 
     # get next page of workflows
     filters = @filters + [["uuid", "is_a", ["arvados#workflow"]]]
-    workflows = Workflow.limit(@limit).order(["created_at desc"]).filter(filters)
+    workflows = Workflow.limit(@limit).order(["created_at desc"]).with_count("none").filter(filters)
 
     @objects = (pipelines.to_a + workflows.to_a).sort_by(&:created_at).reverse.first(@limit)
 
index 0f0033ce4965663ef76a7f2e479d8e38d7642dfb..dc0def71bfbb0a52ff565443d9d4ac17fed0723e 100644 (file)
@@ -23,14 +23,14 @@ class WorkUnitsController < ApplicationController
     # get next page of pipeline_instances
     if PipelineInstance.api_exists?(:index)
       filters = @filters + [["uuid", "is_a", ["arvados#pipelineInstance"]]]
-      pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters)
+      pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters).with_count("none")
     end
 
     if params[:show_children]
       # get next page of jobs
       if Job.api_exists?(:index)
         filters = @filters + [["uuid", "is_a", ["arvados#job"]]]
-        jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters)
+        jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters).with_count("none")
       end
     end
 
@@ -39,7 +39,7 @@ class WorkUnitsController < ApplicationController
     if !params[:show_children]
      filters << ["requesting_container_uuid", "=", nil]
     end
-    crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters)
+    crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters).with_count("none")
     @objects = (jobs.to_a + pipelines.to_a + crs.to_a).sort_by(&:created_at).reverse.first(@limit)
 
     if @objects.any?
index 214237522635d1e0b1e628c1f353ba2d2f736d7a..cbff77b937468a11994f39d3f1b6b6e06d2b64af 100644 (file)
@@ -92,7 +92,7 @@ module PipelineInstancesHelper
       c[:job][:uuid] if c.is_a?(Hash) and c[:job].is_a?(Hash)
     }.compact
     job = {}
-    Job.where(uuid: jobuuids).each do |j|
+    Job.where(uuid: jobuuids).with_count("none").each do |j|
       job[j[:uuid]] = j
     end
 
index ef20a7f8f49cfd7ed72f7ff9c51774ca36ddaa74..3f26e72d16b5ba03a135eaeff8631aa63e456ef2 100644 (file)
@@ -24,11 +24,11 @@ class ContainerWorkUnit < ProxyWorkUnit
     container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
     if container_uuid
       cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts secret_mounts runtime_token)
-      my_children = @child_proxies || 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).with_count("none").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 = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).with_count("none").results if my_child_containers.any?
       reqs.each {|cr| grandchildren[cr.requesting_container_uuid] << cr} if reqs
 
       my_children.each do |cr|
index dd2cc0ab77e20d6ad45e78871f174bec3936acb5..d481f41c7eab37b0f8ba0192ba9e17438fd3803e 100644 (file)
@@ -127,10 +127,10 @@ class PipelineInstance < ArvadosBase
       Keep::Locator.parse(loc_s)
     end
     if log_pdhs.any? and
-        Collection.where(portable_data_hash: log_pdhs).limit(1).results.any?
+        Collection.where(portable_data_hash: log_pdhs).limit(1).with_count("none").results.any?
       true
     elsif log_uuids.any? and
-        Collection.where(uuid: log_uuids).limit(1).results.any?
+        Collection.where(uuid: log_uuids).limit(1).with_count("none").results.any?
       true
     else
       stderr_log_query(1).results.any?
index a9bc9cfb5941d3ee559d6dab0b4131df93f2d48d..1d75f584334ee944837183f27f6efc9f9d66c68d 100644 (file)
@@ -9,7 +9,7 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit
     items = []
 
     jobs = {}
-    results = Job.where(uuid: @proxied.job_ids.values).results
+    results = Job.where(uuid: @proxied.job_ids.values).with_count("none").results
     results.each do |j|
       jobs[j.uuid] = j
     end