有没有办法在执行任务时处理任何软期限? DeadlineExceededError在执行10分钟后抛出,我在几秒钟后给出一些东西。 我想在任务死亡之前清理一些东西并创建一个新任务。这可能需要几秒钟。有没有办法通过捕获任何异常,如约9分钟来做到这一点。 我知道我可以在9分钟后手动抛出异常。但是这可以由GAE自动完成吗?Google App Engine任务截止日期
class FillMtxHandler():
def post(self,index,user,seqlen):
try :
FillMtx(index,user,seqlen)
except DeadlineExceededError:
deferred.defer(self.post,index,user,seqlen)
以上是我的代码。索引是一个列表,从0开始。它将在FillMtx中递增。一旦截止日期超出错误被抛出,我想继续索引最后增加的位置。我收到以下错误
The API call taskqueue.BulkAdd() was explicitly cancelled.
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 517, in __call__
handler.post(*groups)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/deferred/deferred.py", line 258, in post
run(self.request.body)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/deferred/deferred.py", line 124, in run
return func(*args, **kwds)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/deferred/deferred.py", line 166, in invoke_member
return getattr(obj, membername)(*args, **kwargs)
File "/base/data/home/apps/0xxopdp/3.347813391084738922/fillmtx.py", line 204, in post
deferred.defer(self.post,index,user,seqlen)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/deferred/deferred.py", line 241, in defer
return task.add(queue, transactional=transactional)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/taskqueue/taskqueue.py", line 688, in add
return Queue(queue_name).add(self, transactional=transactional)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/taskqueue/taskqueue.py", line 744, in add
self.__AddTasks(tasks, transactional)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/taskqueue/taskqueue.py", line 770, in __AddTasks
apiproxy_stub_map.MakeSyncCall('taskqueue', 'BulkAdd', request, response)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 86, in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 286, in MakeSyncCall
rpc.CheckSuccess()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 126, in CheckSuccess
raise self.exception
CancelledError: The API call taskqueue.BulkAdd() was explicitly cancelled.
我发现一个新任务已创建并排队。但为什么GAE仍然会抛出这个错误?
我该如何确定在命中硬限制之前将任务添加到任务队列?我得到了“CancelledError:明确取消了API调用taskqueue.BulkAdd()”,即使已经添加了任务 – Sam 2011-01-22 15:00:29
如果用完宽限时间,CancelledError会启动。 – systempuntoout 2011-01-22 17:37:44