指定使用GAE延期库排队的任务的重试限制 [英] Specifying retry limit for tasks queued using GAE deferred library

查看:92
本文介绍了指定使用GAE延期库排队的任务的重试限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用GAE



...





你可以使用 TaskRetryOptions()的 task_retry_limit 属性:


task_retry_limit



失败任务的重试尝试的最大次数。

在推送队列中,每次App Engine都会增加计数器尝试执行任务,直至指定的task_retry_limit。如果使用task_age_limit指定,App Engine将重试该任务,直到达到两个限制。



在拉出队列中,每次租用任务时,计数器都会增加,直到指定task_retry_limit。

注意:答案仅基于文档,我没有实际执行它,YMMV。

We are offloading certain time consuming tasks using the GAE deferred library and would like to know how can we set the retry limit for those offloaded tasks. We are running into issues where certain tasks are retried for ever as the task would never succeed due to some un recoverable exception.

解决方案

According to the documentation the _retry_options of the deferred.defer API can be used to pass retry options to the associated Task() instance:

_countdown, _eta, _headers, _name, _target, _transactional, _url, _retry_options, _queue: Passed through to the task queue - see the task queue documentation for details.

From the Task() doc:

...

And you can use the TaskRetryOptions()'s task_retry_limit property:

task_retry_limit

The maximum number of retry attempts for a failed task.

In push queues, the counter is incremented each time App Engine tries the task, up to the specified task_retry_limit. If specified with task_age_limit, App Engine retries the task until both limits are reached.

In pull queues, the counter is incremented each time the task is leased, up to the specified task_retry_limit. Tasks are deleted automatically once they have been leased the number of times specified in the limit.

Note: the answer is based on documentation only, I didn't actually implemented it, YMMV.

这篇关于指定使用GAE延期库排队的任务的重试限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