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

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('127.0.0.1:7003'); 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('127.0.0.1:7003'); $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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2017-07-25 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (363 votes). Check out past polls.