How to clean all the foreman task and locked task

1.- First make su to postgres user
su -s /bin/bash - postgres 
2.-Execute psql
psql 
3.- connect to the foreman database
\c foreman; 
4.- Delete all the foreman task and foreman task locks
delete from foreman_tasks_tasks; 
delete from foreman_tasks_locks; 
5.- Quit from postgres and exit
\q 
exit 
6. Restart all the services
for s in {qpidd,pulp_celerybeat,pulp_resource_manager,pulp_workers,httpd}; do sudo service $s restart; done 


Update in todays foreman you can clean the task using the following command:

foreman-rake foreman_tasks:cleanup

Comments

  1. Just some advice, not to delete ALL of the tasks but only the ones that are in error and locked.

    su - postgres
    psql foreman
    delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = 'paused' and result = 'error');
    delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = 'stopped' and result = 'error');
    \q

    ReplyDelete
  2. Hi,
    Why don't use "foreman-rake foreman_tasks:cleanup" ?

    ReplyDelete

Post a Comment

Popular posts from this blog

How to restrict users to send only mail to the local domain in Zimbra

Hardening Script