Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

about Gearman::Client options

by liuweichuan (Acolyte)
on Mar 18, 2017 at 01:25 UTC ( #1185101=perlquestion: print w/replies, xml ) Need Help??
liuweichuan has asked for the wisdom of the Perl Monks concerning the following question:

hi everyone,

i have a problem one Gearman::Client or Gearman::Task. for this way,

Gearman::Task->new($func, $arg, \%options)

i set the options "uniq" and "timeout", but it cannot work,

use Gearman::Client; my $client = Gearman::Client->new; $client->job_servers(''); my $taskset = $client->new_task_set; $taskset->add_task('fun' => undef ,{ uniq => 1, on_complete => sub{print ${$_[0]}}, timeout => 2, } ); $taskset->wait;


use Gearman::Worker; my $worker = Gearman::Worker->new; $worker->job_servers(''); $worker->register_function('fun' =>\&w); $worker->work while 1; sub w{ print "3"; return 3; }

i want to resold 2 problem, 1) run the same names of functions on workers in parallel, so i try the option "uniq", but it's not any result. 2) runing when the client call a function not existed, so i try the timeout, but ..

or help me how to get functions registed on server.

Plz help me, thx

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1185101]
Approved by stevieb
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-12-17 18:33 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (466 votes). Check out past polls.