我有一个简单的 python 脚本来发送 gearman 任务:
客户:
# "source" is a simple tuple
client = GearmanClient(['localhost'])
client.submit_job('queue_feed', simplejson.dumps(source))
服务器:
def queue_feed(work, job):
source = simplejson.loads(job.data)
print source
if __name__ == '__main__':
if len(sys.argv) > 1:
if sys.argv[1] == "spawn":
worker = GearmanWorker(['localhost'])
#nohup python /home/padsquad/apps/gearman_articles.py spawn &
worker.register_task('queue_feed', queue_feed)
print 'working...'
worker.work()
我不确定我在这里做错了什么,gearman 服务器不断给我以下错误:
TypeError: Expecting byte string, got <type 'NoneType'>