Any way to stop a running job?

105 views
Skip to first unread message

John Joseph Bachir

unread,
Oct 7, 2011, 10:36:29 PM10/7/11
to delay...@googlegroups.com
If I have the id of a job, is there any way to stop it while it's running?

Matt Griffin

unread,
Oct 7, 2011, 10:42:19 PM10/7/11
to delay...@googlegroups.com
You'd have to kill the worker processing the job.

John Joseph Bachir

unread,
Oct 8, 2011, 5:33:59 PM10/8/11
to delay...@googlegroups.com
On Fri, Oct 7, 2011 at 10:42 PM, Matt Griffin <ma...@griffinonline.org> wrote:
You'd have to kill the worker processing the job.

Thanks -- after I asked my question I realized I can use locked_at and locked_by to do this.

So is there a recommend signal I should send to the worker? And will the 'error' or 'failure' hooks be invoked on the job before the worker quits?

Thanks!
John

Joshua Tidsbury

unread,
Oct 8, 2011, 5:49:38 PM10/8/11
to <delayed_job@googlegroups.com>
In some instances, I have added a column to the delayed job table that the worker occasionally checks, and if the flag is set to cancel, it just stops what it is doing and then completes the task cleanly so you don't have to worry about bringing another worker back online.

Josh


-----
Josh Tidsbury

Greg Blass

unread,
Aug 21, 2019, 5:47:09 PM8/21/19
to delayed_job
Just wondering if anyone has figured out how to do this?
Reply all
Reply to author
Forward
0 new messages