librelist archives

« back to archive

How to destroy a job on the failed queue ?

How to destroy a job on the failed queue ?

From:
Thibaut Barrère
Date:
2010-03-31 @ 13:03
Hello,

probably a newbie question but I'm a bit lost here.

I've been working on rake tasks that can re-enqueue one or more failed jobs
based on criteria (eg: the original queue, etc).

I found out how to re-create the job, but I can't find a way to remove the
failed one.

I thought I would use Resque::Job.destroy, but it apparently adds "queue:"
in front of the queue ('failed') so it wouldn't work I think

    def self.destroy(queue, klass, *args)
      klass = klass.to_s
      queue = "queue:#{queue}"

Is there a clean way to do this ?

-- Thibaut

Re: [resque] How to destroy a job on the failed queue ?

From:
Chris Wanstrath
Date:
2010-03-31 @ 18:02
On Wed, Mar 31, 2010 at 6:03 AM, Thibaut Barrère
<thibaut.barrere@gmail.com> wrote:

> I've been working on rake tasks that can re-enqueue one or more failed jobs
> based on criteria (eg: the original queue, etc).
>
> I found out how to re-create the job, but I can't find a way to remove the
> failed one.
>
> I thought I would use Resque::Job.destroy, but it apparently adds "queue:"
> in front of the queue ('failed') so it wouldn't work I think
>
>     def self.destroy(queue, klass, *args)
>       klass = klass.to_s
>       queue = "queue:#{queue}"
>
> Is there a clean way to do this ?

You can do it with Redis, as Michael pointed out, but if you wanted to
write a patch for the Failure backend that would be awesome too ;)

-- 
Chris Wanstrath
http://github.com/defunkt

Re: [resque] How to destroy a job on the failed queue ?

From:
Michael Russo
Date:
2010-04-01 @ 13:48
On 2010-03-31, at 2:02 PM, Chris Wanstrath wrote:
> 
> You can do it with Redis, as Michael pointed out, but if you wanted to
> write a patch for the Failure backend that would be awesome too ;)


Yeah, that's where I was hoping we were going with this :)

-Michael

Re: [resque] How to destroy a job on the failed queue ?

From:
Thibaut Barrère
Date:
2010-04-01 @ 13:54
> You can do it with Redis, as Michael pointed out, but if you wanted to
> write a patch for the Failure backend that would be awesome too ;)

What do you expect the Failure backend to do with it ? You mean some kind of
retry + clear failed feature ?

-- Thibaut

Re: [resque] How to destroy a job on the failed queue ?

From:
Michael Russo
Date:
2010-04-01 @ 13:59
On 2010-04-01, at 9:54 AM, Thibaut Barrère wrote:

> What do you expect the Failure backend to do with it ? You mean some 
kind of retry + clear failed feature ?


Take another look at the Pyres implementation -- it patches the Failure 
backend to enable delete, and requeue+delete.

-Michael

Re: [resque] How to destroy a job on the failed queue ?

From:
Robert Slowley
Date:
2010-04-01 @ 14:00
unsubscribe

On Thu, Apr 1, 2010 at 2:59 PM, Michael Russo <mjrusso@gmail.com> wrote:
> On 2010-04-01, at 9:54 AM, Thibaut Barrère wrote:
>
>> What do you expect the Failure backend to do with it ? You mean some 
kind of retry + clear failed feature ?
>
>
> Take another look at the Pyres implementation -- it patches the Failure 
backend to enable delete, and requeue+delete.
>
> -Michael



-- 
http://www.slowley.com/
http://robhu.livejournal.com
http://robhu_bible.livejournal.com

"The holodeck will be society's last invention" - Scott Adams

Re: [resque] How to destroy a job on the failed queue ?

From:
Thibaut Barrère
Date:
2010-04-01 @ 14:02
> Take another look at the Pyres implementation -- it patches the Failure
backend to enable
> delete, and requeue+delete.

Ok, makes sense - I actually didn't have the time to look at it yet :)

I will see if I can come up with some patch for Resque!

-- Thibaut

2010/4/1 Michael Russo <mjrusso@gmail.com>

> Take another look at the Pyres implementation -- it patches the Failure
> backend to enable delete, and requeue+delete.
>

Re: [resque] How to destroy a job on the failed queue ?

From:
Michael Russo
Date:
2010-03-31 @ 14:00
Here's a pointer to the Pyres commit that added support for re-queuing 
(and deleting) failed jobs. [1]

The key thing to note is that you need to use the Redis LREM command 
(passing in the exact value of the element in the resque:failed list 
corresponding to the job that you want to delete).

