gearman-go/example/py/worker.py

20 lines
295 B
Python
Raw Normal View History

2011-05-22 23:02:03 +08:00
#!/usr/bin/python
import time
import gearman
2011-05-22 23:02:03 +08:00
def toUpper(worker, job):
r = job.data.upper()
2011-05-22 23:02:03 +08:00
print r
return r
def main():
worker = gearman.GearmanWorker(['localhost:4730'])
worker.register_task('ToUpper', toUpper)
worker.work()
2011-05-22 23:02:03 +08:00
if __name__ == '__main__':
main()