Bug 1384548

Summary: [RFE] cronjob to clear old tasks
Product: Red Hat Satellite Reporter: Chris Duryee <cduryee>
Component: Tasks PluginAssignee: Martin Bacovsky <mbacovsk>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: bbuckingham, brubisch, cduryee, dcaplan, dmoessne, ehelms, inecas, jcallaha, ktordeur, lzap, mmccune, mmello, oshtaier, pondrejk, rvdwees
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: foreman-tasks-0.9.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 12:36:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1122832, 1479962    

Description Chris Duryee 2016-10-13 14:08:17 UTC
Description of problem:

Satellite 6.2 comes with foreman_tasks:cleanup, a job that will clear old tasks. This works well and helps significantly with issues like slow dashboard loading due to repo sync lookup times, but users need to remember to run the cleanup periodically.

Ideally, if the job was run via cron (similar to orphan task cleanup), users would not hit as many issues related to large numbers of old tasks.

Version-Release number of selected component (if applicable): 6.2.2

Comment 2 Ivan Necas 2016-10-13 18:38:09 UTC
Created redmine issue http://projects.theforeman.org/issues/16922 from this bug

Comment 5 Satellite Program 2017-03-15 10:10:03 UTC
Upstream bug assigned to mbacovsk

Comment 6 Lukas Zapletal 2017-07-20 13:15:37 UTC
Please make sure task also deletes all tasks even those which are in error state. I cannot get it working, this does not delete tasks in stopped-error state:

ALL_STATES="pending,scheduled,planning,planned,running,paused,stopped,cancelled"
/usr/sbin/foreman-rake foreman_tasks:cleanup TASK_SEARCH='label != a_label' AFTER='30d' STATES="$ALL_STATES

Comment 7 Eric Helms 2017-07-27 19:38:37 UTC
I think this can be a risky thing to do automatically without user opt-in as this does destroy data. Data a user could be using for auditing, tracking, trends. I've commented on the upstream PR [1] but wanted to include strong consideration for this before we go willy-nilly deleting users data out from under them.

https://github.com/theforeman/foreman-tasks/pull/247#issuecomment-318464803

Comment 8 Chris Duryee 2017-08-08 19:48:43 UTC
I updated the PR, not sure if here or there is a better place for convo but I don't want it in two places.

Comment 10 Adam Ruzicka 2017-08-22 10:19:55 UTC
*** Bug 1429660 has been marked as a duplicate of this bug. ***

Comment 11 Satellite Program 2017-09-19 12:10:24 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16922 has been resolved.

Comment 12 Ivan Necas 2017-09-20 15:44:48 UTC
Moving to assigned, as the original issue was moved back to ready for testing

Comment 13 Satellite Program 2017-09-21 10:10:20 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16922 has been resolved.

Comment 22 errata-xmlrpc 2018-02-21 12:36:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336