Is there any way to kill specific background job process? I’ve read about bench purge-jobs, but I need to destroy not only the pending ones, but also the process that currently running.
The reason I needed this is because there was an error during background job process that shown in logs/worker.log the process just stopped there, and I could not do anything except restart the server (reboot the machine).
Yes it is possible to cancel running background job through RQ jobs. but it needs to done manually from console for v13. thanks
from rq.command import send_stop_job_command
from rq import Worker
from frappe.utils.background_jobs import get_redis_conn
con = get_redis_conn()
workers = Worker.all(con)
for w in workers:
job = w.get_current_job()
if job:
if job.id == "your_job_id":
send_stop_job_command(con, job)