我正在使用 Google AppEngine 和延迟库,以及 Mapper
类,如 here 所述(有一些改进,如 here )。在映射器的某些迭代中,我收到以下错误:
CancelledError: The API call datastore_v3.Put() was explicitly cancelled.
Mapper 通常运行良好,我以前有更高的批处理大小,因此它实际上会遇到 DeadlineExceededError
,并且处理正确。
可以肯定的是,我将 batch_size 减少到一个非常低的数字,这样它就不会遇到 DeadlineExceededError
但我仍然会收到 CancelledError
。
堆栈轨迹如下:
File "utils.py", line 114, in _continue
self._batch_write()
File "utils.py", line 76, in _batch_write
db.put(self.to_put)
File "/google/appengine/ext/db/__init__.py", line 1238, in put
keys = datastore.Put(entities, rpc=rpc)
File "/google/appengine/api/datastore.py", line 255, in Put
'datastore_v3', 'Put', req, datastore_pb.PutResponse(), rpc)
File "/google/appengine/api/datastore.py", line 177, in _MakeSyncCall
rpc.check_success()
File "/google/appengine/api/apiproxy_stub_map.py", line 474, in check_success
self.__rpc.CheckSuccess()
File "/google/appengine/api/apiproxy_rpc.py", line 126, in CheckSuccess
raise self.exception
CancelledError: The API call datastore_v3.Put() was explicitly cancelled.
我真的找不到很多关于这个“显式取消”错误的信息,所以我想知道是什么原因造成的,以及如何调查。
最佳答案
在 DeadlineExceededError
之后,您可以有很短的宽限时间来处理异常,例如推迟剩余的计算。
如果您用完了宽限时间,CancelledError
就会启动。
应该没有办法捕获/处理 CancelledError
关于python - 应用引擎 'explicitly cancelled' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2248811/