我正在尝试将Python应用程序从App Engine标准环境移植到App Engine Flexible环境。在the directions in the App Engine documentation之后,我将app.yaml文件更改为使用“python-compat”模式,如下所示:
service: default
runtime: python-compat
api_version: 1
vm: true
threadsafe: true
instance_class: F2
inbound_services:
- warmup
builtins:
- remote_api: on
env_variables:
GCLOUD_PROJECT: the-name-of-my-project
部署后,任何从应用程序调用数据存储区的尝试(使用NDB api)都会导致以下引用(截断):
File "/env/local/lib/python2.7/site-packages/google/appengine/datastore/datastore_rpc.py" in check_rpc_success
1371. rpc.check_success()
File "/env/local/lib/python2.7/site-packages/google/appengine/api/apiproxy_stub_map.py" in check_success
579. self.__rpc.CheckSuccess()
File "/env/local/lib/python2.7/site-packages/google/appengine/ext/vmruntime/vmstub.py" in _WaitImpl
312. raise self._ErrorException(*_DEFAULT_EXCEPTION)
Exception Type: RPCFailedError at /volume-list/
Exception Value: The remote RPC to the application server failed for call datastore_v3.RunQuery().
知道问题是什么吗?据我所知,App Engine文档没有给出使用python-compat运行时设置NDB的特殊指令。
答案 0 :(得分:1)
我本周刚遇到这个错误,在调试它并使用App Engine支持后,找到了答案。
查看我的SO answer here for more details,或者只需将以下代码添加到appengine_config.py
:
try:
import appengine.ext.vmruntime.vmstub as vmstub
except ImportError:
pass
else:
if isinstance(vmstub.DEFAULT_TIMEOUT, (int, long)):
# Newer requests libraries do not accept integers as header values.
# Be sure to convert the header value before sending.
# See Support Case ID 11235929.
vmstub.DEFAULT_TIMEOUT = bytes(vmstub.DEFAULT_TIMEOUT)