from django_rq import get_queue
q = get_queue()
job = q.enqueue(processing)
from django_rq import get_queue
q = get_queue()
job_id = ***
job = q.fetch_job(job_id)
job.cancel()
job.delete()
β The processing running on the worker has not stopped
def processing:
job = get_current_job()
worker = get_worker()
job.meta['pid'] = worker.pid
job.save()
...
from django_rq import get_queue
import os
import signal
q = get_queue()
job_id = ***
job = q.fetch_job(job_id)
pid = job.meta['pid']
os.kill(int(pid), signal.SIGTERM)
job.cancel()
job.delete()
ββIs there any other good way?
Add a good method
Recommended Posts