How to delete task from scheduler

Hi,
Where I can find scheduler Task infomartion?
bench doctor gives me this message.

erp@sbk:~/frappe-bench$ bench doctor
Workers online: True
Pending tasks 15354
Timed out locks:

erp@sbk:~/frappe-bench$ 

How can I delete all pending task?

Also can anyone please explain following output

erp@sbk:~/frappe-bench$ bench dump-queue-status
[
 {
  "total": 15355
 }, 
 {
  "queue": "celery", 
  "event_counts": {
   "hourly": 1, 
   "null": 15354
  }, 
  "task_counts": {
   "frappe.tasks.scheduler_task": 1, 
   "frappe.tasks.pull_from_email_account": 1, 
   "frappe.tasks.sendmail": 10, 
   "frappe.tasks.enqueue_scheduler_events": 15343
  }, 
  "len": 15355
 }
]

@kolate_sambhaji not sure, you might have to check celery. I think if you know the queue name, you can go to redis prompt and flush it.

@rmehta thanks for reply.

We can delete task from following command, however it was not working due to deletion of frappe user from ubuntu.

To delete pending task, open bench console
Run following command

In [1]: from frappe.utils.doctor import purge_pending_tasks

In [2]: purge_pending_tasks(event='all')

Queue name is celery, When we try to run any celery command, we get connection failed message.
Error comes something like this

[2014-10-29 15:07:50,241: ERROR/MainProcess] consumer: Cannot connect to amqp://tonyg:**@127.0.0.1:5672//vir_host: [Errno 104] Connection reset by peer.
Trying again in 2.00 seconds...

It will help if you tell where is amqp configuration stored for celery and how to change it.

Error is resolved after recreating frappe user

2 Likes