[ARVADOS] created: 35c2572761bb060aa1c12f417f97aa9e1ccbe7eb

Git user git at public.curoverse.com
Mon Apr 24 11:48:09 EDT 2017


        at  35c2572761bb060aa1c12f417f97aa9e1ccbe7eb (commit)


commit 35c2572761bb060aa1c12f417f97aa9e1ccbe7eb
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Apr 21 15:17:46 2017 -0400

    11517: Use count=none when retrieving logs.

diff --git a/apps/workbench/app/controllers/keep_disks_controller.rb b/apps/workbench/app/controllers/keep_disks_controller.rb
index f57455b..bbf18e5 100644
--- a/apps/workbench/app/controllers/keep_disks_controller.rb
+++ b/apps/workbench/app/controllers/keep_disks_controller.rb
@@ -32,6 +32,7 @@ class KeepDisksController < ApplicationController
     histogram_log = Log.
       filter([[:event_type, '=', 'block-age-free-space-histogram']]).
       order(:created_at => :desc).
+      with_count('none').
       limit(1)
     histogram_log.each do |log_entry|
       # We expect this block to only execute at most once since we
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index d2fcbbb..1a1c5f8 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -102,6 +102,7 @@ class UsersController < ApplicationController
         filter([[:object_uuid, '=', u.uuid],
                 [:event_type, '=', 'user-storage-report']]).
         order(:created_at => :desc).
+        with_count('none').
         limit(1)
       storage_log.each do |log_entry|
         # We expect this block to only execute once since we specified limit(1)
diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index 6250daa..5d6a4c9 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -144,6 +144,10 @@ class ArvadosBase < ActiveRecord::Base
     ArvadosResourceList.new(self).select(*args)
   end
 
+  def self.with_count(*args)
+    ArvadosResourceList.new(self).with_count(*args)
+  end
+
   def self.distinct(*args)
     ArvadosResourceList.new(self).distinct(*args)
   end
diff --git a/apps/workbench/app/models/arvados_resource_list.rb b/apps/workbench/app/models/arvados_resource_list.rb
index 2706970..e56d198 100644
--- a/apps/workbench/app/models/arvados_resource_list.rb
+++ b/apps/workbench/app/models/arvados_resource_list.rb
@@ -84,6 +84,11 @@ class ArvadosResourceList
     self
   end
 
+  def with_count(count_param='exact')
+    @count = count_param
+    self
+  end
+
   def fetch_multiple_pages(f)
     @fetch_multiple_pages = f
     self
@@ -178,6 +183,7 @@ class ArvadosResourceList
     api_params = {
       _method: 'GET'
     }
+    api_params[:count] = @count if @count
     api_params[:where] = @cond if @cond
     api_params[:eager] = '1' if @eager
     api_params[:select] = @select if @select
diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index 346aef3..128440d 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -43,7 +43,7 @@ class Job < ArvadosBase
   end
 
   def stderr_log_query(limit=nil)
-    query = Log.where(object_uuid: self.uuid).order("created_at DESC")
+    query = Log.where(object_uuid: self.uuid).order("created_at DESC").with_count('none')
     query = query.limit(limit) if limit
     query
   end
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index b6e0ef1..1c14eff 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -103,9 +103,10 @@ class PipelineInstance < ArvadosBase
 
   def stderr_log_query(limit=nil)
     query = Log.
-      where(event_type: "stderr",
-            object_uuid: stderr_log_object_uuids).
-      order("id DESC")
+            with_count('none').
+            where(event_type: "stderr",
+                  object_uuid: stderr_log_object_uuids).
+            order("created_at DESC")
     unless limit.nil?
       query = query.limit(limit)
     end
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index 4230484..b7cc6a0 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -309,6 +309,7 @@ class ProxyWorkUnit < WorkUnit
     Log.where(object_uuid: log_object_uuids).
       order("created_at DESC").
       limit(limit).
+      with_count('none').
       select { |log| log.properties[:text].is_a? String }.
       reverse.
       flat_map { |log| log.properties[:text].split("\n") }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list