#!/usr/bin/python
import gearman
import time
def check_request_status(job_request):
if job_request.complete:
print ("Job finished! ")
print (job_request.result)
elif job_request.timed_out:
print ("Job timed out!")
elif job_request.state == JOB_UNKNOWN:
print ("Job connection failed!" )
gm_worker = gearman.GearmanWorker(['localhost:4730'])
def task_listener(gearman_worker, gearman_job):
return gearman_job.data + ' from listener\n'
gm_worker.set_client_id('whatever iid');
gm_worker.register_task('wwcc', task_listener)
gm_worker.work()
Solving problems is fun. But solving the same problem over and over is pain. Once solved, forever solved.
sourcecode
Sunday, April 14, 2013
Python with Gearman (as worker)
http://pythonhosted.org/gearman/worker.html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment