python - 应用引擎 'explicitly cancelled' 错误

标签 python google-app-engine scheduled-tasks google-cloud-datastore

我正在使用 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/

相关文章:

ios - XCode 7 和部署目标 10.10 的 GTL 框架构建错误

java - Quartz Scheduler (cron) 能否在同一执行时间调度多个作业?

python - 有人可以解释这个条件分配吗?

python - Flask,如何响应页面上的图片

python - 从 bash 向 python 发送参数

python - Scrapy安装报错pip和easy_install

google-app-engine - 尝试读取 *http.Response Body 时出现运行时错误,已使用 urlfetch.Transport

java - 在Google Appengine中使用MapOnlyMapper时出现RetryHandler异常

ruby - 如何每月在 Heroku 运行一次 Scheduler 插件?

linux - 每 2 小时自动退出 perl 脚本