[ARVADOS] created: da15fc09633adad5813a47558e879bded5f2b2d5
git at public.curoverse.com
git at public.curoverse.com
Thu Apr 23 12:40:19 EDT 2015
at da15fc09633adad5813a47558e879bded5f2b2d5 (commit)
commit da15fc09633adad5813a47558e879bded5f2b2d5
Author: Brett Smith <brett at curoverse.com>
Date: Thu Apr 23 12:40:14 2015 -0400
5554: Add Rake task to delete old job log records.
diff --git a/services/api/config/application.default.yml b/services/api/config/application.default.yml
index 0ea685a..a07a23f 100644
--- a/services/api/config/application.default.yml
+++ b/services/api/config/application.default.yml
@@ -275,3 +275,11 @@ common:
# Note you must separately configure the upstream web server or proxy to
# actually enforce the desired maximum request size on the server side.
max_request_size: 134217728
+
+ # When you run the db:delete_old_job_logs task, it will find jobs that
+ # have been finished for at least this many seconds, and delete their
+ # stderr logs from the logs table.
+ # If a single job in a pipeline runs longer than this, client applications
+ # like Workbench will lose the ability to display logs from prior jobs
+ # in the pipeline.
+ clean_job_log_rows_after: <%= 7.days %>
diff --git a/services/api/lib/tasks/delete_old_job_logs.rake b/services/api/lib/tasks/delete_old_job_logs.rake
new file mode 100644
index 0000000..a9f3480
--- /dev/null
+++ b/services/api/lib/tasks/delete_old_job_logs.rake
@@ -0,0 +1,13 @@
+namespace :db do
+ desc "Remove old job stderr entries from the logs table"
+ task delete_old_job_logs: :environment do
+ Log.select("logs.id").
+ joins("JOIN jobs ON object_uuid = jobs.uuid").
+ where("event_type = :etype AND jobs.log IS NOT NULL AND jobs.finished_at < :age",
+ etype: "stderr",
+ age: Rails.configuration.clean_job_log_rows_after.ago).
+ find_in_batches do |old_log_ids|
+ Log.where(id: old_log_ids.map(&:id)).delete_all
+ end
+ end
+end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list