I am using the php-resque library and jobs can be created and tracked using the following code.
$token = Resque::enqueue('queue', 'Job', NULL, true);
$statusTracker = new Resque_Job_Status($token);
$status = $statusTracker->get();
But given the token returned by the enqueue
method, how can the job be stopped?
I have found this on the project page, but it doesn't use the job token to stop a job, it uses the worker id instead.
Considering that I might have more than one worker active, how can I found the worker id that is doing the requested job?
As far as I know, Resqueue doesn't support 'aborting' or 'stopping' jobs. But if you can somehow manage to save the cancel action in some sort of DB you'll be fine. You can do a additional check in the performAction(). Something like;
Last but not least; this might not always work when jobs are already executed before the cancellation was done..