Project

General

Profile

Actions

Feature #8144

closed

Add a purge mechanism for tasks

Added by Romain Vrignaud about 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I'm currently using foreman-tasks to process facts (from foreman_chef) uploading (and hopefully reports one day).
It creates a lot of tasks per hour and I don't see any point to keep in db all that tasks.
IMHO it would be very useful to have a purge mechanism : it may have to run as a cron task ?

Thoughts ?

Actions #1

Updated by Ivan Necas about 10 years ago

Thank you for reporting. I agree we need a purge mechanism to be there. Since the foreman-tasks
can have an auditing value as well (especially once they will get wider usage - and they don't
have to be used only for async tasks, but for audit as well), I would like to make it more
configurable. Also, some task info are more valuable than the others. What about this suggestion:

1. There are two purge mechanisms: reduce (would keep just subset of the original data, for audit purposes) and delete
2. It's possible to export the data to disk for archiving.
3. it would be possible to configure a combination of [priority, scoped-search filter + age, purge mechanism, export (true, false)]
and a task (either a rake task, or some foreman-task itself) would periodically clean the data.

Actions #2

Updated by Ivan Necas over 9 years ago

  • Status changed from New to Assigned
Actions #3

Updated by Ivan Necas over 9 years ago

  • Assignee set to Ivan Necas
Actions #4

Updated by The Foreman Bot over 9 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-tasks/pull/100 added
  • Pull request deleted ()
Actions #5

Updated by Ivan Necas over 9 years ago

This adds a rake task for cleaning tasks based on filter and age. Example:

# delete all the tasks of
rake foreman_tasks:clean FILTER='label = "Actions::Foreman::Host::ImportFacts"'

# delete all tasks older than 30 days
rake foreman_tasks:clean BEFORE=2592000

# delete all tasks older than 10 days (the default BEFORE value)
rake foreman_tasks:clean

It doesn't touch tasks that are in other than running or paused state. Opinions?

Actions #6

Updated by Marek Hulán over 9 years ago

Visually the PR looks very nice, I didn't tested though. One thing that I don't see is the export feature (point 3. in your comment) but we may open separate issue for this as we may think of adding also a way to reimport.

Actions #7

Updated by Ivan Necas over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF