1
我想在這裏實現的是提交多個作業到的Gearman和打印結果返回由工人一旦他們完成與處理工作。的Gearman提交多個作業AttributeError的:「海峽」對象有沒有屬性「得到」
我已經通過實例上寫着:
https://pythonhosted.org/gearman/1to2.html#client-multiple-tasks https://pythonhosted.org/gearman/client.html
我又試圖實現以下方式check_request_status:
list_of_jobs = []
for i in xrange(1,4,1):
list_of_jobs.extend(dict(task='run_task', data=str(i)))
completed_requests = gm_client.wait_until_jobs_completed(submitted_requests,
poll_timeout=30.0)
for job_request in completed_requests:
if job_request.complete:
print job_request.result
elif job_request.timed_out:
print "Job %s timed out!" % job_request.unique
elif job_request.state == JOB_UNKNOWN:
print "Job %s connection failed!" % job_request.unique
,我發現了以下錯誤我甚至在Google-fu搜索過Gearman Google Groups並仔細研究其他人的Gearman實現後,似乎無法找到它:
Traceback (most recent call last):
File "supervisor.py", line 16, in <module>
completed_requests = gm_client.submit_multiple_jobs(list_of_jobs)
File "/usr/local/lib/python2.7/dist-packages/gearman/client.py", line 48, in submit_multiple_jobs
requests_to_submit = [self._create_request_from_dictionary(job_info, background=background, max_retries=max_retries) for job_info in jobs_to_submit]
File "/usr/local/lib/python2.7/dist-packages/gearman/client.py", line 169, in _create_request_from_dictionary
job_unique = job_info.get('unique')
AttributeError: 'str' object has no attribute 'get'
有沒有人知道這裏發生了什麼?