gearman-go/example/py/worker.py
2011-05-22 23:02:03 +08:00

22 lines
351 B
Python
Executable File

#!/usr/bin/python
import time
from gearman import libgearman
def toUpper(job):
r = job.get_workload().upper()
print r
return r
def main():
worker = libgearman.Worker()
worker.add_server("127.0.0.1", 4730)
worker.add_function("ToUpper", toUpper)
while True:
worker.work()
if __name__ == '__main__':
main()