我在本地开发服务器上使用 GAE Python 2.7。我已经配置了一个后端
backends:
- name: worker
class: B1
options: dynamic
我正在使用默认的任务队列。一切正常,后端和任务队列在 SDK 控制台可见。本地开发工作也开始没有任何错误:
Multiprocess Setup Complete:
Remote API Server [http://localhost:9200]
App Instance [http://localhost:9000]
Backend Instance: worker.0 [http://localhost:9100]
Backend Balancer: worker [http://localhost:9199]
但是如果我尝试通过任务处理后端
taskqueue.add(url='/xyz', method='POST', target='worker', params={'a':'b'})
此错误引发:
ERROR An error occured while sending the task "task1" (Url: "/backend/languages/create_database/") in queue "default". Treating as a task error.
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/taskqueue/taskqueue_stub.py", line 1884, in ExecuteTask
connection.endheaders()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 937, in endheaders
self._send_output(message_body)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 797, in _send_output
self.send(msg)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 759, in send
self.connect()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 740, in connect
self.timeout, self.source_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 8] nodename nor servname provided, or not known
我正在使用“本地主机”,但看不出它失败的任何原因。一些想法/解决方案?是否缺少任何启动参数或类似的东西?
谢谢
最佳答案
这是 taskqueue.py
中的错误, 它漏掉了一个区分生产环境和开发环境的案例。
在生产中,它通过将 target
与 hostname
连接起来做正确的事情。
在开发中,这不起作用,并且会产生您在尝试解析 worker.localhost
地址时报告的错误。
相反,它应该将任务主机设置为运行后端的 ip:port
dev_appserver。
已经有一个bug在已上报给工程团队的公共(public)问题跟踪器中。
如果您想收到有关更新的通知,请随时为其加注星标。
关于python - App Engine Python 开发服务器 + 任务队列 + 后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13273067/