[1]: 
http://github.com/aezell/pyres/commit/4391047978d4a5a3234811f8297520a29a8a1a04

Best,
Michael Russo

http://twitter.com/mjrusso

On 2010-03-31, at 9:03 AM, Thibaut Barrère wrote:

> Hello,
> 
> probably a newbie question but I'm a bit lost here.
> 
> I've been working on rake tasks that can re-enqueue one or more failed 
jobs based on criteria (eg: the original queue, etc).
> 
> I found out how to re-create the job, but I can't find a way to remove 
the failed one.
> 
> I thought I would use Resque::Job.destroy, but it apparently adds 
"queue:" in front of the queue ('failed') so it wouldn't work I think
> 
>     def self.destroy(queue, klass, *args)
>       klass = klass.to_s
>       queue = "queue:#{queue}"
> 
> Is there a clean way to do this ?
> 
> -- Thibaut

Re: [resque] How to destroy a job on the failed queue ?

From:
Thibaut Barrère
Date:
2010-03-31 @ 14:01
Hi Michael,

thanks a lot, I will go deeper into the code - I think I need a better
understanding of what's happening there :)

thanks!

-- Thibaut

2010/3/31 Michael Russo <mjrusso@gmail.com>

> Here's a pointer to the Pyres commit that added support for re-queuing (and
> deleting) failed jobs. [1]
>
> The key thing to note is that you need to use the Redis LREM command
> (passing in the exact value of the element in the resque:failed list
> corresponding to the job that you want to delete).
>
> [1]:
> http://github.com/aezell/pyres/commit/4391047978d4a5a3234811f8297520a29a8a1a04
>
> Best,
> Michael Russo
>
> http://twitter.com/mjrusso
>
> On 2010-03-31, at 9:03 AM, Thibaut Barrère wrote:
>
> > Hello,
> >
> > probably a newbie question but I'm a bit lost here.
> >
> > I've been working on rake tasks that can re-enqueue one or more failed
> jobs based on criteria (eg: the original queue, etc).
> >
> > I found out how to re-create the job, but I can't find a way to remove
> the failed one.
> >
> > I thought I would use Resque::Job.destroy, but it apparently adds
> "queue:" in front of the queue ('failed') so it wouldn't work I think
> >
> >     def self.destroy(queue, klass, *args)
> >       klass = klass.to_s
> >       queue = "queue:#{queue}"
> >
> > Is there a clean way to do this ?
> >
> > -- Thibaut
>
>

Re: [resque] How to destroy a job on the failed queue ?

From:
Michael Russo
Date:
2010-03-31 @ 14:13
Thibaut, there is some more detail that you might find helpful on the pyres list.

Go to http://librelist.com/browser/ , select pyres, and read the messages 
from the following dates:  March 16, March 17, March 22, March 23.

Let me know if you have any further questions.

Best,
Michael Russo

http://twitter.com/mjrusso

On 2010-03-31, at 10:01 AM, Thibaut Barrère wrote:

> Hi Michael,
> 
> thanks a lot, I will go deeper into the code - I think I need a better 
understanding of what's happening there :)
> 
> thanks!
> 
> -- Thibaut
> 
> 2010/3/31 Michael Russo <mjrusso@gmail.com>
> Here's a pointer to the Pyres commit that added support for re-queuing 
(and deleting) failed jobs. [1]
> 
> The key thing to note is that you need to use the Redis LREM command 
(passing in the exact value of the element in the resque:failed list 
corresponding to the job that you want to delete).
> 
> [1]: 
http://github.com/aezell/pyres/commit/4391047978d4a5a3234811f8297520a29a8a1a04
> 
> Best,
> Michael Russo
> 
> http://twitter.com/mjrusso
> 
> On 2010-03-31, at 9:03 AM, Thibaut Barrère wrote:
> 
> > Hello,
> >
> > probably a newbie question but I'm a bit lost here.
> >
> > I've been working on rake tasks that can re-enqueue one or more failed
jobs based on criteria (eg: the original queue, etc).
> >
> > I found out how to re-create the job, but I can't find a way to remove
the failed one.
> >
> > I thought I would use Resque::Job.destroy, but it apparently adds 
"queue:" in front of the queue ('failed') so it wouldn't work I think
> >
> >     def self.destroy(queue, klass, *args)
> >       klass = klass.to_s
> >       queue = "queue:#{queue}"
> >
> > Is there a clean way to do this ?
> >
> > -- Thibaut
> 
>