Error Running Gearman for Windows 7

203 views Asked by At

Hi I installed perl's gearman package in windows 7 and written simple client and worker just to connect to gearman server as follows :

Client.pl

use Gearman::Client;

my $client = Gearman::Client->new;
$client->job_servers('127.0.0.1:7003');

and Worker.pl

use Gearman::Worker;

my $worker = Gearman::Worker->new;
$worker->job_servers('127.0.0.1:7003');

$worker->work while 1;

but when i runs worker.pl, command prompt for gearmand gives error as Error accepting incoming connection: Bad file descriptor

I have also tried with python worker and clients ( which works correctly under cygwin and with gearman 0.14) for reversing string but it shows the same error.

My Python Modules are :

Client.py

import gearman

def check_request_status(job_request):
    if job_request.complete:
        print "Job %s finished!  Result: %s - %s" % (job_request.job.unique, job_request.state, job_request.result)
    elif job_request.timed_out:
        print "Job %s timed out!" % job_request.unique
    elif job_request.state == JOB_UNKNOWN:
        print "Job %s connection failed!" % job_request.unique

gm_client = gearman.GearmanClient(['127.0.0.1:7003'])

completed_job_request = gm_client.submit_job("reverse", "Hello World!")
check_request_status(completed_job_request)

and worker.py

import gearman

gm_worker = gearman.GearmanWorker(['127.0.0.1:7003'])

def task_listener_reverse(gearman_worker, gearman_job):
    print 'Reversing string: ' + gearman_job.data
    return gearman_job.data[::-1]

# gm_worker.set_client_id is optional
gm_worker.set_client_id('python-worker')
gm_worker.register_task('reverse', task_listener_reverse)

# Enter our work loop and call gm_worker.after_poll() after each time we timeout/see socket activity
gm_worker.work()

When i run Client.pl gearmand command prompt gives error as follows:

Error: Can't locate object method "CMD_" via package "Gearman::Server::Client" at C:/Perl/site/lib/Gearman/Server/Client.pm line 505.

Can anybody please resolve this issue?

0

There are 0 answers