Just another perl hacker somewhere near Disneyland
I have this homenode [perlmonks.org] of little consequence on Perl Monks [perlmonks.org] that you probably have no interest in whatsoever.
I also have some modules [cpan.org] on CPAN [cpan.org] some of which are marginally [cpan.org] more [cpan.org] useful [cpan.org] than others.
I've been using Gearman a lot lately with Gearman::XS. In an effort to reduce boilerplate, I've released GearmanX::Starter to launch Gearman workers.
Other features of the module are signal handling, where if a worker gets a SIGTERM, it'll finish any current task before terminating. To get this to work, I had to use Perl::Unsafe::Signals, otherwise you could not terminate the process while the worker was waiting for a job. It would only terminate after getting a new task from the server (causing the task to fail).
I had an interesting issue converting a worker script to using my GX::S module though...One line had $job->send_complete(1); which tells gearman to send the result "1" and a status of "complete" to the client. However, I was getting an error of "gearman_con_flush:write:14" when the worker was trying to wait for the next job. This didn't happen before I started using GX::S, but it was fixed when I changed the code to $job->send_complete("1"); (with quotes). I can not come up with a simple test case, but just in case someone else has the same issue, here's the possible work around.
Update: This is with Gearman::XS 0.7. It doesn't seem to occur with 0.8, so perhaps it's time to upgrade
Gearman fun and frustration 0 Comments More | Login | Reply /