[ARVADOS] updated: f40544f6523bf2d54b288a64af7cab7469741512
Git user
git at public.curoverse.com
Sat Sep 24 19:31:58 EDT 2016
Summary of changes:
services/api/lib/tasks/delete_old_container_logs.rake | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
via f40544f6523bf2d54b288a64af7cab7469741512 (commit)
from 89b46374d746fe785e3ba0088f0886caa17893db (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 f40544f6523bf2d54b288a64af7cab7469741512
Author: radhika <radhika at curoverse.com>
Date: Sat Sep 24 19:31:09 2016 -0400
9514: Use sql to issue delete sql without getting ids in batch.
diff --git a/services/api/lib/tasks/delete_old_container_logs.rake b/services/api/lib/tasks/delete_old_container_logs.rake
index 8c32331..3421fb8 100644
--- a/services/api/lib/tasks/delete_old_container_logs.rake
+++ b/services/api/lib/tasks/delete_old_container_logs.rake
@@ -5,13 +5,10 @@
namespace :db do
desc "Remove old container log entries from the logs table"
+
task delete_old_container_logs: :environment do
- Log.select("logs.id").
- joins("JOIN containers ON object_uuid = containers.uuid").
- where("event_type in ('stdout', 'stderr', 'arv-mount', 'crunch-run', 'crunchstat') AND containers.log IS NOT NULL AND containers.finished_at < :age",
- age: Rails.configuration.clean_container_log_rows_after.ago).
- find_in_batches do |old_log_ids|
- Log.where(id: old_log_ids.map(&:id)).delete_all
- end
+ delete_sql = "DELETE FROM logs WHERE id in (SELECT logs.id FROM logs JOIN containers ON logs.object_uuid = containers.uuid WHERE event_type IN ('stdout', 'stderr', 'arv-mount', 'crunch-run', 'crunchstat') AND containers.log IS NOT NULL AND containers.finished_at < '#{Rails.configuration.clean_container_log_rows_after.ago}')"
+
+ ActiveRecord::Base.connection.execute(delete_sql)
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list