Cannot cancel a job from the Gearman queue
Bug #1150071 reported by
Khai Do
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gearman |
Fix Released
|
Medium
|
Brian Aker |
Bug Description
I have a use case where I would like to cancel jobs from the gearman queue. However there is no way to do this right now.
Use case:
My client will place the jobs on the gearman queue with an associated UUID. Some jobs take a long time to run so the gearman server can get backed up with many jobs still on its queue. Sometimes I'll want to cancel a job after placing it on the gearman queue because I've determined that it no longer needs to be run because some previous job that it dependend on failed.
Please add the ability to cancel jobs from the queue. Thanks.
Related branches
lp:~brianaker/gearmand/cancel
(Merged)
Changed in gearmand: | |
status: | New → In Progress |
importance: | Undecided → Medium |
milestone: | none → 1.0.4 |
Changed in gearmand: | |
status: | In Progress → Fix Committed |
milestone: | 1.0.4 → 1.1.6 |
Changed in gearmand: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Excerpts from Khai Do's message of 2013-03-06 18:18:14 UTC:
> Public bug reported:
>
> I have a use case where I would like to cancel jobs from the gearman
> queue. However there is no way to do this right now.
>
> Use case:
> My client will place the jobs on the gearman queue with an associated UUID. Some jobs take a long time to run so the gearman server can get backed up with many jobs still on its queue. Sometimes I'll want to cancel a job after placing it on the gearman queue because I've determined that it no longer needs to be run because some previous job that it dependend on failed.
>
> Please add the ability to cancel jobs from the queue. Thanks.
IMO this is not necessary. Any time something can be done in workers,
it will be more scalable to do it there.
Simply have a sentinel check on a known distributed location (like a
memcache or redis key) in your workers.
function do_thing($job) $job->payload( ))['id' ]; client- >get("cancelled _$id");
{
$id = json_decode(
$cancelled = $memcache_
if ($cancelled) {
return;
}
// .. do work
}
Then instead of needing to reach into gearmand to cancel a job, thus read-scalable external service out of band of gearmand entirely.
locking the queue, searching it, and removing it.. you are just poking
a highly-