Can gearmand retry background job?

1,246 views
Skip to first unread message

Alexander Artemenko

unread,
Nov 25, 2009, 4:40:29 AM11/25/09
to gearman
Hi,

I'm interested in the gearmand, but can't found if it can retry failed
background jobs?

For example, I have a job which access the database, but something
happen with server and it is not available right now. How could I
retry this job later?

Jasper van Wanrooy - Royalfish eSolutions

unread,
Nov 25, 2009, 1:27:59 PM11/25/09
to gea...@googlegroups.com
Hi,

Possibly you can resubmit the job. Is that an option?

Eric Day

unread,
Nov 25, 2009, 1:31:50 PM11/25/09
to gea...@googlegroups.com
You can resubmit the job, but I think what he wants is to have
a resubmit with job delay. This is currently not supported, but
something on the roadmap of things to add.

-Eric

Vick Khera

unread,
Nov 25, 2009, 2:01:44 PM11/25/09
to gea...@googlegroups.com
On Wed, Nov 25, 2009 at 1:31 PM, Eric Day <ed...@oddments.org> wrote:
> You can resubmit the job, but I think what he wants is to have
> a resubmit with job delay. This is currently not supported, but
> something on the roadmap of things to add.

If the worker calls fail() when handling a job, what does the server
do with that job? Assumption is that it is a background job.

My expectation would be that it would stay in queue and get handed out
again the next time it came up to the front of the queue, but the docs
don't say as far as I could find.

Kiall Mac Innes

unread,
Nov 25, 2009, 2:09:36 PM11/25/09
to gea...@googlegroups.com
My understanding, and the way I've written my workers, is that when a background job fails, its gone..

I catch any errors, and re-submit the job from within my wokers (as low priority), which has the added bonus of moving the job to the end of the queue preventing other tasks from being held up. I also ensure I keep track of the number of retries - when a limit is hit, I log and drop the task.

Several of my workers also "clean-up" if necessary when this limit is hit, for example, a worker to thumbnail a photo will email a failure notice to the user and remove the photo from the database when this limit is hit.

Kiall

2009/11/25 Vick Khera <vi...@khera.org>

Eric Day

unread,
Nov 25, 2009, 2:10:41 PM11/25/09
to gea...@googlegroups.com
The Gearman job server will consider the job complete if you call
fail() from the worker. For a background job it just gets dropped on
the floor (so you should do any error reporting in worker).

If a worker dies without sending any response back to the job server
(no success/fail/...) it will get re-queued for another worker.

-Eric

Kiall Mac Innes

unread,
Nov 25, 2009, 2:13:10 PM11/25/09
to gea...@googlegroups.com
If a worker dies without sending any response back to the job server
(no success/fail/...) it will get re-queued for another worker.

Humm - really - Does the worker report the task as "finished with no status" or does this work on a timeout from the gearmand side?

Thanks,
Kiall


2009/11/25 Eric Day <ed...@oddments.org>

Alexander Artemenko

unread,
Nov 25, 2009, 2:21:55 PM11/25/09
to gea...@googlegroups.com
Hi,

2009/11/25 Kiall Mac Innes <ki...@managedit.ie>:
>> If a worker dies without sending any response back to the job server
>> (no success/fail/...) it will get re-queued for another worker.
>
> Humm - really - Does the worker report the task as "finished with no status"
> or does this work on a timeout from the gearmand side?

No. I just tried to raise exception in my python worker, and expected
that it will be retried automagically. Now I understand, that I must
to handle such exceptions myself, but I still could not figure out,
how to introduce a delay between retries.

--
Alexander Artemenko (a.k.a. Svetlyak 40wt)
Blog: http://aartemenko.com
Photos: http://svetlyak.ru
Jabber: svetly...@gmail.com

Brian Moon

unread,
Nov 25, 2009, 2:30:31 PM11/25/09
to gea...@googlegroups.com
> how to introduce a delay between retries.

You can't. See my post from a couple of weeks ago about a solution.

Brian.

Alexander Artemenko

unread,
Nov 25, 2009, 2:42:29 PM11/25/09
to gea...@googlegroups.com
Hi Brian,

2009/11/25 Brian Moon <br...@moonspot.net>:
>> how to introduce a delay between retries.
>
> You can't.  See my post from a couple of weeks ago about a solution.

I can't find this post. All post which I found at
http://brian.moonspot.net/tag.php?tag=gearman are pretty old.

--
Alexander

Eric Day

unread,
Nov 27, 2009, 12:57:23 PM11/27/09
to gea...@googlegroups.com
This is only based on a TCP timeout/disconnect. There is currently
no command you can send back that says "retry this on another
worker." This is something I hope to add soon though, since this
would be very useful along with a delay (retry this in X seconds on
another worker).

-Eric

Murthy A

unread,
Jan 23, 2014, 7:27:51 AM1/23/14
to gea...@googlegroups.com
I guess the link was not working
Here is the link I found on the homepage of the site
http://hermanradtke.com/2011/04/11/retrying-failed-gearman-jobs.html

On Wednesday, April 3, 2013 6:37:10 PM UTC+5:30, Catalin Banu wrote:
You will have to exit with non zero code. http://www.hermanradtke.com/blog/blog/retrying-failed-gearman-jobs  
Reply all
Reply to author
Forward
0 new messages