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